-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·45 lines (39 loc) · 899 Bytes
/
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
#!/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}"
fi
done
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=''
fi
fi
BINDIR="${DESTDIR}${PREFIX}/bin"
# Remove any double-slashes
BINDIR="$(echo "${BINDIR}" | sed 's|//|/|g')"
mkdir -p "${BINDIR}"
install -v -m 755 mkpydoc.sh "${BINDIR}"