tui-scripts/a

19 lines
780 B
Plaintext
Raw Normal View History

2024-03-16 15:34:40 +00:00
#!/bin/bash
set -e
2024-03-29 06:50:32 +00:00
trap 'clear' SIGINT
2024-03-16 15:34:40 +00:00
cat > /tmp/.dialogrc << EOL
# Item color
tag_color = (BLACK,WHITE,ON)
EOL
2024-03-29 07:23:10 +00:00
action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for apt" 10 40 0 "Install" 1 "Install from .deb file" 2 "Update" 3 "Upgrade" 4 "Remove" 5 "Autoremove" 6)
2024-03-16 15:34:40 +00:00
if [[ $action == "Install" || $action == "Remove" ]]; then
2024-03-16 15:51:56 +00:00
package=$(apt-cache search '' | sort | cut --delimiter ' ' --fields 1 | fzf --multi --cycle --reverse --preview 'apt-cache show {1}')
2024-03-16 15:34:40 +00:00
sudo apt ${action,,} $package -y
2024-03-29 07:23:10 +00:00
elif [[ $action == "Install from .deb file" ]]; then
2024-03-29 07:32:32 +00:00
find . -name "*.deb" | fzf | xargs -I _ sudo apt install -y _
2024-03-29 07:23:10 +00:00
elif [[ $action == "Update" || $action == "Upgrade" || $action == "Autoremove" ]]; then
2024-03-16 15:34:40 +00:00
sudo apt ${action,,} -y
fi