mabox-tools/bin/mb-cli
2024-02-24 09:30:06 +01:00

68 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# mb-cli run some commands from launchers in terminal
case "$LANG" in
pl*)
_NOT_FOUND_TERMINATOR="Terminator nie został znaleziony!"
_DESC="Zainstaluj Terminatora, aby wykonać skrypt"
_INSTALL_TERMINATOR="Zainstaluj Terminatora"
;;
*)
_NOT_FOUND_TERMINATOR="Terminator not found!"
_DESC="To run script install Terminator first"
_INSTALL_TERMINATOR="Install Terminator"
;;
esac
if ! hash terminator &> /dev/null
then
notify-send.sh -i error "$_NOT_FOUND_TERMINATOR" "$_DESC" -o "$_INSTALL_TERMINATOR:pamac-installer terminator"
exit 1
fi
case "$LANG" in
pl*)
_UPDATE="Aktualizacja systemu"
_STATS="Statystyki pakietów"
_MIRRORS="Ranking mirrorów"
_BTOP="Btop - monitor zasobów"
_FINISHED="Zakończono! Wciśnij ENTER aby zamknąć terminal"
;;
*)
_UPDATE="System update"
_STATS="Package statistics"
_MIRRORS="Mirror ranking"
_BTOP="Btop - a monitor of resources"
_FINISHED=" FINISHED! Hit ENTER or close this window"
;;
esac
case "$1" in
update)
CMD="yay -Syyu"
terminator -T "$_UPDATE: ($CMD)" -e "${CMD};read -p \"${_FINISHED}\""
;;
stats)
CMD="yay -Ps"
terminator -T "$_STATS: ($CMD)" -e "${CMD};read"
;;
mirrors)
CMD="sudo pacman-mirrors -f5"
terminator -T "$_MIRRORS: ($CMD)" -e "${CMD};read -p \"${_FINISHED}\""
;;
mirrors_all)
CMD="sudo pacman-mirrors -i -c all"
terminator -T "$_MIRRORS: ($CMD)" -e "${CMD};read -p \"${_FINISHED}\""
;;
mirrors_geo)
CMD="sudo pacman-mirrors -i --geoip"
terminator -T "$_MIRRORS: ($CMD)" -e "${CMD};read -p \"${_FINISHED}\""
;;
btop)
terminator -T "$_BTOP" -e "btop"
;;
*):;;
esac