Skip to content

Instantly share code, notes, and snippets.

@hbt
Last active February 20, 2023 07:13
Show Gist options
  • Save hbt/dd9bfbd4a5efde75a24be73d888a96fa to your computer and use it in GitHub Desktop.
Save hbt/dd9bfbd4a5efde75a24be73d888a96fa to your computer and use it in GitHub Desktop.
# from: https://nmilosev.svbtle.com/termuxfedora-install-fedora-on-your-phone-with-termux
# install:
# - install termux
# - wget this gist
# - sh
apt update && apt install wget -y && /data/data/com.termux/files/usr/bin/wget https://raw.githubusercontent.com/nmilosev/termux-fedora/master/termux-fedora.sh && sh termux-fedora.sh
sh termux-fedora.sh f26_arm64
startfedora
exit
# review stuff below
# install necessary packages
apt install proot tar -y
# get the docker image
mkdir ~/fedora
cd ~/fedora
/data/data/com.termux/files/usr/bin/wget http://download.fedoraproject.org/pub/fedora/linux/releases/24/Docker/armhfp/images/Fedora-Docker-Base-24-1.2.armhfp.tar.xz
# extract the Docker image
/data/data/com.termux/files/usr/bin/tar xvf Fedora-Docker-Base-24-1.2.armhfp.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 Fedora-Docker-Base-24-1.2.armhfp.tar.xz
# fix DNS
echo "nameserver 8.8.8.8" > ~/fedora/etc/resolv.conf
# make a shortcut
cat > /data/data/com.termux/files/usr/bin/fedora <<- EOM
#!/data/data/com.termux/files/usr/bin/sh
proot -0 -r ~/fedora -b /dev/ -b /sys/ -b /proc/ -b $HOME /bin/env -i HOME=/root TERM="$TERM" PS1='[root@f24 \W]\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/bin /bin/bash --login
EOM
chmod +x /data/data/com.termux/files/usr/bin/fedora
# all done
echo "All done!, start Fedora with 'fedora'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment