-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathpkgname.sh
More file actions
executable file
·49 lines (43 loc) · 1.4 KB
/
pkgname.sh
File metadata and controls
executable file
·49 lines (43 loc) · 1.4 KB
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
#!/bin/sh
if [ ! -d .git ]; then
# not a clone
echo ''
exit 0
fi
UNAMES="$(uname -s)"
case "$UNAMES" in
Darwin)
DIST='macos'
VERSION_ID="$(sw_vers | grep 'ProductVersion' | cut -d':' -f 2 | cut -d'.' -f1 | tr -d ' \t')"
SYSTEM="${DIST}${VERSION_ID}"
;;
Linux)
if [ -n "${ERLANG_ROCKSDB_DIST:-}" ]; then
# Allow distros without a matching prebuilt to opt into a
# binary-compatible target. e.g. on Arch Linux:
# ERLANG_ROCKSDB_DIST=debian13
SYSTEM="${ERLANG_ROCKSDB_DIST}"
else
if grep -q -i 'rhel' /etc/*-release; then
DIST='el'
VERSION_ID="$(rpm --eval '%{rhel}')"
else
DIST="$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')"
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
fi
SYSTEM="$(echo "${DIST}${VERSION_ID}" | sed -r 's/([a-zA-Z]*)-.*/\1/g')"
fi
;;
*)
# unsupported system
echo ''
exit 0
;;
esac
ARCH="$(uname -m)"
VSN="$(git describe --tags --exact-match | head -1)"
if [ -z "$VSN" ]; then
VSN="debug"
fi
OTP="$(erl -noshell -eval 'io:format(erlang:system_info(otp_release)).' -s init stop)"
echo "liberocksdb-${VSN}-otp${OTP}-${SYSTEM}-${ARCH}.gz"