mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
cli: add support for --reset-volumes on container upgrade
The weird `if env | grep -q 'reset-volumes'` construct is due to Klish not sanitizing names before constructing variables, which leads to env variables with '-' in them, not allowed in POSIX sh. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -179,8 +179,14 @@
|
||||
|
||||
<COMMAND name="upgrade" help="Upgrade image of a container (writable layer is lost!)">
|
||||
<PARAM name="name" ptype="/CONTAINERSa" help="Container name" />
|
||||
<SWITCH name="optional" min="0" max="1">
|
||||
<COMMAND name="reset-volumes" help="Delete named volumes, re-initialize from new image (all config lost!)" />
|
||||
</SWITCH>
|
||||
<ACTION sym="script" out="tty" interrupt="true">
|
||||
doas container upgrade $KLISH_PARAM_name
|
||||
if env | grep -q 'reset-volumes' >/dev/null; then
|
||||
opt="-R"
|
||||
fi
|
||||
doas container $opt upgrade $KLISH_PARAM_name
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
</COMMAND>
|
||||
|
||||
Reference in New Issue
Block a user