2024-02-10 13:00:17 -07:00
|
|
|
# No Shebang For Termux
|
|
|
|
# 2024-02-10 Hyperling
|
|
|
|
|
2024-03-23 19:03:39 -07:00
|
|
|
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
|
|
|
echo "`date` - Starting $PROG"
|
2024-02-10 13:00:17 -07:00
|
|
|
|
2024-03-23 19:03:39 -07:00
|
|
|
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
2024-02-10 13:00:17 -07:00
|
|
|
cd $DIR
|
|
|
|
DIR="`pwd`"
|
2024-03-23 19:03:39 -07:00
|
|
|
echo "Working in '$DIR'."
|
2024-02-10 13:00:17 -07:00
|
|
|
|
|
|
|
echo -e "\n`date` - Upgrade Package Repos"
|
|
|
|
pkg update &&
|
2024-03-23 19:03:39 -07:00
|
|
|
pkg upgrade -y
|
2024-02-10 13:00:17 -07:00
|
|
|
|
|
|
|
echo -e "\n`date` - Check Storage Permission"
|
|
|
|
if [[ ! -e ~/storage/shared ]]; then
|
2024-03-23 19:03:39 -07:00
|
|
|
sleep 3
|
|
|
|
termux-setup-storage
|
|
|
|
if [[ -e ~/storage/shared/ ]]; then
|
|
|
|
echo "~/storage/shared/ now exists. :)"
|
2024-02-10 13:00:17 -07:00
|
|
|
else
|
2024-03-23 19:03:39 -07:00
|
|
|
echo "ERROR: Something ain't right, Jim! Abort!" >&2
|
2024-02-10 13:00:17 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
2024-03-23 19:03:39 -07:00
|
|
|
echo "Everything looks good already, pal."
|
2024-02-10 13:00:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n`date` - Install Software"
|
2024-03-23 19:03:39 -07:00
|
|
|
pkg install -y \
|
2025-01-01 12:44:27 -07:00
|
|
|
openssh tsu vim htop git cronie man zip \
|
2024-03-23 19:03:39 -07:00
|
|
|
nmap traceroute wget \
|
|
|
|
ffmpeg imagemagick \
|
|
|
|
kotlin php nodejs python libllvm
|
2024-02-10 13:00:17 -07:00
|
|
|
|
|
|
|
echo -e "\n`date` - BASH Environment"
|
|
|
|
if [[ ! -e ~/.env ]]; then
|
|
|
|
if [[ -e env.example ]]; then
|
2024-03-23 19:03:39 -07:00
|
|
|
mv -v env.example ~/.env
|
2024-02-10 13:00:17 -07:00
|
|
|
else
|
|
|
|
echo "ERROR: Neither .env or env.example found." >&2
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "'.env' already exists. Good job!"
|
|
|
|
rm -v env.example
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -e bashrc.sh ]]; then
|
|
|
|
mv -v bashrc.sh ~/.bashrc
|
|
|
|
else
|
2024-03-23 19:03:39 -07:00
|
|
|
echo "ERROR: bashrc.sh not found, skipping." >&2
|
2024-02-10 13:00:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n`date` - Cleanup"
|
|
|
|
if [[ -d ~/TRASH ]]; then
|
|
|
|
rm -rfv ~/TRASH
|
|
|
|
fi
|
|
|
|
if [[ ! -e ~/storage/shared/TRASH ]]; then
|
|
|
|
mkdir -pv ~/storage/shared/TRASH
|
|
|
|
fi
|
|
|
|
ln -s ~/storage/shared/TRASH ~/TRASH
|
|
|
|
|
2024-03-23 19:03:39 -07:00
|
|
|
if [[ -n $DIR && $DIR != "/" && -d .git ]]; then
|
|
|
|
echo "We are in a git clone, remove the project."
|
|
|
|
cd ..
|
2025-01-01 12:44:27 -07:00
|
|
|
mv -v $DIR ~/TRASH/termux-"`date +'%Y%m%d%H%M%S'`" |
|
2024-02-10 13:00:17 -07:00
|
|
|
grep -v '/.git/'
|
2024-03-23 19:03:39 -07:00
|
|
|
else
|
|
|
|
echo "File was used individually, remove it."
|
|
|
|
mv "$PROG" ~/TRASH/
|
2024-02-10 13:00:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n*******"
|
|
|
|
echo "Don't forget to reload your environment!"
|
2024-03-23 19:03:39 -07:00
|
|
|
echo " source ~/.bashrc"
|
2024-02-10 13:00:17 -07:00
|
|
|
echo "*******"
|
|
|
|
|
2024-03-23 19:03:39 -07:00
|
|
|
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
|
|
|
echo -e "\n`date` - Finished $PROG"
|
2024-02-10 13:00:17 -07:00
|
|
|
exit 0
|