-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathentrypoint.sh
executable file
·37 lines (27 loc) · 1014 Bytes
/
entrypoint.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
#!/bin/bash
set -euo pipefail
PUID=${PUID:=$(stat -c %u /snikket)}
PGID=${PGID:=$(stat -c %g /snikket)}
if [ "$PUID" != 0 ] && [ "$PGID" != 0 ]; then
usermod -o -u "$PUID" letsencrypt
groupmod -o -g "$PGID" letsencrypt
fi
if ! test -d /snikket/letsencrypt; then
install -o letsencrypt -g letsencrypt -m 750 -d /snikket/letsencrypt;
fi
install -o letsencrypt -g letsencrypt -m 750 -d /var/lib/letsencrypt;
install -o letsencrypt -g letsencrypt -m 750 -d /var/log/letsencrypt;
install -o letsencrypt -g letsencrypt -m 755 -d /var/www/.well-known/acme-challenge;
if ! chown -R letsencrypt:letsencrypt /snikket/letsencrypt; then
echo "WW: Failed to adjust the permissions of some files/directories";
fi
export SNIKKET_DOMAIN_ASCII=$(idn2 "$SNIKKET_DOMAIN")
if [ "${SNIKKET_CERTS_WAIT-0}" = "1" ]; then
/usr/local/bin/wait_for_http.py "http://${SNIKKET_DOMAIN_ASCII}";
fi
# Run once, now
/usr/sbin/anacron -d -n;
# Run every hour
while sleep 3600; do
/usr/sbin/anacron -d -n;
done