-
Notifications
You must be signed in to change notification settings - Fork 9
/
installInProotDistro.sh
executable file
·95 lines (75 loc) · 3.24 KB
/
installInProotDistro.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
#!/usr/bin/env bash
yes | rm /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/small -r
echo '##
## Plug-in for installing small
##
DISTRO_NAME="small https://github.com/stringmanolo/small"
# You can override a CPU architecture to let distribution
# be executed by QEMU (user-mode).
#
# You can specify the following values here:
#
# * aarch64: AArch64 (ARM64, 64bit ARM)
# * armv7l: ARM (32bit)
# * i686: x86 (32bit)
# * x86_64: x86 (64bit)
#
# Default value is set by proot-distro script and is equal
# to the CPU architecture of your device (uname -m).
#DISTRO_ARCH=$(uname -m)
# Returns download URL and SHA-256 of file in this format:
# SHA-256|FILE-NAME
get_download_url() {
local rootfs
local sha256
case "$DISTRO_ARCH" in
aarch64)
rootfs="https://github.com/termux/proot-distro/releases/download/v1.2-alpine-rootfs/alpine-minirootfs-3.13.1-aarch64.tar.gz"
sha256="0e8258cc599a86be428228dd5ea9217959f2c77873790bec645c05899f252c5e"
;;
armv7l|armv8l)
rootfs="https://github.com/termux/proot-distro/releases/download/v1.2-alpine-rootfs/alpine-minirootfs-3.13.1-armv7.tar.gz"
sha256="71bedb0810b656377192f4a239126f452a016d7a33e28f8ad8f46e9b0e7d8028"
;;
i686)
rootfs="https://github.com/termux/proot-distro/releases/download/v1.2-alpine-rootfs/alpine-minirootfs-3.13.1-x86.tar.gz"
sha256="6884df8f8e44d462a9723e412f0b76124019683d98afe448a8767dc5f5f3a7e0"
;;
x86_64)
rootfs="https://github.com/termux/proot-distro/releases/download/v1.2-alpine-rootfs/alpine-minirootfs-3.13.1-x86_64.tar.gz"
sha256="1ab0a7c05107c4504018be170d937c07e35283b7a3f153886c8c93162dfbf4af"
;;
esac
echo "${sha256}|${rootfs}"
}
# Define here additional steps which should be executed
# for configuration.
distro_setup() {
# Hint: $PWD is the distribution rootfs directory.
#echo "hello world" > ./etc/motd
# Run command within proot'"'"'ed environment with
# run_proot_cmd function.
# Uncomment this to run '"'"'apk upgrade'"'"' during installation.
#run_proot_cmd apk upgrade
:
}
' > /data/data/com.termux/files/usr/etc/proot-distro/small.sh
proot-distro remove small;
proot-distro install small;
yes | rm /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/small -r
cp smallFileSystem /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/small -r;
# SMALL_COMMAND IS CHECKED INSIDE SHELL TO DECIDE IF TO PRINT MOTD OR NOT
echo '#!/usr/bin/env bash
if [[ "$1" ]]; then
touch /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/small/tmp/.small_command_1;
proot-distro login small --isolated --fix-low-ports -- /bin/"$@"
rm /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/small/tmp/.small_command_1;
else
clear;
proot-distro login small --isolated --fix-low-ports
fi
' > "$HOME"/../usr/bin/small;
chmod +775 "$HOME"/../usr/bin/small;
echo 'System Ready:
$ small
'