-
Notifications
You must be signed in to change notification settings - Fork 3
/
uppm-shim-pkg_add
executable file
·67 lines (62 loc) · 1.67 KB
/
uppm-shim-pkg_add
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
64
65
66
67
#!/bin/sh
set -ex
pkg_add() {
if [ "$(id -u)" -eq 0 ] ; then
command pkg_add "$@"
else
command sudo pkg_add "$@"
fi
}
package_name_transform_from_uppm_to_pkg_add() {
case $1 in
gm4) printf '%s\n' 'm4' ;;
grep) printf '%s\n' 'ggrep' ;;
gtar) printf '%s\n' 'gtar--' ;;
patch) printf '%s\n' 'gpatch' ;;
unzip) printf '%s\n' 'unzip--' ;;
golang) printf '%s\n' 'go' ;;
bsdtar) printf '%s\n' 'libarchive';;
pkg-config)
printf '%s\n' 'pkgconf' ;;
autoconf) printf '%s\n' 'autoconf%2.69' ;;
automake) printf '%s\n' 'automake%1.16' ;;
*) printf '%s\n' "$1"
esac
}
main() {
case $1 in
about)
;;
update)
;;
install)
shift 1
for UPPM_PACKAGE_NAME in "$@"
do
BREW_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg_add "$UPPM_PACKAGE_NAME")"
pkg_add "$BREW_PACKAGE_NAME"
done
;;
is-installed)
shift 1
BREW_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg_add "$1")"
for item in $(pkg_info | cut -d ' ' -f1)
do
case $item in
"$BREW_PACKAGE_NAME-"*) return 0
esac
done
return 1
;;
info)
shift 1
case $2 in
installed-dir)
printf '%s\n' '/usr/local'
;;
esac
;;
*) pkg_add "$@"
esac
}
main "$@"