-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·60 lines (54 loc) · 1.44 KB
/
install.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
#!/bin/bash
# Support calling like ./install.sh DESTDIR="${pkgdir}"
for arg in "$@";
do
if ( echo "${arg}" | grep -q '^PREFIX=' );
then
export "${arg}"
elif ( echo "${arg}" | grep -q '^DESTDIR=' );
then
export "${arg}"
elif ( echo "${arg}" | grep -q '^INSTALL_DIR=' );
then
export "${arg}"
fi
done
if [ ! -z "${INSTALL_DIR}" ];
then
if [ -z "${PREFIX}" ];
then
PREFIX="usr"
else
if [ "${PREFIX}" != "/" ];
then
PREFIX="$(echo "${PREFIX}" | sed 's|[/][/]*$||g')"
PREFIX="$(echo "${PREFIX}" | sed 's|//|/|g')"
fi
fi
if [ -z "${DESTDIR}" ];
then
DESTDIR=""
else
if [ "${DESTDIR}" != "/" ];
then
DESTDIR="$(echo "${DESTDIR}" | sed 's|[/][/]*$||g')"
DESTDIR="$(echo "${DESTDIR}" | sed 's|//|/|g')"
else
DESTDIR="${DESTDIR}"
fi
fi
export DESTDIR
export PREFIX
if ! ( ! ( echo "${DESTDIR}" | grep -E '/$' || ! echo "${PREFIX}" | grep -E '^/' ) ); then
# Check if combining DESTDIR and PREFIX is not going to naturally have a slash
# and if we need to, nuture it.
DESTDIR="${DESTDIR}/"
fi
FINALDIR="${INSTALL_DIR}"
else
FINALDIR="${DESTDIR}${PREFIX}/etc"
fi
# Remove any double-slashes
FINALDIR="$(echo "${FINALDIR}" | sed 's|//|/|g')"
mkdir -p "${FINALDIR}"
install -v -m 755 bash-resume.sh "${FINALDIR}/"