diff options
author | piterpunk <piterpunk@slackware.com> | 2021-12-28 20:36:41 -0300 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2022-01-16 02:54:16 -0600 |
commit | 9d5166d13bce28fee36327c1e00a66fcacb77025 (patch) | |
tree | 4c8b4599cb5eb3512b04f3b34f386929584e94cb /files | |
parent | f8dfb7722fe8f1b190450b2c9f83d16df8fa5fcb (diff) | |
download | slackpkg-9d5166d13bce28fee36327c1e00a66fcacb77025.tar.xz |
Unattended usage improvements
- When in batch mode, don't wait for <enter> after kernel upgrade,
so Slackpkg will not wait forever.
- Also in batch mode, allow to set a default action about what to
do with .new config files
Diffstat (limited to 'files')
-rw-r--r-- | files/post-functions.conf-sample | 7 | ||||
-rw-r--r-- | files/post-functions.sh | 13 |
2 files changed, 16 insertions, 4 deletions
diff --git a/files/post-functions.conf-sample b/files/post-functions.conf-sample index 1cbe04a..79b5b1b 100644 --- a/files/post-functions.conf-sample +++ b/files/post-functions.conf-sample @@ -1,4 +1,4 @@ -# You can list here the .new files and the default action +# You can list here the .new files and the default action # to do for each file. The list format is: # # /full/path/of/dot/new/file.new:action @@ -9,6 +9,11 @@ # R to Remove the new file # K to Keep the current and the .new files # +# Using "default" as file name, you'll set the action for +# the .new files in batch mode. The action for each file +# takes precedence over the "default" one. +# # E.g: #/etc/slackpkg/mirrors.new:K #/etc/ntp.conf.new:R +#default:O diff --git a/files/post-functions.sh b/files/post-functions.sh index e003643..0339e00 100644 --- a/files/post-functions.sh +++ b/files/post-functions.sh @@ -152,6 +152,7 @@ looknew() { -name "*.new" \ ${ONLY_NEW_DOTNEW} \ -not -name "rc.inet1.conf.new" \ + -not -name "rc.wireless.conf.new" \ -not -name "group.new" \ -not -name "passwd.new" \ -not -name "shadow.new" \ @@ -248,6 +249,9 @@ EOF answer if [ "${BATCH}" = "on" ] && [ -n "${NEWCONFIG}" ]; then ANSWER=P + + # This allows to have a default behaviour for all .new files in batch mode. + DEF_AUTOANSWER="$(sed -ne 's#^default:\([ORK]\)#\1#p' $NEWCONFIG 2>/dev/null)" fi case $ANSWER in K|k) @@ -277,7 +281,7 @@ EOF echo $ANSWER else if [ "${BATCH}" = "on" ]; then - ANSWER=K + ANSWER=${DEF_AUTOANSWER:-K} echo $ANSWER else read ANSWER @@ -340,7 +344,10 @@ Your kernel image was updated, and lilo does not appear to be used on your system. You may need to adjust your boot manager (like GRUB) to boot the appropriate kernel (after generating an initrd if required)." fi - echo -e "Press the \"Enter\" key to continue...\n " - read _junk + + if [ "${BATCH}" != "on" ]; then + echo -e "Press the \"Enter\" key to continue...\n " + read _junk + fi fi } |