tui-scripts/a

17 lines
592 B
Bash
Executable File

#!/bin/bash
set -e
trap 'clear' SIGINT
cat > /tmp/.dialogrc << EOL
# Item color
tag_color = (BLACK,WHITE,ON)
EOL
action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for apt" 10 40 0 "Update" 1 "Upgrade" 2 "Install" 3 "Remove" 4)
if [[ $action == "Install" || $action == "Remove" ]]; then
package=$(apt-cache search '' | sort | cut --delimiter ' ' --fields 1 | fzf --multi --cycle --reverse --preview 'apt-cache show {1}')
sudo apt ${action,,} $package -y
elif [[ $action == "Update" || $action == "Upgrade" ]]; then
sudo apt ${action,,} -y
fi