deepin15-ubuntuenv/gx-env-init

21 lines
648 B
Bash
Executable File

#!/bin/bash
chrootEnvPath=/opt/new-system-env
if [[ ! -d $chrootEnvPath ]]; then
echo Chroot 环境不存在,请部署环境后再试
exit 1
fi
echo aa > /tmp/env-$USER.txt
if [[ ! -f $chrootEnvPath/tmp/env-$USER.txt ]]; then
echo 未挂载目录,立即挂载
pkexec env `gx-env-show-env-list` gx-env-mount-root
fi
#user=`whoami`
if [[ ! -f $chrootEnvPath/user/$USER ]]; then
gx-env-adduser-root
if [[ $? != 0 ]]; then
echo Create User Error!
exit 1
fi
pkexec env `gx-env-show-env-list` mkdir $chrootEnvPath/user/ -p #$USER
pkexec env `gx-env-show-env-list` touch $chrootEnvPath/user/$USER
fi