env-termux/setup.sh
Chad 6a9f363771
General Release (#1)
* Add two new location shorcuts and a fix for ffmpeg.

* Add comments and a quick commit function.

* More fixes and enhancements.

* Enhance ffmpeg command with resolution changing.

* Try fixing the test function.

* Prevent situations such as possibly deleting a home directory.

* Use dev branch for testing. Add man to software.

* Always accept.

* Do not cd as part of bashrc.

* Try fixing path issue.

* Try fixing PROG from just saying bash.

* More path and PROG fixes.

* Final cleanups. Seems good now.

* test-termux works great now!

* Add aliases for reloading the Termux config project (this Git repo).

* Add missing slash.

* Fix double flagging bitrates.

* Show the ffmpeg command. Print file sizes.

Planning to come back later with a laptop and clean up tabs vs spaces. Difficult to manage on a phone.

* Move input to be before options.

* Fix filter parameters.

* Remove single quotes.

* Fix typos.

* Add more shortcut aliases.

* Add more packages.

* Update instructions and mention shortcut aliases.

* Fix extra period.

* Add more aliases.

* Add extra detail to final instruction.

* Better formatting on new text.

* Add aliases, fix spaces to tabs.

* Change order of parameters so that size is first.

* Add wget to default packages.

* Add two-pass processing.

* More changes for 2-pass.

* Add ability to still do 1 pass. Add sync before filesize check. Clean 2-pass files.

* Add better chance of getting correct filesize with a sleep. Make ffmpeg 2 pass file name more explicit.

* Change to maxrate from b:v so that ffmpeg can determine the best rate per frame.

* First attempt at adding basic-process for a more flexible ffmpeg experience.

* Multiple bugfixes and enhancements for video functions.

* Only remove first pass files if everything succeeded. Sleep before doing IF for file size.
2024-03-23 19:03:39 -07:00

82 lines
1.8 KiB
Bash

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