Last active
December 13, 2017 00:05
-
-
Save BrainBacon/ed3f28244d25fcc240278fbde9234698 to your computer and use it in GitHub Desktop.
Termux-Ubuntu-i386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/data/data/com.termux/files/usr/bin/bash | |
# input validator and help | |
# DOCKERIMAGE=https://dl.project.org/pub/fedora/linux/releases/26/Docker/x86_64/images/Fedora-Docker-Base-26-1.5.x86_64.tar.xz | |
DOCKERIMAGE=https://partner-images.canonical.com/core/xenial/current/ubuntu-xenial-core-cloudimg-i386-root.tar.gz | |
# install necessary packages | |
apt update && apt install proot tar -y | |
# get the docker image | |
mkdir ~/ubuntu | |
cd ~/ubuntu | |
/data/data/com.termux/files/usr/bin/wget $DOCKERIMAGE -O ubuntu.tar.xz | |
# extract the Docker image | |
/data/data/com.termux/files/usr/bin/tar xvf ubuntu.tar.xz --strip-components=1 --exclude json --exclude VERSION | |
# extract the rootfs | |
/data/data/com.termux/files/usr/bin/tar xpf layer.tar | |
# cleanup | |
chmod +w . | |
rm layer.tar | |
rm ubuntu.tar.xz | |
# fix DNS | |
echo "nameserver 8.8.8.8" > ~/ubuntu/etc/resolv.conf | |
# make a shortcut | |
cat > /data/data/com.termux/files/usr/bin/startubuntu <<- EOM | |
#!/data/data/com.termux/files/usr/bin/bash | |
proot --link2symlink -0 -r ~/ubuntu -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b $HOME -w $HOME /bin/env -i HOME=/root TERM="$TERM" PS1='[termux@ubuntu \W]\$ ' LANG=$LANG PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login | |
EOM | |
chmod +x /data/data/com.termux/files/usr/bin/startubuntu | |
# all done | |
echo "All done! Start Ubuntu with 'startubuntu'. Gets update with regular 'apt-get update'. " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run the following in Termux:
Adapted from https://nmilosev.svbtle.com/termuxfedora-install-fedora-on-your-phone-with-termux