Skip to content

Instantly share code, notes, and snippets.

@trufae
Created April 17, 2017 09:45
Show Gist options
  • Select an option

  • Save trufae/1b2f649e3c9fa72f964bfe4aeebd535c to your computer and use it in GitHub Desktop.

Select an option

Save trufae/1b2f649e3c9fa72f964bfe4aeebd535c to your computer and use it in GitHub Desktop.
Termux support for SailfishOS (tested on Xiaomi/Lineage based distro)
#!/bin/sh
R=/data/data/com.termux/files/usr
A=`uname -m`
echo "> Termux for SailfishOS..."
if [ ! -f bootstrap-$A.zip ]; then
echo "> Downloading Termux bootstrap for $A..."
curl -o bootstrap-$A.zip https://termux.net/bootstrap/bootstrap-$A.zip
fi
echo "> Using prefix $R"
echo "> Unzipping bootstrap-$A ..."
rm -rf $R
unzip bootstrap-$A -d $R > /dev/null
chmod +x $R/bin/*
cd $R
echo "> Creating symlinks..."
for f in `cat SYMLINKS.txt | awk -F '←' '{print $1","$2}'` ; do
a=`echo $f |cut -d , -f 1`
b=`echo $f |cut -d , -f 2`
c=`basename $b`
d=`dirname $b`
(
mkdir -p $d
cd $d
printf "> ln -fs $a $c\r"
ln -fs $a $c
)
done
chmod +x $R/lib/apt/methods/*
echo
echo "Termux for SailfishOS is ready. Restart your shell and run 'apt update'."
echo
P=/etc/profile.d/termux.sh
:> $P
echo "export ANDROID_ROOT=/" >> $P
echo "export ANDROID_DATA=/data" >> $P
echo "export PATH=$R/bin:$R/usr/bin:'$PATH'" >> $P
echo "export LD_LIBRARY_PATH=$R/lib:$R/usr/lib" >> $P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment