-
Notifications
You must be signed in to change notification settings - Fork 3
/
uppm-shim-pkg
executable file
·60 lines (55 loc) · 1.43 KB
/
uppm-shim-pkg
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
#!/bin/sh
set -ex
pkg() {
if [ "$(id -u)" -eq 0 ] ; then
command pkg "$@"
else
command sudo pkg "$@"
fi
}
package_name_transform_from_uppm_to_pkg() {
case $1 in
gm4) printf '%s\n' 'm4' ;;
grep) printf '%s\n' 'gnugrep' ;;
golang) printf '%s\n' 'go' ;;
yq) printf '%s\n' 'go-yq' ;;
xz) printf '%s\n' 'gtar' ;;
bsdtar) printf '%s\n' 'gtar' ;;
pkg-config) printf '%s\n' 'pkgconf' ;;
perl) printf '%s\n' 'perl5.38' ;;
*) printf '%s\n' "$1"
esac
}
main() {
case $1 in
about)
pkg --version
;;
update)
pkg update
;;
install)
shift 1
for UPPM_PACKAGE_NAME in "$@"
do
FPKG_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg "$UPPM_PACKAGE_NAME")"
pkg install -y "$FPKG_PACKAGE_NAME"
done
;;
is-installed)
shift 1
FPKG_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg "$1")"
pkg info "$FPKG_PACKAGE_NAME" 2>/dev/null
;;
info)
shift 1
case $2 in
installed-dir)
#printf '%s\n' '/usr/local'
;;
esac
;;
*) pkg "$@"
esac
}
main "$@"