-
Notifications
You must be signed in to change notification settings - Fork 20
Add argument for alternative config file #53
base: master
Are you sure you want to change the base?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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} ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${OPTARG}
should be quoted.
@@ -20,7 +20,7 @@ set -eu | |||
|
|||
shopt -s extglob | |||
|
|||
readonly CONFFILE="/etc/sbupdate.conf" | |||
CONFFILE="/etc/sbupdate.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this becomes a command-line option, it should be moved to parse_args
.
case "${opt}" in | ||
k) HOOK=1 ;; | ||
r) REMOVE=1 ;; | ||
c) CONFFILE=${OPTARG} ;; | ||
?) exit 1 ;; | ||
esac | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFFILE
should be made readonly
again below this line.
Makes it possible to specify what config file to use at the command line.