fix upgrade script when there are line differences between the old and new configs, keep the old config

This commit is contained in:
Alfonso Gamboa 2022-06-04 04:25:15 -07:00
parent 041e7d2663
commit 7a108fc734

View File

@ -102,7 +102,16 @@ rm -f /opt/factory_t31_ZMC6tiIDQN
mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/factory_t31_ZMC6tiIDQN /opt/factory_t31_ZMC6tiIDQN mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/factory_t31_ZMC6tiIDQN /opt/factory_t31_ZMC6tiIDQN
diff /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/wz_mini.conf diff /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/wz_mini.conf
if [ $(cat /opt/Upgrade/preserve/wz_mini.conf | wc -l) != $(cat /opt/wz_mini/wz_mini.conf | wc -l) ]; then
echo "doesn't match, keep old config"
mv /opt/wz_mini/wz_mini.conf /opt/wz_mini/wz_mini.conf.dist
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/ cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
else
echo "configs match"
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
fi
cp /opt/Upgrade/preserve/ssh/* /opt/wz_mini/etc/ssh/ cp /opt/Upgrade/preserve/ssh/* /opt/wz_mini/etc/ssh/
cp /opt/Upgrade/preserve/configs/* /opt/wz_mini/etc/configs cp /opt/Upgrade/preserve/configs/* /opt/wz_mini/etc/configs
cp -r /opt/Upgrade/preserve/wireguard /opt/wz_mini/etc/ cp -r /opt/Upgrade/preserve/wireguard /opt/wz_mini/etc/