authentic2.postinst: creating file if NOT exist

This commit is contained in:
Jérôme Schneider 2013-11-25 16:12:01 +01:00
parent b8eff0331c
commit d639ef7e68
1 changed files with 3 additions and 1 deletions

View File

@ -28,10 +28,12 @@ case "$1" in
$AUTHENTIC_USER
echo "..done" >&2
fi
if [ -f "/etc/$NAME/secret" ]; then
if [ ! -f "/etc/$NAME/secret" ]; then
echo -n "Generating Django secret.." >&2
echo "export SECRET_KEY='`</dev/urandom tr -dc [:alnum:]-_\!\%\^:\; | head -c70`'" > /etc/$NAME/secret
chmod 0600 /etc/$NAME/secret
chown $AUTHENTIC_USER:$AUTHENTIC_GROUP /etc/$NAME/secret
echo "..done" >&2
fi
chown $AUTHENTIC_USER:$AUTHENTIC_GROUP /var/lib/authentic2 \