From fc6d2ee7f7b496555d7519841b01685d5f8f4d33 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Wed, 10 Apr 2024 09:42:29 +0400 Subject: [PATCH] Do not set userspec if no such option passed (also fix for busybox) --- run.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/run.sh b/run.sh index ae72481..dc8a5cd 100755 --- a/run.sh +++ b/run.sh @@ -32,17 +32,19 @@ setup () { runcmd () { echo -e '-- \e[1;32mOK\e[0m -- running chroot' - userspec="--userspec=$1" + userspec="$1" chrdir="$2" shift 2 chrcmd=("$@") - chroot "$userspec" "$chrdir" "${chrcmd[@]}" + [[ "$userspec" != "" ]] && \ + chroot "--userspec=$userspec" "$chrdir" "${chrcmd[@]}" || \ + chroot "$chrdir" "${chrcmd[@]}" } main () { [[ "$1" == "--help" || "$1" == "" ]] && help && exit 0 - userspec="$(id -u):$(id -g)" + userspec="" while [[ "$1" == -* ]] do