Do not set userspec if no such option passed (also fix for busybox)
This commit is contained in:
parent
c2d852bfb0
commit
fc6d2ee7f7
1 changed files with 5 additions and 3 deletions
8
run.sh
8
run.sh
|
@ -32,17 +32,19 @@ setup () {
|
||||||
|
|
||||||
runcmd () {
|
runcmd () {
|
||||||
echo -e '-- \e[1;32mOK\e[0m -- running chroot'
|
echo -e '-- \e[1;32mOK\e[0m -- running chroot'
|
||||||
userspec="--userspec=$1"
|
userspec="$1"
|
||||||
chrdir="$2"
|
chrdir="$2"
|
||||||
shift 2
|
shift 2
|
||||||
chrcmd=("$@")
|
chrcmd=("$@")
|
||||||
chroot "$userspec" "$chrdir" "${chrcmd[@]}"
|
[[ "$userspec" != "" ]] && \
|
||||||
|
chroot "--userspec=$userspec" "$chrdir" "${chrcmd[@]}" || \
|
||||||
|
chroot "$chrdir" "${chrcmd[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main () {
|
main () {
|
||||||
[[ "$1" == "--help" || "$1" == "" ]] && help && exit 0
|
[[ "$1" == "--help" || "$1" == "" ]] && help && exit 0
|
||||||
|
|
||||||
userspec="$(id -u):$(id -g)"
|
userspec=""
|
||||||
|
|
||||||
while [[ "$1" == -* ]]
|
while [[ "$1" == -* ]]
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in a new issue