-
Notifications
You must be signed in to change notification settings - Fork 87
/
debian_on_termux_10.sh
48 lines (45 loc) · 1.1 KB
/
debian_on_termux_10.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
#!/data/data/com.termux/files/usr/bin/sh
# oldstable, stable, testing, unstable
BRANCH=testing
# base(258M), minbase(217M), buildd, fakechroot
VAR=minbase
# list_close_debian_mirrors.sh
REPO=http://ftp.debian.org/debian/
set -e
trap '[ $? -eq 0 ] && exit 0 || (echo; echo "termux-info:"; termux-info)' EXIT
if [ ! -d ~/debian-$BRANCH ] ; then
ARCH=$(uname -m)
case $ARCH in
aarch64) ARCH=arm64 ;;
x86_64) ARCH=amd64 ;;
i686) ARCH=i386 ;;
armv7l) ARCH=armhf ;;
armv8l) apt-get -qq install getconf; if [ $(getconf LONG_BIT) -eq 64 ]; then ARCH=arm64; else ARCH=armhf; fi ;;
*) echo "Unsupported architecture $ARCH"; exit ;;
esac
apt-get -qq update
apt-get -qq dist-upgrade
apt-get -qq install debootstrap proot wget
debootstrap \
--variant=$VAR \
--exclude=systemd \
--arch=$ARCH \
$BRANCH \
~/debian-$BRANCH \
$REPO
fi
unset LD_PRELOAD
proot \
-0 \
--link2symlink \
-r ~/debian-$BRANCH \
-w /root \
-b /dev/ \
-b /sys/ \
-b /proc/ \
-b /data/data/com.termux/files/home \
/usr/bin/env -i \
HOME=/root \
TERM="xterm-256color" \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login