39 lines
862 B
Bash
Executable File
39 lines
862 B
Bash
Executable File
#!/data/data/com.termux/files/usr/bin/sh
|
|
set -e -u
|
|
|
|
show_help() {
|
|
echo 'Usage: packages command [arguments]'
|
|
echo ''
|
|
echo 'A tool for managing packages. Commands:'
|
|
echo ''
|
|
echo ' files <packages>'
|
|
echo ' install <packages>'
|
|
echo ' list-all'
|
|
echo ' list-installed'
|
|
echo ' reinstall <packages>'
|
|
echo ' search <query>'
|
|
echo ' show <packages>'
|
|
echo ' uninstall <packages>'
|
|
echo ' upgrade'
|
|
exit 1
|
|
}
|
|
|
|
if [ $# = 0 ]; then show_help; fi
|
|
CMD="$1"
|
|
shift 1
|
|
|
|
case "$CMD" in
|
|
f*) dpkg -L $@;;
|
|
h*) show_help;;
|
|
i*) apt update; apt install $@;;
|
|
list-a*) apt list $@;;
|
|
list-i*) apt list --installed $@;;
|
|
re*) apt install --reinstall $@;;
|
|
se*) apt update; apt search $@;;
|
|
sh*) apt show $@;;
|
|
un*|rem*|rm|del*) apt remove $@;;
|
|
up*) apt update; apt full-upgrade;;
|
|
*) echo "Unknown command: '$CMD' (run 'packages help' for usage information)";;
|
|
esac
|
|
|