first commit
This commit is contained in:
commit
42c7d2aa17
25
init.sh
Executable file
25
init.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
chrootEnvPath=/opt/new-system-env
|
||||
if [[ ! -f /usr/bin/pardus-chroot ]]; then
|
||||
echo 请安装 pardus-chroot 后再试
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d $chrootEnvPath ]]; then
|
||||
echo Chroot 环境不存在,请部署环境后再试
|
||||
exit 1
|
||||
fi
|
||||
echo aa > /tmp/env-$USER.txt
|
||||
if [[ ! -f $chrootEnvPath/tmp/env-$USER.txt ]]; then
|
||||
echo 未挂载目录,立即挂载
|
||||
sudo ./load-env-root.sh
|
||||
fi
|
||||
#user=`whoami`
|
||||
if [[ ! -f $chrootEnvPath/user/$USER ]]; then
|
||||
./load-env-user-root.sh
|
||||
if [[ $? != 0 ]]; then
|
||||
echo Create User Error!
|
||||
exit 1
|
||||
fi
|
||||
sudo mkdir $chrootEnvPath/user/ -p #$USER
|
||||
sudo touch $chrootEnvPath/user/$USER
|
||||
fi
|
3
install-deb.sh
Executable file
3
install-deb.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
./run-root.sh apt update
|
||||
./run-root.sh apt install "$1"
|
12
load-env-root.sh
Executable file
12
load-env-root.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
if [[ `whoami` != "root" ]]; then
|
||||
echo 请使用 root 权限运行
|
||||
exit 1
|
||||
fi
|
||||
xhost +
|
||||
chrootEnvPath=/opt/new-system-env
|
||||
pardus-chroot $chrootEnvPath
|
||||
rm $chrootEnvPath/etc/resolv.conf
|
||||
cp /etc/resolv.conf $chrootEnvPath/etc/resolv.conf
|
||||
mount --bind /home $chrootEnvPath/home
|
||||
mount --bind /root $chrootEnvPath/root
|
13
load-env-user-root.sh
Executable file
13
load-env-user-root.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
chrootEnvPath=/opt/new-system-env
|
||||
zenity --info --text=请输入需要设置的密码 --no-wrap
|
||||
firstPWD=`zenity --password`
|
||||
zenity --info --text=请再输入一次相同的密码 --no-wrap
|
||||
secondPWD=`zenity --password`
|
||||
if [[ $firstPWD != $secondPWD ]]; then
|
||||
zenity --error --text=密码不相同,无法继续 --no-wrap
|
||||
exit 1
|
||||
fi
|
||||
echo -e "$firstPWD\n$firstPWD\n\n\n\n\n\nY\n" | ./run-root.sh adduser `whoami`
|
||||
./run-root.sh bash -c "echo $USER >> /etc/sudo"
|
2
run-filemanager.sh
Executable file
2
run-filemanager.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
./run.sh dolphin
|
10
run-root.sh
Executable file
10
run-root.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
chrootEnvPath=/opt/new-system-env
|
||||
#if [[ `whoami` != "root" ]]; then
|
||||
# echo 请使用 root 权限运行
|
||||
# exit 1
|
||||
#fi
|
||||
command="$@"
|
||||
#echo $command
|
||||
sudo chroot $chrootEnvPath "$@"
|
||||
#echo $@
|
2
run-terminal.sh
Executable file
2
run-terminal.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
./run.sh xfce4-terminal
|
10
run.sh
Executable file
10
run.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
chrootEnvPath=/opt/new-system-env
|
||||
#if [[ `whoami` != "root" ]]; then
|
||||
# echo 请使用 root 权限运行
|
||||
# exit 1
|
||||
#fi
|
||||
command="$@"
|
||||
#echo $command
|
||||
sudo chroot $chrootEnvPath sudo -u $USER bash -c "$command"
|
||||
#echo $@
|
Loading…
x
Reference in New Issue
Block a user