修复:带括号的参数解析失效

This commit is contained in:
2023-09-04 16:39:50 +08:00
parent 207c50b895
commit 2eec8b7d99
4 changed files with 41 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
Package: cn.flamescion.bookworm-compatibility-mode
Version: 12.1.8
Version: 12.1.9
Section: misc
Priority: optional
Depends: bubblewrap

View File

@@ -48,14 +48,14 @@ bwrap --dev-bind $chrootEnvPath/ / \
--dev-bind /run /run \
--dev-bind-try /run/user/$uid/pulse /run/user/$uid/pulse \
--dev-bind / /host \
--bind-try /usr/share/themes /usr/local/share/themes \
--bind-try /usr/share/icons /usr/local/share/icons \
--bind-try /usr/share/fonts /usr/local/share/fonts \
--ro-bind /usr/share/themes /usr/local/share/themes \
--ro-bind /usr/share/icons /usr/local/share/icons \
--ro-bind /usr/share/fonts /usr/local/share/fonts \
--hostname bookworm-compatibility-mode \
--unshare-uts \
--dev-bind /etc/resolv.conf /etc/resolv.conf \
--dev-bind /home /home \
$@
bash -c "${container_command}"
}

View File

@@ -24,27 +24,24 @@ fi
fi
if [ "$1" = "" ];then
cmd=bash
else
# container_command=$*
cmd="$1"
shift
for arg in "$@"; do
if [[ $arg =~ \ ]]; then
arg=\'${arg//\'/\'\\\'\'}\'
fi
OPTIONS="${OPTIONS} ${arg}"
done
fi
non_root_user=$(who | awk '{print $1}' | head -n 1)
uid=$(id -u $non_root_user)
#### This part is for args pharm
if [ "$1" = "" ];then
container_command="bash"
else
container_command="$1"
shift
for arg in "$@"; do
arg="$(echo "${arg}x" | sed 's|'\''|'\'\\\\\'\''|g')"
arg="${arg%x}"
container_command="${container_command} '${arg}'"
done
fi
bwrap --dev-bind $chrootEnvPath/ / \
--setenv LANG "$LANG" \
--setenv LC_COLLATE "$LC_COLLATE" \
@@ -73,4 +70,4 @@ bwrap --dev-bind $chrootEnvPath/ / \
--unshare-uts \
--dev-bind /etc/resolv.conf /etc/resolv.conf \
--dev-bind /home /home \
bash -c "${cmd} ${OPTIONS}"
bash -c "${container_command}"

View File

@@ -12,6 +12,12 @@ PKGNAME=`basename $ppparent_dir`
export PACKAGE_NAME=$PKGNAME
chrootEnvPath=/opt/apps/$PKGNAME/files/bookworm-env
if [ "$(id -u)" = "0" ]; then
`dirname $chrootEnvPath`/bin/bookworm-run-root "$@"
exit
fi
if [ ! -e $chrootEnvPath/finish.flag ];then
if [ "$(id -u)" = "0" ]; then
@@ -22,27 +28,24 @@ fi
fi
if [ "$1" = "" ];then
cmd=bash
else
# container_command=$*
cmd="$1"
shift
for arg in "$@"; do
if [[ $arg =~ \ ]]; then
arg=\'${arg//\'/\'\\\'\'}\'
fi
OPTIONS="${OPTIONS} ${arg}"
done
fi
non_root_user=$(who | awk '{print $1}' | head -n 1)
uid=$(id -u $non_root_user)
#### This part is for args pharm
if [ "$1" = "" ];then
container_command="bash"
else
container_command="$1"
shift
for arg in "$@"; do
arg="$(echo "${arg}x" | sed 's|'\''|'\'\\\\\'\''|g')"
arg="${arg%x}"
container_command="${container_command} '${arg}'"
done
fi
bwrap --dev-bind $chrootEnvPath/ / \
--setenv LANG "$LANG" \
--setenv LC_COLLATE "$LC_COLLATE" \
@@ -71,7 +74,7 @@ bwrap --dev-bind $chrootEnvPath/ / \
--unshare-uts \
--dev-bind /etc/resolv.conf /etc/resolv.conf \
--dev-bind /home /home \
bash -c "${cmd} ${OPTIONS}"
bash -c "${container_command}"