-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·36 lines (30 loc) · 1.33 KB
/
install.sh
File metadata and controls
executable file
·36 lines (30 loc) · 1.33 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
#!/bin/sh
INSTALL_PREFIX=${INSTALL_PREFIX:-""}
INSTALL=${INSTALL:-"install"}
INSTALL_OWNER=${INSTALL_OWNER:-"-o root -g root"}
DESTDIR=${DESTDIR:-"/usr/local"}
if [ "${DESTDIR}" = "/" ]; then
BINDIR="/usr/bin"
ETCDIR="/etc"
MAN_DIR="/usr/share/man"
else
BINDIR="${DESTDIR}/bin"
ETCDIR="${DESTDIR}/etc"
MAN_DIR="${DESTDIR}/share/man"
fi
echo "Installing manpages"
"${INSTALL}" -d -m 755 ${INSTALL_OWNER} "${INSTALL_PREFIX}${MAN_DIR}/man8" | exit 1
"${INSTALL}" -m 644 ${INSTALL_OWNER} vtunngd.8 "${INSTALL_PREFIX}${MAN_DIR}/man8" | exit 1
"${INSTALL}" -d -m 755 ${INSTALL_OWNER} "${INSTALL_PREFIX}${MAN_DIR}/man5" | exit 1
"${INSTALL}" -m 644 ${INSTALL_OWNER} vtunngd.conf.5 "${INSTALL_PREFIX}${MAN_DIR}/man5" | exit 1
rm -f "${INSTALL_PREFIX}${MAN_DIR}/man8/vtunng.8" | exit 1
ln -s vtunngd.8 "${INSTALL_PREFIX}${MAN_DIR}/man8/vtunng.8" | exit 1
echo "Installing configuration file"
"${INSTALL}" -d -m 755 ${INSTALL_OWNER} "${INSTALL_PREFIX}${ETCDIR}" | exit 1
if [ ! -f "${INSTALL_PREFIX}${ETCDIR}/vtunngd.conf" ]; then
"${INSTALL}" -m 600 ${INSTALL_OWNER} vtunngd.conf "${INSTALL_PREFIX}${ETCDIR}" | exit 1;
fi
echo "Installing binary"
"${INSTALL}" -d -m 755 ${INSTALL_OWNER} "${INSTALL_PREFIX}${BINDIR}" | exit 1
"${INSTALL}" -m 755 ${INSTALL_OWNER} target/release/vtunngd "${INSTALL_PREFIX}${BINDIR}" | exit 1
echo "Installation successful"