Last active
August 29, 2021 12:22
-
-
Save gottaloveit/9fa3cfa97f8fe689a96862d32824fc9f to your computer and use it in GitHub Desktop.
Script to setup my termux in Android.
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
#!/bin/bash | |
## run in termux by issuing | |
## curl -s -L https://bit.ly/2S8s4D0 | bash | |
## updated 1818 | |
BASE_PATH='/data/data/com.termux/files' | |
LOG_FILE='./setup_log.txt' | |
function cmmd() | |
{ | |
local run="$@" | |
"$@" | |
local status=$? | |
if (( status != 0 )); then | |
echo "NOT OK: ${run}" >> $LOG_FILE | |
fi | |
echo "OK: ${run}" >> $LOG_FILE | |
return $status | |
} | |
touch $LOG_FILE | |
echo 'start' >> $LOG_FILE | |
## upgrade | |
cmmd pkg upgrade -y | |
## install required packages | |
cmmd pkg install termux-api -y | |
cmmd pkg install python git curl wget vim -y | |
## install apps | |
cmmd pkg install nodejs php apache2 phpmyadmin -y | |
cmmd pkg install mariadb -y | |
## manually place php.ini | |
## so that we can run composer | |
cmmd wget https://raw.githubusercontent.com/php/php-src/master/php.ini-production | |
cmmd sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/g' ./php.ini-production | |
cmmd mv ./php.ini-production "$BASE_PATH/usr/lib/php.ini" | |
cmmd apachectl restart | |
## download and install composer | |
cmmd php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
cmmd php composer-setup.php --filename=composer --install-dir="$BASE_PATH/usr/bin" | |
cmmd php -r "unlink('composer-setup.php');" | |
## add global composer libraries | |
cmmd composer global require "laravel/installer" | |
## upgrade global npm | |
cmmd npm -g i npm | |
## add global node libraries | |
cmmd npm -g i @angular/cli | |
## set Android soft keyboard keys | |
cmmd mkdir ~/.termux | |
cmmd echo "extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]" > ~/.termux/termux.properties | |
cmmd termux-reload-settings | |
## add composer global vendor bin to path | |
cmmd echo 'PATH=$PATH:'"$BASE_PATH/home/.composer/vendor/bin" > ~/.bashrc | |
cmmd echo 'export PATH' >> ~/.bashrc | |
## set mariadb root password | |
cmmd $BASE_PATH/usr/etc/init.d/mysql start | |
cmmd mysql -u $(whoami) -e "use mysql;set password for 'root'@'localhost' = password('root');flush privileges;" | |
## finish | |
cmmd echo 'database root password set to root' | |
cmmd echo 'exit termux and restart for path changes to take effect' | |
echo 'end' >> $LOG_FILE | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment