-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
67 lines (58 loc) · 1.32 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
#!/bin/sh
# Generated manually;
#
# check the requirement's and create Makefile.
# configuration script for pnm's program requirement grabber,
# shortly automated command.
# defaults
export CWD="${PWD}"
export tab="$(printf '\t')"
export status="true"
export root=""
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 "bash" "make" "cat" "install" "mkdir" ; 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}
BINDIR = \$(PREFIX)/bin
install:
${tab}mkdir -p \$(BINDIR)
${tab}install -m 755 ./src/requirus.sh \$(BINDIR)/requirus
uninstall:
${tab}rm \$(BINDIR)/requirus
reinstall:
${tab}rm \$(BINDIR)/requirus
${tab}mkdir -p \$(BINDIR)
${tab}install -m 755 ./src/requirus.sh \$(BINDIR)/requirus
EOF