Skip to content

Commit

Permalink
Added untar command to extract root filesystem tarball uploaded by rs…
Browse files Browse the repository at this point in the history
…ync-nfsroot
  • Loading branch information
skoudmar committed Apr 28, 2022
1 parent 56effa4 commit 15c554e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion server/novaboot-shell
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand Down Expand Up @@ -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 "$@";;
Expand Down

0 comments on commit 15c554e

Please sign in to comment.