| 1 | From: Peymaneh <[email protected]> |
| 2 | Date: Fri, 23 Dec 2022 21:20:44 +0100 |
| 3 | Subject: postinst/postrm: do not leave directories on purge |
| 4 | |
| 5 | --- |
| 6 | dist/scripts/postinstall.sh | 7 +++++++ |
| 7 | dist/scripts/postremove.sh | 3 ++- |
| 8 | 2 files changed, 9 insertions(+), 1 deletion(-) |
| 9 | |
| 10 | --- a/dist/scripts/postinstall.sh |
| 11 | +++ b/dist/scripts/postinstall.sh |
| 12 | @@ -19,6 +19,13 @@ |
| 13 | usermod -aG www-data caddy |
| 14 | fi |
| 15 | |
| 16 | + # handle cases where package was installed and then purged; |
| 17 | + # user and group will still exist but with no home dir |
| 18 | + if [ ! -d /var/lib/caddy ]; then |
| 19 | + mkdir -p /var/lib/caddy |
| 20 | + chown caddy:caddy /var/lib/caddy |
| 21 | + fi |
| 22 | + |
| 23 | # Add log directory with correct permissions |
| 24 | if [ ! -d /var/log/caddy ]; then |
| 25 | mkdir -p /var/log/caddy |