1
1
#! /data/data/com.termux/files/usr/bin/bash
2
- pkg install wget -y
3
- folder=ubuntu-fs
4
- dlink=" https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/APT"
5
- if [ -d " $folder " ]; then
6
- first=1
7
- echo " skipping downloading"
8
- fi
9
- tarball=" ubuntu-rootfs.tar.xz"
10
- if [ " $first " != 1 ]; then
11
- if [ ! -f $tarball ]; then
12
- echo " Download Rootfs, this may take a while base on your internet speed."
13
- case ` dpkg --print-architecture` in
14
- aarch64)
15
- archurl=" arm64" ;;
16
- arm)
17
- archurl=" armhf" ;;
18
- amd64)
19
- archurl=" amd64" ;;
20
- x86_64)
21
- archurl=" amd64" ;;
22
- i* 86)
23
- archurl=" i386" ;;
24
- x86)
25
- archurl=" i386" ;;
26
- * )
27
- echo " unknown architecture" ; exit 1 ;;
28
- esac
29
- wget " https://github.com/Techriz/AndronixOrigin/blob/master/Rootfs/Ubuntu/${archurl} /ubuntu-rootfs-${archurl} .tar.xz?raw=true" -O $tarball
2
+
3
+ # Variables
4
+ BLUE=" \e[34m" # Blue Color
5
+ GREEN=" \e[32m" # Red Color
6
+ NO_COLOR=" \e[39m" # No Color
7
+ isFsPresent=0 # Handles if the tarball is downloaded or skipped (overridden by -f)
8
+ distroName=" Ubuntu" # Name of the concerned distro
9
+ name=" ubuntu" # Name of the concerned distro
10
+ rootfsFolder=$name -fs # RootFS folder name
11
+ bindsFolder=$name -fs # Bind folder name
12
+ dlink=" https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/APT" # Download Link
13
+ tarball=" ${name} -rootfs.tar.xz"
14
+ folderSize=$( stat -c%s $rootfsFolder )
15
+
16
+ # Function used for sending updates to Andronix App
17
+ function sendUpdates() {
18
+ message=$( echo " $1 " | sed ' s/ /\\ /g' )
19
+ am broadcast --user 0 -a app.andronix.PROGRESS --es app.andronix.PROGRESS_STATUS " $message " > /dev/null
20
+ }
21
+
22
+ # Welcome
23
+ echo "
24
+ ___ __ _
25
+ / | ____ ____/ / _____ ____ ____ (_) _ __
26
+ / /| | / __ \ / __ / / ___/ / __ \ / __ \ / / | |/_/
27
+ / ___ | / / / // /_/ / / / / /_/ / / / / / / / _> <
28
+ /_/ |_|/_/ /_/ \__,_/ /_/ \____/ /_/ /_/ /_/ /_/|_|
29
+ "
30
+
31
+ echo -e " \n${BLUE} Welcome to the Andronix ${distroName} installer.${NO_COLOR} "
32
+ echo -e " Join Andronix ${BLUE} Discord${NO_COLOR} @ https://chat.andronix.app (giveaways too ;)"
33
+ echo -e " Read our ${BLUE} Documentation${NO_COLOR} @ https://docs.andronix.app \n\n"
34
+
35
+ sendUpdates " Script Detected"
36
+
37
+ sleep 1
38
+
39
+ # Getting the -f (force download flag)
40
+ while getopts " f" OPTION; do
41
+ # shellcheck disable=SC2220
42
+ case $OPTION in
43
+ f)
44
+ echo -e " \nForcing the download..."
45
+ rm -rf $rootfsFolder
46
+ rm -rf $bindsFolder
47
+ isFsPresent=0
48
+ ;;
49
+ esac
50
+ done
51
+
52
+ # Installing basic termux packages
53
+ pkg install wget -y
54
+
55
+ # Checking if the rootfsFolder is present
56
+ if [ -d " $rootfsFolder " ] && [ " $folderSize " -gt 6000 ]; then
57
+ isFsPresent=1
58
+ echo -e " \nRoot Files System already present. Skipping download..."
30
59
fi
31
- cur=` pwd`
32
- mkdir -p " $folder "
33
- cd " $folder "
34
- echo " Decompressing Rootfs, please be patient."
35
- proot --link2symlink tar -xJf ${cur} /${tarball} || :
36
- cd " $cur "
60
+
61
+ if [ " $isFsPresent " != 1 ]; then
62
+ if [ ! -f " $tarball " ]; then
63
+ echo -e " \nDownloading Rootfs for ${distroName} . Please be patient...\n\n"
64
+ case $( dpkg --print-architecture) in
65
+ aarch64)
66
+ arch=" arm64"
67
+ ;;
68
+ arm)
69
+ arch=" armhf"
70
+ ;;
71
+ amd64)
72
+ arch=" amd64"
73
+ ;;
74
+ x86_64)
75
+ arch=" amd64"
76
+ ;;
77
+ i* 86)
78
+ arch=" i386"
79
+ ;;
80
+ x86)
81
+ arch=" i386"
82
+ ;;
83
+ * )
84
+ echo " There was an issue identifying the architecture of your device!"
85
+ sendUpdates " Oops! Architecture error."
86
+ exit 1
87
+ ;;
88
+ esac
89
+ sendUpdates " Downloading the files..."
90
+ wget -q --show-progress --progress=bar " https://github.com/Techriz/AndronixOrigin/blob/master/Rootfs/${distroName} /${arch} /ubuntu-rootfs-${arch} .tar.xz?raw=true" -O $tarball
91
+ fi
92
+ currentDirectory=$( pwd)
93
+ mkdir -p " $rootfsFolder "
94
+ cd " $rootfsFolder "
95
+ sendUpdates " Decompressing the files..."
96
+ echo -e " \nDecompressing Rootfs. This can take a while. Please be patient."
97
+ proot --link2symlink tar -xJf " ${currentDirectory} " /${tarball} || :
98
+ cd " $currentDirectory "
37
99
fi
38
- mkdir -p ubuntu-binds
100
+
101
+ mkdir -p $bindsFolder
39
102
bin=start-ubuntu.sh
40
- echo " writing launch script"
41
- cat > $bin << - EOM
103
+ echo -e " \nWriting the launch script now! Just a few more steps! "
104
+ cat > $bin << -EOM
42
105
#!/bin/bash
43
106
cd \$ (dirname \$ 0)
44
107
## unset LD_PRELOAD in case termux-exec is installed
45
108
unset LD_PRELOAD
46
109
command="proot"
47
110
command+=" --link2symlink"
48
111
command+=" -0"
49
- command+=" -r $folder "
50
- if [ -n "\$ (ls -A ubuntu-binds )" ]; then
51
- for f in ubuntu-binds /* ;do
112
+ command+=" -r $rootfsFolder "
113
+ if [ -n "\$ (ls -A $bindsFolder )" ]; then
114
+ for f in $bindsFolder /* ;do
52
115
. \$ f
53
116
done
54
117
fi
@@ -57,7 +120,7 @@ command+=" -b /proc"
57
120
command+=" -b ubuntu-fs/root:/dev/shm"
58
121
## uncomment the following line to have access to the home directory of termux
59
122
#command+=" -b /data/data/com.termux/files/home:/root"
60
- ## uncomment the following line to mount /sdcard directly to /
123
+ ## uncomment the following line to mount /sdcard directly to /
61
124
#command+=" -b /sdcard"
62
125
command+=" -w /root"
63
126
command+=" /usr/bin/env -i"
@@ -74,20 +137,22 @@ else
74
137
fi
75
138
EOM
76
139
77
- echo " fixing shebang of $bin "
78
140
termux-fix-shebang $bin
79
- echo " making $bin executable"
80
141
chmod +x $bin
81
- echo " removing image for some space"
142
+ echo " Saving some space... "
82
143
rm $tarball
83
144
145
+ sendUpdates " Downloading Desktop Environment!"
146
+
147
+ wget -q --show-progress --progress=bar $dlink /XFCE4/xfce4_de.sh -O $rootfsFolder /root/xfce4_de.sh
148
+
84
149
# DE installation addition
85
150
86
- wget $dlink /XFCE4/xfce4_de.sh -O $folder /root/xfce4_de.sh
151
+ wget $dlink /XFCE4/xfce4_de.sh -O $rootfsFolder /root/xfce4_de.sh
87
152
clear
88
153
echo " Setting up the installation of XFCE VNC"
89
154
90
- echo " APT::Acquire::Retries \" 3\" ;" > $folder /etc/apt/apt.conf.d/80-retries # Setting APT retry count
155
+ echo " APT::Acquire::Retries \" 3\" ;" > $rootfsFolder /etc/apt/apt.conf.d/80-retries # Setting APT retry count
91
156
echo " #!/bin/bash
92
157
apt update -y && apt install sudo wget -y
93
158
clear
107
172
if [ ! -f /usr/bin/vncserver ]; then
108
173
apt install tigervnc-standalone-server -y
109
174
fi
110
- rm -rf ~/.bash_profile" >> ubuntu-fs/root/.bash_profile
175
+ rm -rf ~/.bash_profile" >> $rootfsFolder /root/.bash_profile
176
+
177
+ echo -e " \n\nYay! All done."
178
+ echo -e " \n${GREEN} This is the confirmation only regarding the actual distro. Tracking the installation of the Desktop Environment is beyond the present scope. Please contact us on ${BLUE} Discord${GREEN} if you face any issues.${NO_COLOR} \n"
179
+ echo " You will then asked to configure some distro specific things."
180
+ echo -e " \nProceeding to install the Desktop Environment...\n"
181
+
182
+ sendUpdates " Installation Success!"
183
+ sleep 4
111
184
112
185
bash $bin
0 commit comments