Skip to content

Commit

Permalink
fix update.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 20, 2017
1 parent 5977684 commit 092d22a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# More at https://ownyourbits.com/
#


cp etc/library.sh /usr/local/etc/

source /usr/local/etc/library.sh
Expand All @@ -26,11 +25,13 @@ for file in etc/nextcloudpi-config.d/*; do
[ -f /usr/local/$file ] || install_script $file

# save current configuration to (possibly) updated script
VARS=( $( grep "^[[:alpha:]]\+_=" /usr/local/$file | cut -d= -f1 ) )
VALS=( $( grep "^[[:alpha:]]\+_=" /usr/local/$file | cut -d= -f2 ) )
for i in `seq 0 1 ${#VARS[@]} `; do
sed -i "s|^${VARS[$i]}=.*|${VARS[$i]}=${VALS[$i]}|" $file
done
[ -f /usr/local/$file ] && {
VARS=( $( grep "^[[:alpha:]]\+_=" /usr/local/$file | cut -d= -f1 ) )
VALS=( $( grep "^[[:alpha:]]\+_=" /usr/local/$file | cut -d= -f2 ) )
for i in `seq 0 1 ${#VARS[@]} `; do
sed -i "s|^${VARS[$i]}=.*|${VARS[$i]}=${VALS[$i]}|" $file
done
}

cp $file /usr/local/$file
done
Expand Down

0 comments on commit 092d22a

Please sign in to comment.