-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·36 lines (33 loc) · 1.1 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
#!/bin/sh -eu
SCRIPT_DIR="$(dirname "${0}")"
### Setup etc dir
ETCDIR="${PREFIX:-}/etc/acme-dns-client"
#
[ -d "${ETCDIR}" ] || install -v -d -m u=rwx-s,g=rx-s,o=-s -- "${ETCDIR}"
chmod -c -- u=rwx-s,g=rx-s,o=-s "${ETCDIR}"
chown -c -- root:root "${ETCDIR}"
#
ETCFILE="${ETCDIR}/config.json"
if [ ! -s "${ETCFILE}" ]; then
if [ -s "${ETCDIR}/config.json5" ]; then
### rename configuration file of <= 0.8.0 to configuration file name of 0.9.0+
mv -v "${ETCDIR}/config.json5" "${ETCFILE}"
else
printf -- '{\n}\n' > "${ETCFILE}"
fi
fi
chmod -c -- u=rw-s,g=r-s,o=-s "${ETCFILE}"
chown -c -- root:root "${ETCFILE}"
#
ETCFILE="${ETCDIR}/domain_accounts.json"
[ -s "${ETCFILE}" ] || printf -- '{\n}\n' > "${ETCFILE}"
chmod -c -- u=rw-s,g=r-s,o=-s "${ETCFILE}"
chown -c -- root:root "${ETCFILE}"
### Setup bin dir
BINDIR="${PREFIX:-}/usr/local/bin"
#
[ -d "${BINDIR}" ] || install -v -d -- "${BINDIR}"
#
install -v -- "${SCRIPT_DIR}/acme-dns-client-2.sh" "${BINDIR}/"
install -v -- "${SCRIPT_DIR}/acme-dns-client-2.py" "${BINDIR}/"
install -v -m u=rw-s,go=r-s -- "${SCRIPT_DIR}/acmednsclient2.py" "${BINDIR}/"