Allow for existing user or group
Fix chown syntax
This commit is contained in:
parent
66c8f8d8df
commit
5a24e30820
1 changed files with 4 additions and 3 deletions
|
@ -7,8 +7,9 @@ set -e
|
||||||
if [ "$1" = "configure" ] || [ "$1" -ge 1 ]; then
|
if [ "$1" = "configure" ] || [ "$1" -ge 1 ]; then
|
||||||
if [ -d /run/systemd/system ]; then
|
if [ -d /run/systemd/system ]; then
|
||||||
# Create ntfy user/group
|
# Create ntfy user/group
|
||||||
id ntfy >/dev/null 2>&1 || useradd --system --no-create-home ntfy
|
groupadd -f ntfy
|
||||||
chown ntfy.ntfy /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
|
id ntfy >/dev/null 2>&1 || useradd --system --no-create-home -g ntfy ntfy
|
||||||
|
chown ntfy:ntfy /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
|
||||||
chmod 700 /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
|
chmod 700 /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
|
||||||
|
|
||||||
# Hack to change permissions on cache file
|
# Hack to change permissions on cache file
|
||||||
|
@ -16,7 +17,7 @@ if [ "$1" = "configure" ] || [ "$1" -ge 1 ]; then
|
||||||
if [ -f "$configfile" ]; then
|
if [ -f "$configfile" ]; then
|
||||||
cachefile="$(cat "$configfile" | perl -n -e'/^\s*cache-file: ["'"'"']?([^"'"'"']+)["'"'"']?/ && print $1')" # Oh my, see #47
|
cachefile="$(cat "$configfile" | perl -n -e'/^\s*cache-file: ["'"'"']?([^"'"'"']+)["'"'"']?/ && print $1')" # Oh my, see #47
|
||||||
if [ -n "$cachefile" ]; then
|
if [ -n "$cachefile" ]; then
|
||||||
chown ntfy.ntfy "$cachefile" || true
|
chown ntfy:ntfy "$cachefile" || true
|
||||||
chmod 600 "$cachefile" || true
|
chmod 600 "$cachefile" || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue