Compare commits

..

2 commits

Author SHA1 Message Date
Geoffrey Frogeye 6e868950a9 Merge branch 'master' of frogit:geoffrey/dotfiles 2017-03-27 10:04:08 +02:00
Geoffrey Frogeye b7b5cf178c Yay, commit 2017-03-27 10:03:44 +02:00
3 changed files with 50 additions and 9 deletions

View file

@ -15,27 +15,27 @@ function prompt { # text
} }
# Don't ask for things that are already there # Don't ask for things that are already there
local TERMUX=0 TERMUX=0
if [ -d /data/data/com.termux/files ]; then if [ -d /data/data/com.termux/files ]; then
local TERMUX=1 TERMUX=1
local GUI=0 GUI=0
fi fi
if which i3 &> /dev/null; then if which i3 &> /dev/null; then
local GUI=1 GUI=1
fi fi
if [ -z $ADMIN ]; then if [ -z $ADMIN ]; then
prompt "Are you a superuser on this machine?" prompt "Are you a superuser on this machine?"
local ADMIN=$? ADMIN=$?
fi fi
if [ -z $GUI ]; then if [ -z $GUI ]; then
prompt "Do you want a X environment on this machine?" prompt "Do you want a X environment on this machine?"
local GUI=$? GUI=$?
fi fi
if [ -z $EXTRA ]; then if [ -z $EXTRA ]; then
prompt "Do you want not-so-needed software on this machine?" prompt "Do you want not-so-needed software on this machine?"
local EXTRA=$? EXTRA=$?
fi fi
# TODO Verify if the package exists before installing it # 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 # Finding out if it's already installed or not
STATUS=$(mktemp) STATUS=$(mktemp)
LANG=C dpkg-query --status $1 &> $STATUS LANG=C dpkg-query --status $1 &> $STATUS
local installed=0 installed=0
if [ $? == 0 ]; then if [ $? == 0 ]; then
cat $STATUS | grep '^Status:' | grep ' installed' --quiet cat $STATUS | grep '^Status:' | grep ' installed' --quiet
if [ $? == 0 ]; then if [ $? == 0 ]; then
@ -217,7 +217,7 @@ vim +PluginInstall +qall
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev inst python-dev python3-dev
fi fi
local YCM_ARGS="" YCM_ARGS=""
if [ $TERMUX != 1 ]; then if [ $TERMUX != 1 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer" YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi fi

41
scripts/install-termux Executable file
View file

@ -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