-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpmaptitude
executable file
·63 lines (60 loc) · 1.45 KB
/
pmaptitude
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# (c) 2020 Leif Sawyer
# License: GPL 3.0 (see https://github.com/akhepcat/)
# Permanent home: https://github.com/akhepcat/Miscellaneous/
# Direct download: https://raw.githubusercontent.com/akhepcat/Miscellaneous/master/pmaptitude
#
# PMaptitude - pacman-interface from aptitude
#
# super insecure. Don't use this on multi-user systems.
# really, just don't use this
#
PROG=${0##*/}
CMD="$1"
shift
ARGS="${*}"
# some very basic, not at all effective, sanitizing
ARGS="${ARGS//[\'\`\$\(\)]/}"
if [ -n "${ARGS}" ]
then
if [ -z "${ARGS##*--no-install-recommends*}" ]
then
ARGS=${ARGS//--no-install-recommends/}
OPTS="${OPTS} --asexplicit"
fi
if [ -z "${ARGS##*--dry-run*}" ]
then
ARGS=${ARGS//--dry-run/}
OPTS="${OPTS} --print"
fi
if [ -z "${ARGS##*-y*}" ]
then
ARGS=${ARGS//-y/}
OPTS="${OPTS} --noconfirm"
fi
fi
case "$CMD" in
find) pacman -F ${OPTS} ${ARGS}
;;
search) pacman -Ss ${OPTS} ${ARGS// /|}
;;
install) pacman -S ${OPTS} ${ARGS}
;;
update) pacman -Syy
;;
upgrade|dist-upgrade) pacman -Syu ${OPTS} ${ARGS}
;;
remove|purge) pacman -Rs ${OPTS} ${ARGS}
;;
clean|autoclean) pacman -Sc
;;
autoremove) pacman -Qdtq | pacman -Rs -
;;
show) pacman -Si ${OPTS} ${ARGS}
;;
*) echo "ERR: null or unsupported apt command for pacman: ${CMD}"
echo "USAGE:"
echo " $PROG [find|search|install|remove|purge|show] {pkgspec}"
echo " [update|upgrade|dist-upgrade|clean|autoclean|autoremove]"
;;
esac