.dots/scripts/update.sh

40 lines
1.4 KiB
Bash
Executable file

#!/data/data/com.termux/files/usr/bin/bash
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# termux update script
# font styles & colors
font_default="\e[0m"
font_colored="\e[32;1m"
font_colored_bold="\e[31;1m"
for arg in "$@"; do
case "$arg" in
-n|--noconfirm)
noconfirm="true"
;;
esac
done
printf ""$font_colored_bold">> system update started..."$font_default"\n"
printf ""$font_colored"> updating packages..."$font_default"\n"
/usr/bin/apt-get update
[[ "$noconfirm" ]] && /usr/bin/apt-get upgrade -y || /usr/bin/apt-get upgrade
printf ""$font_colored"> cleaning cache..."$font_default"\n"
rm -rf "/var/cache//usr/bin/apt-get/*"
[[ "$noconfirm" ]] && /usr/bin/apt-get clean -y || /usr/bin/apt-get clean
printf ""$font_colored"> updating 'pfetch'..."$font_default"\n"
[[ ! -d "$HOME/.pfetch" ]] && mkdir "$HOME/.pfetch"
curl -L -s "https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch" > "$HOME/.pfetch/pfetch"
chmod +x "$HOME/.pfetch/pfetch"
[[ ! -f "/data/data/com.termux/files/usr/bin/pfetch" ]] && ln -s "$HOME/.pfetch/pfetch" "/data/data/com.termux/files/usr/bin/pfetch"
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
[[ "$noconfirm" ]] && /usr/bin/apt-get autoremove --purge -y || /usr/bin/apt-get autoremove --purge
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"