Skip to content
Snippets Groups Projects
Commit 5cc4ffed authored by Bob Mottram's avatar Bob Mottram
Browse files

Set disk free value when syncthing ids change

parent 927f227f
No related branches found
No related tags found
No related merge requests found
......@@ -291,16 +291,18 @@ function upgrade_syncthing {
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if grep -q 'minDiskFree unit' "/home/$USERNAME/.config/syncthing/config.xml"; then
if ! grep -q "minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT<" "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|minDiskFree unit=.*|minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" "/home/$USERNAME/.config/syncthing/config.xml"
syncthing_users_changed=1
if [ -f "/home/$USERNAME/.config/syncthing/config.xml" ]; then
if grep -q 'minDiskFree unit' "/home/$USERNAME/.config/syncthing/config.xml"; then
if ! grep -q "minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT<" "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|minDiskFree unit=.*|minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" "/home/$USERNAME/.config/syncthing/config.xml"
syncthing_users_changed=1
fi
fi
fi
if grep -q '<minDiskFreePct>' "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|<minDiskFreePct>.*|<minDiskFreePct>$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFreePct>|g" "/home/$USERNAME/.config/syncthing/config.xml"
syncthing_users_changed=1
if grep -q '<minDiskFreePct>' "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|<minDiskFreePct>.*|<minDiskFreePct>$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFreePct>|g" "/home/$USERNAME/.config/syncthing/config.xml"
syncthing_users_changed=1
fi
fi
done
......
......@@ -282,6 +282,20 @@ function user_devices_changed {
CHANGED=1
fi
if [ -f "/home/$USERNAME/.config/syncthing/config.xml" ]; then
if grep -q 'minDiskFree unit' "/home/$USERNAME/.config/syncthing/config.xml"; then
if ! grep -q "minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT<" "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|minDiskFree unit=.*|minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" "/home/$USERNAME/.config/syncthing/config.xml"
CHANGED=1
fi
fi
if grep -q '<minDiskFreePct>' "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|<minDiskFreePct>.*|<minDiskFreePct>$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFreePct>|g" "/home/$USERNAME/.config/syncthing/config.xml"
CHANGED=1
fi
fi
if [ -f "/home/$USERNAME/$SYNCTHING_USER_IDS_FILE" ]; then
while read -r line || [[ -n "$line" ]]; do
if [[ $line != *"#"* && $line != *"*"* && $line != *'/'* && $line == *"-"* ]]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment