Browse Source

Improved update of config files from templates

umbrel
kenshin-samourai 6 years ago
parent
commit
ad8a5320f2
  1. 18
      docker/my-dojo/install/upgrade-scripts.sh

18
docker/my-dojo/install/upgrade-scripts.sh

@ -35,20 +35,18 @@ update_config_files() {
# Update a configuration file from template # Update a configuration file from template
update_config_file() { update_config_file() {
sed "/^#.*/P;s/=.*//g;/^$/d" $1 > ./original.raw sed "s/^#.*//g;s/=.*//g;/^$/d" $1 > ./original.keys.raw
sed "/^#.*/P;s/=.*//g;/^$/d" $2 > ./tpl.raw grep -f ./original.keys.raw $1 > ./original.lines.raw
grep -vf ./original.raw ./tpl.raw > ./newvals.dat
cp -p $1 "$1.save" cp -p $1 "$1.save"
cp -p $2 $1
echo " while IFS='=' read -r key val ; do
" >> $1 sed -i "s/$key=.*/$key=$val/g" "$1"
done < ./original.lines.raw
grep -f ./newvals.dat $2 >> $1 rm ./original.keys.raw
rm ./original.lines.raw
rm ./original.raw
rm ./tpl.raw
rm ./newvals.dat
} }
# Update dojo database # Update dojo database

Loading…
Cancel
Save