diff options
author | Thomas Haller <thaller@redhat.com> | 2023-01-05 08:55:25 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-01-05 08:59:10 +0100 |
commit | ae7e7bf3d301e4c2703abe3075e7fcf34efd5d13 (patch) | |
tree | 5228354a67c275be3b685ae9624ac184607c8977 | |
parent | 897a96da7b3aa9218be499ef6ad074790e9f2101 (diff) | |
download | NetworkManager-ae7e7bf3d301e4c2703abe3075e7fcf34efd5d13.tar.gz |
contrib: add "reexec" step to "nm-in-container.sh"
Just a shortcut for reset and exec.
-rwxr-xr-x | contrib/scripts/nm-in-container.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/scripts/nm-in-container.sh b/contrib/scripts/nm-in-container.sh index f2c34810a7..d72046f32d 100755 --- a/contrib/scripts/nm-in-container.sh +++ b/contrib/scripts/nm-in-container.sh @@ -56,7 +56,7 @@ EXEC_ENV=() usage() { cat <<EOF -$0: build|run|exec|stop|reset|clean|journal [--no-cleanup] [--stop] [-- EXTRA_ARGS] +$0: build|run|exec|stop|reset|reexec|clean|journal [--no-cleanup] [--stop] [-- EXTRA_ARGS] EOF echo awk '/^####*$/{ if(on) exit; on=1} { if (on) { if (on==2) print(substr($0,3)); on=2; } }' "$BASH_SOURCE" @@ -576,6 +576,11 @@ do_exec() { fi } +do_reexec() { + do_reset + do_exec "$@" +} + do_journal() { EXEC_ENV+=( "SYSTEMD_COLORS=0" ) do_exec "journalctl" --no-pager "$@" @@ -604,7 +609,7 @@ for (( i=1 ; i<="$#" ; )) ; do j) CMD=journal ;; - build|run|exec|stop|reset|clean|journal) + build|run|exec|stop|reset|reexec|clean|journal) CMD=$c ;; --) @@ -631,8 +636,8 @@ done test "$UID" != 0 || die "cannot run as root" -if test "$CMD" != exec -a "$CMD" != journal -a "${#EXTRA_ARGS[@]}" != 0 ; then - die "Extra arguments are only allowed with exec command" +if test "$CMD" != exec -a "$CMD" != journal -a "$CMD" != reexec -a "${#EXTRA_ARGS[@]}" != 0 ; then + die "Extra arguments are only allowed with exec|journal|reexec command" fi ############################################################################### |