优化快捷方式生成方式

This commit is contained in:
gfdgd xi 2023-06-29 20:11:20 +08:00
parent 1310253f0f
commit 1f7d53bf4d
5 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,7 @@ fi
echo aa > /tmp/env-$USER.txt
if [[ ! -f $chrootEnvPath/tmp/env-$USER.txt ]]; then
echo 未挂载目录,立即挂载
pkexec env `printenv` gx-env-mount-root
pkexec env `gx-env-show-env-list` gx-env-mount-root
fi
#user=`whoami`
if [[ ! -f $chrootEnvPath/user/$USER ]]; then
@ -16,6 +16,6 @@ if [[ ! -f $chrootEnvPath/user/$USER ]]; then
echo Create User Error!
exit 1
fi
pkexec env `printenv` mkdir $chrootEnvPath/user/ -p #$USER
pkexec env `printenv` touch $chrootEnvPath/user/$USER
pkexec env `gx-env-show-env-list` mkdir $chrootEnvPath/user/ -p #$USER
pkexec env `gx-env-show-env-list` touch $chrootEnvPath/user/$USER
fi

View File

@ -21,6 +21,6 @@ if [[ ! -f $chrootEnvPath/tmp/env-$USER.txt ]]; then
fi
command="$@"
#echo $command
pkexec env `printenv` chroot $chrootEnvPath sudo -u $USER bash -c "$command"
pkexec env `gx-env-show-env-list` chroot $chrootEnvPath sudo -u $USER bash -c "$command"
#echo $@
#pkexec gx-env-load-desktop

View File

@ -7,20 +7,20 @@ chrootEnvPath=/opt/new-system-env
if [[ ! -f ~/.config/gx-env/chroot ]]; then
#if [[ `whoami` != root ]]; then
# if [[ ! -d $chrootEnvPath/home/$USER ]]; then
# pkexec env `printenv` gx-env-init
# pkexec env `gx-env-show-env-list` gx-env-init
# fi
#fi
pkexec env `printenv` bwrap --dev-bind / / --dev-bind $chrootEnvPath/etc /etc --dev-bind $chrootEnvPath/opt /opt --dev-bind $chrootEnvPath/usr /usr --dev-bind $chrootEnvPath/var /var --dev-bind $chrootEnvPath/bin /bin --dev-bind $chrootEnvPath/boot /boot --dev-bind $chrootEnvPath/lib /lib --dev-bind $chrootEnvPath/lib32 /lib32 --dev-bind $chrootEnvPath/lib64 /lib64 --dev-bind $chrootEnvPath/libx32 /libx32 --dev-bind $chrootEnvPath/gx-env /gx-env --dev-bind /etc/resolv.conf /etc/resolv.conf "$@"
pkexec env `gx-env-show-env-list` bwrap --dev-bind / / --dev-bind $chrootEnvPath/etc /etc --dev-bind $chrootEnvPath/opt /opt --dev-bind $chrootEnvPath/usr /usr --dev-bind $chrootEnvPath/var /var --dev-bind $chrootEnvPath/bin /bin --dev-bind $chrootEnvPath/boot /boot --dev-bind $chrootEnvPath/lib /lib --dev-bind $chrootEnvPath/lib32 /lib32 --dev-bind $chrootEnvPath/lib64 /lib64 --dev-bind $chrootEnvPath/libx32 /libx32 --dev-bind $chrootEnvPath/gx-env /gx-env --dev-bind /etc/resolv.conf /etc/resolv.conf "$@"
#pkexec gx-env-load-desktop
exit
fi
echo aa > /tmp/env-$USER.txt
if [[ ! -f $chrootEnvPath/tmp/env-$USER.txt ]]; then
echo 未挂载目录,立即挂载
pkexec env `printenv` gx-env-mount-root
pkexec env `gx-env-show-env-list` gx-env-mount-root
fi
command="$@"
#echo $command
pkexec env `printenv` chroot $chrootEnvPath "$@"
pkexec env `gx-env-show-env-list` chroot $chrootEnvPath "$@"
#pkexec gx-env-load-desktop
#echo $@

View File

@ -16,7 +16,7 @@ def Save():
os.mknod("{}/.config/gx-env/nosandbox".format(homePath))
if not allCommandAddNoSandbox.isChecked() and os.path.exists("{}/.config/gx-env/nosandbox".format(homePath)):
os.remove("{}/.config/gx-env/nosandbox".format(homePath))
os.system("pkexec env `printenv` gx-env-run")
os.system("pkexec env `gx-env-show-env-list` gx-env-run")
QtWidgets.QMessageBox.information(window, "提示", "设置完成!")
except:

5
gx-env-show-env-list Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env python3
import os
for i in os.environ:
print("'{}={}'".format(i, os.getenv(i)))