-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathconfigure
executable file
·101 lines (80 loc) · 2.86 KB
/
configure
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
# This is a leight-weight self-styled configure script
PREFIX=""
print_help() {
echo "Usage: configure [--prefix]"
echo ""
echo "--prefix Specify custom install prefix."
echo " e.g. --prefix=/usr/local"
echo ""
}
while [ $# -gt 0 ]; do
case "$1" in
--help)
print_help
exit 0
;;
--prefix*)
CUSTOM_PREFIX="$(echo "$1" | $(which sed) 's/^--prefix=//g')"
# Remove trailing slash
CUSTOM_PREFIX="/$(echo "${CUSTOM_PREFIX}" | $(which sed) 's#/*$##;s#^/*##')"
PREFIX="${CUSTOM_PREFIX}"
;;
*)
echo "Invalid argument: '${1}'"
echo "Type '${0} --help' for available options."
exit 1
;;
esac
shift
done
# Create build directory
if [ ! -d build ]; then
$(which mkdir) build
fi
# Copy files to dist directory
$(which cp) -f bin/mysqldump-secure build/
$(which cp) -f etc/mysqldump-secure.conf build/
$(which cp) -f etc/mysqldump-secure.cnf build/
$(which cp) -f man/mysqldump-secure.1 build/
# Adjust auto-generated vars
$(which sed) -i'' -e "s|^_PREFIX_ETC=\"\"$|_PREFIX_ETC=\"${PREFIX}\"|g" build/mysqldump-secure
$(which sed) -i'' -e "s|^_PREFIX_LOG=\"\"$|_PREFIX_LOG=\"${PREFIX}\"|g" build/mysqldump-secure
$(which sed) -i'' -e "s|^_PREFIX_VAR=\"\"$|_PREFIX_VAR=\"${PREFIX}\"|g" build/mysqldump-secure
# Adjust prefix-paths in config
$(which sed) -i'' -e "s|^DUMP_DIR=\"/var/mysqldump-secure\"|DUMP_DIR=\"${PREFIX}/var/mysqldump-secure\"|g" build/mysqldump-secure.conf
$(which sed) -i'' -e "s|^MYSQL_CNF_FILE=\"/etc/mysqldump-secure.cnf\"|MYSQL_CNF_FILE=\"${PREFIX}/etc/mysqldump-secure.cnf\"|g" build/mysqldump-secure.conf
$(which sed) -i'' -e "s|^LOG_FILE=\"/var/log/mysqldump-secure.log\"|LOG_FILE=\"${PREFIX}/var/log/mysqldump-secure.log\"|g" build/mysqldump-secure.conf
$(which sed) -i'' -e "s|^OPENSSL_PUBKEY_PEM=\"/etc/mysqldump-secure.pub.pem\"|OPENSSL_PUBKEY_PEM=\"${PREFIX}/etc/mysqldump-secure.pub.pem\"|g" build/mysqldump-secure.conf
$(which sed) -i'' -e "s|^NAGIOS_LOG_FILE=\"/var/log/mysqldump-secure.nagios.log\"|NAGIOS_LOG_FILE=\"${PREFIX}/var/log/mysqldump-secure.nagios.log\"|g" build/mysqldump-secure.conf
if [ -z "${PREFIX}" ]; then
ETCDIR="/etc"
BINDIR="/usr/bin"
MANDIR="/usr/share/man"
else
ETCDIR="${PREFIX}/etc"
BINDIR="${PREFIX}/bin"
MANDIR="${PREFIX}/share/man"
fi
# Write configure configuration file
echo "PREFIX = ${PREFIX}" > configure.in
echo "ETCDIR = ${ETCDIR}" >> configure.in
echo "BINDIR = ${BINDIR}" >> configure.in
echo "MANDIR = ${MANDIR}" >> configure.in
echo ""
echo "Configure run successfully"
echo ""
if [ -z "${PREFIX}" ]; then
echo " Install prefix: /"
else
echo " Install prefix: ${PREFIX}"
fi
echo ""
echo "Files will be installed to:"
echo " ${BINDIR}/mysqldump-secure"
echo " ${ETCDIR}/mysqldump-secure.conf"
echo " ${ETCDIR}/mysqldump-secure.cnf"
echo " ${MANDIR}/man1/mysqldump-secure.1"
echo ""
echo "Run 'make' to build or 'make help' for options"
exit 0