-
Notifications
You must be signed in to change notification settings - Fork 14
/
uppm-shim-termux-pkg
executable file
·58 lines (53 loc) · 1.35 KB
/
uppm-shim-termux-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
#!/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' ;;
gsed) printf '%s\n' 'sed' ;;
gtar) printf '%s\n' 'tar' ;;
gmake) printf '%s\n' 'make' ;;
xz) printf '%s\n' 'xz-utils' ;;
bsdtar) printf '%s\n' 'libarchive';;
*) printf '%s\n' "$1"
esac
}
main() {
case $1 in
about)
termux-info
;;
update)
pkg update
;;
install)
shift 1
for UPPM_PACKAGE_NAME in "$@"
do
BREW_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg "$UPPM_PACKAGE_NAME")"
pkg install -y "$BREW_PACKAGE_NAME"
done
;;
is-installed)
shift 1
BREW_PACKAGE_NAME="$(package_name_transform_from_uppm_to_pkg "$1")"
pkg info "$BREW_PACKAGE_NAME" 2>/dev/null
;;
info)
shift 1
case $2 in
installed-dir)
printf '%s\n' '/data/data/com.termux/files/usr'
;;
esac
;;
*) pkg "$@"
esac
}
main "$@"