summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/calcurse-upgrade14
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/calcurse-upgrade b/scripts/calcurse-upgrade
index 2fa7d4f..1fc481f 100644
--- a/scripts/calcurse-upgrade
+++ b/scripts/calcurse-upgrade
@@ -1,5 +1,7 @@
#!/bin/sh
+set -e
+
CONFFILE=$HOME/.calcurse/conf
if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
@@ -35,8 +37,8 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
-e 's/^output_datefmt=/format.outputdate=/' \
-e 's/^input_datefmt=/format.inputdate=/' \
-e 's/^notify-daemon_enable=/daemon.enable=/' \
- -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ -e 's/^notify-daemon_log=/daemon.log=/' "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
if grep -q -e '^[^#=][^#=]*$' -e '^[^#=][^#=]*#.*$' "$CONFFILE"; then
sed -e '/^general.autosave=/{N;s/\n//}' \
@@ -60,8 +62,8 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
-e '/^format.outputdate=/{N;s/\n//}' \
-e '/^format.inputdate=/{N;s/\n//}' \
-e '/^daemon.enable=/{N;s/\n//}' \
- -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
fi
awk '
@@ -70,7 +72,7 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \
{ $2 = ($2 == "yes") ? "no" : "yes" }
$1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" }
{ print }
- ' < "$CONFFILE" > "$tmpfile" || exit 1
- mv "$tmpfile" "$CONFFILE" || exit 1
+ ' < "$CONFFILE" > "$tmpfile"
+ mv "$tmpfile" "$CONFFILE"
fi