From 15c554ee90f2f6896a49ada30f4d84301d39b472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0koudlil?= Date: Wed, 27 Apr 2022 11:16:15 +0200 Subject: [PATCH] Added untar command to extract root filesystem tarball uploaded by rsync-nfsroot --- server/novaboot-shell | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/novaboot-shell b/server/novaboot-shell index 7666917..a99be80 100755 --- a/server/novaboot-shell +++ b/server/novaboot-shell @@ -199,6 +199,18 @@ run_subcommand() { cd "$HOME/nfsroot/${NB_USER:?}" shift exec rsync "$@";; + "untar "*) + # untar command is used to extract root filesystem tarball. + mkdir -p "$HOME/nfsroot/${NB_USER:?}" + cd "$HOME/nfsroot/${NB_USER:?}" + if ! [ $# -eq 2 -a "$2" -ef $(basename "$2") ]; then + die "Unexpected untar invocation: $*" + fi + # remove the old contents + rm -rf root + mkdir root + + exec tar -xvf "$2" -C root;; "on") power on exit;; @@ -251,7 +263,7 @@ main() { # to the console. "The same user" means that we were executed by # the same sshd process that has the lock. This is ensured by # using SSH connection sharing on client side. - reset | rsync | rsync-nfsroot | on | off) + reset | rsync | rsync-nfsroot | untar | on | off) ALLOWED_PPID=$(cat $RUN_DIR/ppid 2>/dev/null || :) if [ "$PPID" -eq "${ALLOWED_PPID:-0}" ]; then run=unlocked; else run=locked; fi $run $0 "$@";;