Update the install script

This fixes the scopatz/nanorc#130 issue by preventing the install script
to sort the ~/.nanorc config file, and only add includes if they're not
already present.
This commit is contained in:
Xavier Gouchet 2016-12-10 10:50:00 +01:00
parent d2d84b8206
commit 940b6a866f
No known key found for this signature in database
GPG Key ID: 7650A5084AB64CD6
1 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,5 @@
#!/bin/sh
wget -O /tmp/nanorc.zip https://github.com/scopatz/nanorc/archive/master.zip
if [ ! -d ~/.nano/ ]
then
@ -16,7 +18,10 @@ then
touch ~/.nanorc
fi
cat ~/.nano/nanorc >> ~/.nanorc
sort -u ~/.nanorc > /tmp/nanorc2
cat /tmp/nanorc2 > ~/.nanorc
rm /tmp/nanorc2
# add all includes from ~/.nano/nanorc if they're not already there
NANORC_FILE=~/.nanorc
while read inc; do
if ! grep -q "$inc" "${NANORC_FILE}"; then
echo "$inc" >> $NANORC_FILE
fi
done < ~/.nano/nanorc