From 940b6a866fce4ff36accf51fad89bedfad6333ba Mon Sep 17 00:00:00 2001 From: Xavier Gouchet Date: Sat, 10 Dec 2016 10:50:00 +0100 Subject: [PATCH] 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. --- install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 31eedcf..71091ac 100755 --- a/install.sh +++ b/install.sh @@ -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