From 2931330ad4ee3f69b35aab7f9ccbb87943d112ff Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 9 Apr 2024 17:49:52 +0400 Subject: [PATCH] Allow command args --- run.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/run.sh b/run.sh index 526dd6a..0b04297 100755 --- a/run.sh +++ b/run.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash help () { - echo 'dchr-run ' + echo 'dchr-run [command]' echo 'https://dchr.dc09.ru' } @@ -28,19 +28,22 @@ setup () { runcmd () { echo -e '-- \e[1;32mOK\e[0m -- running chroot' - chroot "$1" "$2" + chrdir="$1" + shift + chrcmd=("$@") + chroot "$chrdir" "${chrcmd[@]}" } main () { [[ "$1" == "--help" || "$1" == "" ]] && help && exit 0 chrdir=$(readlink -f "$1") - chrcmd="${2:-/bin/bash}" + shift trap "clean \"$chrdir\"" EXIT setup "$chrdir" - runcmd "$chrdir" "$chrcmd" + runcmd "$chrdir" "$@" exit $? }