-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdebian-xfce-mod.sh
207 lines (196 loc) · 4.89 KB
/
debian-xfce-mod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/data/data/com.termux/files/usr/bin/bash
before=""
after=""
usage() {
echo "Usage: $0 [--before <before_script>] [-b <before_script>] [--after <after_script>] [-a <after_script>]"
exit 1
}
while [[ $# -gt 0 ]]; do
case "$1" in
--before)
if [[ -n "$2" ]]; then
before="$2"
shift 2
else
echo "Error: --before requires an argument."
usage
fi
;;
-b)
if [[ -n "$2" ]]; then
before="$2"
shift 2
else
echo "Error: -b requires an argument."
usage
fi
;;
--after)
if [[ -n "$2" ]]; then
after="$2"
shift 2
else
echo "Error: --after requires an argument."
usage
fi
;;
-a)
if [[ -n "$2" ]]; then
after="$2"
shift 2
else
echo "Error: -a requires an argument."
usage
fi
;;
*)
echo "Unknown option: $1"
usage
;;
esac
done
pkg install wget -y
folder=debian-fs
dlink="https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/APT"
if [ -d "$folder" ]; then
first=1
echo "skipping downloading"
fi
tarball="debian-rootfs.tar.xz"
if [ "$first" != 1 ];then
if [ ! -f $tarball ]; then
echo "Download Rootfs, this may take a while base on your internet speed."
case `dpkg --print-architecture` in
aarch64)
archurl="arm64" ;;
arm)
archurl="armhf" ;;
amd64)
archurl="amd64" ;;
x86_64)
archurl="amd64" ;;
i*86)
archurl="i386" ;;
x86)
archurl="i386" ;;
*)
echo "unknown architecture"; exit 1 ;;
esac
wget "https://github.com/Techriz/AndronixOrigin/blob/master/Rootfs/Debian/${archurl}/debian-rootfs-${archurl}.tar.xz?raw=true" -O $tarball
fi
cur=`pwd`
mkdir -p "$folder"
cd "$folder"
echo "Decompressing Rootfs, please be patient."
proot --link2symlink tar -xJf ${cur}/${tarball}||:
cd "$cur"
fi
if [[ -n "$before" ]]; then
$before
fi
mkdir -p debian-binds
bin=start-debian.sh
echo "writing launch script"
cat > $bin <<- EOM
#!/bin/bash
cd \$(dirname \$0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r $folder"
if [ -n "\$(ls -A debian-binds)" ]; then
for f in debian-binds/* ;do
. \$f
done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b debian-fs/root:/dev/shm"
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
#command+=" -b /sdcard"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=\$TERM"
command+=" LANG=C.UTF-8"
command+=" /bin/bash --login"
com="\$@"
if [ -z "\$1" ];then
exec \$command
else
\$command -c "\$com"
fi
EOM
echo "fixing shebang of $bin"
termux-fix-shebang $bin
echo "making $bin executable"
chmod +x $bin
echo "removing image for some space"
rm $tarball
#DE installation addition
wget --tries=20 $dlink/XFCE4/xfce4_de.sh -O $folder/root/xfce4_de.sh
clear
echo "Setting up the installation of XFCE VNC"
echo "APT::Acquire::Retries \"3\";" > $folder/etc/apt/apt.conf.d/80-retries #Setting APT retry count
if [[ -n "$after" ]]; then
echo "#!/bin/bash
apt update --allow-releaseinfo-change -y && apt install wget sudo -y
clear
if [ ! -f /root/xfce4_de.sh ]; then
wget --tries=20 $dlink/XFCE4/xfce4_de.sh -O /root/xfce4_de.sh
bash ~/xfce4_de.sh
else
bash ~/xfce4_de.sh
fi
clear
if [ ! -f /usr/local/bin/vncserver-start ]; then
wget --tries=20 $dlink/XFCE4/vncserver-start -O /usr/local/bin/vncserver-start
wget --tries=20 $dlink/XFCE4/vncserver-stop -O /usr/local/bin/vncserver-stop
chmod +x /usr/local/bin/vncserver-stop
chmod +x /usr/local/bin/vncserver-start
fi
if [ ! -f /usr/bin/vncserver ]; then
apt install tigervnc-standalone-server -y
fi
clear
echo 'Installing Browser'
apt install firefox-esr -y
clear
echo ' Welcome to Andronix | Debian '
$after
" > $folder/root/.bash_profile
else
echo "#!/bin/bash
apt update --allow-releaseinfo-change -y && apt install wget sudo -y
clear
if [ ! -f /root/xfce4_de.sh ]; then
wget --tries=20 $dlink/XFCE4/xfce4_de.sh -O /root/xfce4_de.sh
bash ~/xfce4_de.sh
else
bash ~/xfce4_de.sh
fi
clear
if [ ! -f /usr/local/bin/vncserver-start ]; then
wget --tries=20 $dlink/XFCE4/vncserver-start -O /usr/local/bin/vncserver-start
wget --tries=20 $dlink/XFCE4/vncserver-stop -O /usr/local/bin/vncserver-stop
chmod +x /usr/local/bin/vncserver-stop
chmod +x /usr/local/bin/vncserver-start
fi
if [ ! -f /usr/bin/vncserver ]; then
apt install tigervnc-standalone-server -y
fi
clear
echo 'Installing Browser'
apt install firefox-esr -y
clear
echo ' Welcome to Andronix | Debian '
rm -rf ~/.bash_profile
exit
" > $folder/root/.bash_profile
fi
bash $bin