Add argument for alternative config file#53
Conversation
|
Hi, What is your use case for this feature? |
|
I use it in combination with a pacman hook to take a btrfs snapshot before updating the kernel, and generating a unified kernel image with the old kernel and setting the command line to point to the snapshot, then after updating the kernel then sbupdate is run with the normal config for the new kernel |
andreyv
left a comment
There was a problem hiding this comment.
Note that you can use optional environment variables in the main config like this:
CMDLINE_DEFAULT="rw something root=${MY_SPECIAL_ROOT:-default_root}"If you define MY_SPECIAL_ROOT prior to running sbupdate, then it is substituted, otherwise default_root is substituted.
But the proposed changes are fine too, if you want to proceed with them.
| case "${opt}" in | ||
| k) HOOK=1 ;; | ||
| r) REMOVE=1 ;; | ||
| c) CONFFILE=${OPTARG} ;; |
| shopt -s extglob | ||
|
|
||
| readonly CONFFILE="/etc/sbupdate.conf" | ||
| CONFFILE="/etc/sbupdate.conf" |
There was a problem hiding this comment.
As this becomes a command-line option, it should be moved to parse_args.
| c) CONFFILE=${OPTARG} ;; | ||
| ?) exit 1 ;; | ||
| esac | ||
| done |
There was a problem hiding this comment.
CONFFILE should be made readonly again below this line.
Makes it possible to specify what config file to use at the command line.