-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
72 lines (63 loc) · 1.47 KB
/
configure.sh
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
68
69
70
71
72
#!/bin/sh
# Generated manually;
#
# check the requirement's and create Makefile.
# configuration script for pnm's key value based data base
# management tool, it require: Gnu-Make, Gnu-Cpio (or bsd it doesn't matter)
# core-utils, find-utils and Bourne Again SHell.
# defaults
export CWD="${PWD}"
export tab="$(printf '\t')"
export status="true"
if [ "${PATH}" = *com.termux* ] ; then
export root="/data/data/com.termux/files"
else
export root=""
fi
export prefix="/usr"
# parsing the options
while [ "${#}" -gt 0 ] ; do
case "${1}" in
--root|-r)
shift
[ -n "${1}" ] && {
export root="${1}"
shift
}
;;
--prefix|-p)
shift
[ -n "${1}" ] && {
export prefix="${1}"
shift
}
;;
*)
shift
;;
esac
done
# check requirements
for i in "cpio" "file" "make" "bash" "mkdir" "cat" "rm" "find" ; do
if ! command -v "${i}" > /dev/null ; then
printf "\tconfigure: command: '${i}' not found..\n"
export status="false"
fi
done
if [ "${status}" = "false" ] ; then
exit 1
fi
# create Makefile
cat - > Makefile <<EOF
PREFIX = ${root}${prefix}
LIBDIR = \$(PREFIX)/local/lib/bash5
install:
${tab}mkdir -p \$(LIBDIR)
${tab}cp ./lib/pdb.sh \$(LIBDIR)
uninstall:
${tab}rm \$(LIBDIR)/pdb.sh
reinstall:
${tab}rm \$(LIBDIR)/pdb.sh
${tab}mkdir -p \$(LIBDIR)
${tab}cp ./lib/pdb.sh \$(LIBDIR)
EOF