diff --git a/scripts/install-prefs b/scripts/install-prefs index 123b404..1522b67 100755 --- a/scripts/install-prefs +++ b/scripts/install-prefs @@ -15,27 +15,27 @@ function prompt { # text } # Don't ask for things that are already there -local TERMUX=0 +TERMUX=0 if [ -d /data/data/com.termux/files ]; then - local TERMUX=1 - local GUI=0 + TERMUX=1 + GUI=0 fi if which i3 &> /dev/null; then - local GUI=1 + GUI=1 fi if [ -z $ADMIN ]; then prompt "Are you a superuser on this machine?" - local ADMIN=$? + ADMIN=$? fi if [ -z $GUI ]; then prompt "Do you want a X environment on this machine?" - local GUI=$? + GUI=$? fi if [ -z $EXTRA ]; then prompt "Do you want not-so-needed software on this machine?" - local EXTRA=$? + EXTRA=$? fi # TODO Verify if the package exists before installing it @@ -98,7 +98,7 @@ elif which dpkg &> /dev/null; then # Finding out if it's already installed or not STATUS=$(mktemp) LANG=C dpkg-query --status $1 &> $STATUS - local installed=0 + installed=0 if [ $? == 0 ]; then cat $STATUS | grep '^Status:' | grep ' installed' --quiet if [ $? == 0 ]; then @@ -217,7 +217,7 @@ vim +PluginInstall +qall if [ $DEBIAN == 1 || $TERMUX == 1 ]; then inst python-dev python3-dev fi -local YCM_ARGS="" +YCM_ARGS="" if [ $TERMUX != 1 ]; then YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer" fi diff --git a/scripts/install-termux b/scripts/install-termux new file mode 100755 index 0000000..51e3437 --- /dev/null +++ b/scripts/install-termux @@ -0,0 +1,41 @@ +#!/data/data/com.termux/files/usr/bin/env bash + +# Setups a Termux system the way I like it + +if [ ! -d /data/data/com.termux/files ]; then + echo "This is not a Termux system (or pacman isn't installed)" + return 1 +fi + +# Configuration +function prompt { # text + while true; do + read -p "$1 [yn] " yn + case $yn in + [Yy]* ) return 1;; + [Nn]* ) return 0;; + * ) echo "Please answer yes or no.";; + esac + done +} + +if [ -z $ROOT ]; then + prompt "Is this device rooted and BusyBox installed in /system/xbin/?" + ROOT=$? +fi + +# Update +apt update +apt upgrade + +# (needed for install-prefs) +apt install coreutils +apt install grep + +# Config +touch ~/.hushlogin + +if [ $ROOT == 1 ]; then + apt install tsu + echo '/system/xbin/mount -o remount,rw /; ln -s /data/data/com.termux/files/usr /usr; /system/xbin/mount -o remount,ro /' | tsu +fi diff --git a/.tern-config b/tern-config similarity index 100% rename from .tern-config rename to tern-config