diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-06-01 12:27:06 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-06-01 15:50:57 +0200 |
commit | 0d50e4539f860c9605300cd71b77f593dac2bdce (patch) | |
tree | 9f88a617d26f04faf91bc54f478aef1240586804 | |
parent | 6e490e979cf5cbb107b651010e2ddd984dcdcc5c (diff) | |
download | calcurse-0d50e4539f860c9605300cd71b77f593dac2bdce.tar.gz calcurse-0d50e4539f860c9605300cd71b77f593dac2bdce.zip |
scripts/calcurse-upgrade.sh: Fix POSIX compatibility
* Split sed(1) one-liners into multiple lines. POSIX sed(1) doesn't
allow separating functions by semicolons.
* Escape a newline in the awk(1) script. POSIX awk(1) only allows
non-escaped line breaks in specific contexts.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | scripts/calcurse-upgrade.sh | 113 |
1 files changed, 90 insertions, 23 deletions
diff --git a/scripts/calcurse-upgrade.sh b/scripts/calcurse-upgrade.sh index 20f4875..5c7aaea 100644 --- a/scripts/calcurse-upgrade.sh +++ b/scripts/calcurse-upgrade.sh @@ -56,28 +56,95 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \ mv "$tmpfile" "$CONFFILE" if grep -q -e '^[^#=][^#=]*$' -e '^[^#=][^#=]*#.*$' "$CONFFILE"; then - sed -e '/^general.autosave=/{N;s/\n//}' \ - -e '/^general.autogc=/{N;s/\n//}' \ - -e '/^general.periodicsave=/{N;s/\n//}' \ - -e '/^general.confirmquit=/{N;s/\n//}' \ - -e '/^general.confirmdelete=/{N;s/\n//}' \ - -e '/^general.systemdialogs=/{N;s/\n//}' \ - -e '/^general.progressbar=/{N;s/\n//}' \ - -e '/^appearance.calendarview=/{N;s/\n//}' \ - -e '/^general.firstdayofweek=/{N;s/\n//}' \ - -e '/^appearance.theme=/{N;s/\n//}' \ - -e '/^appearance.layout=/{N;s/\n//}' \ - -e '/^appearance.sidebarwidth=/{N;s/\n//}' \ - -e '/^appearance.notifybar=/{N;s/\n//}' \ - -e '/^format.notifydate=/{N;s/\n//}' \ - -e '/^format.notifytime=/{N;s/\n//}' \ - -e '/^notification.warning=/{N;s/\n//}' \ - -e '/^notification.command=/{N;s/\n//}' \ - -e '/^notification.notifyall=/{N;s/\n//}' \ - -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" + sed ' + /^general.autosave=/{ + N + s/\n// + } + /^general.autogc=/{ + N + s/\n// + } + /^general.periodicsave=/{ + N + s/\n// + } + /^general.confirmquit=/{ + N + s/\n// + } + /^general.confirmdelete=/{ + N + s/\n// + } + /^general.systemdialogs=/{ + N + s/\n// + } + /^general.progressbar=/{ + N + s/\n// + } + /^appearance.calendarview=/{ + N + s/\n// + } + /^general.firstdayofweek=/{ + N + s/\n// + } + /^appearance.theme=/{ + N + s/\n// + } + /^appearance.layout=/{ + N + s/\n// + } + /^appearance.sidebarwidth=/{ + N + s/\n// + } + /^appearance.notifybar=/{ + N + s/\n// + } + /^format.notifydate=/{ + N + s/\n// + } + /^format.notifytime=/{ + N + s/\n// + } + /^notification.warning=/{ + N + s/\n// + } + /^notification.command=/{ + N + s/\n// + } + /^notification.notifyall=/{ + N + s/\n// + } + /^format.outputdate=/{ + N + s/\n// + } + /^format.inputdate=/{ + N + s/\n// + } + /^daemon.enable=/{ + N + s/\n// + } + /^daemon.log=/{ + N + s/\n// + }' "$CONFFILE" > "$tmpfile" mv "$tmpfile" "$CONFFILE" fi @@ -86,7 +153,7 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \ $1 == "general.systemdialogs" || $1 == "general.progressbar" \ { $2 = ($2 == "yes") ? "no" : "yes" } $1 == "general.firstdayofweek" { $2 = ($2 == "yes") ? "monday" : "sunday" } - $1 == "appearance.calendarview" { $2 = ($2 == 0) ? "monthly" : + $1 == "appearance.calendarview" { $2 = ($2 == 0) ? "monthly" : \ ($2 == 1) ? "weekly" : $2 } { print } ' < "$CONFFILE" > "$tmpfile" |