forgejo_debian_packager/debian/forgejo.postinst

30 lines
655 B
Text
Raw Normal View History

2023-07-31 21:24:46 +02:00
#!/bin/bash
SECRET_PATH=/var/lib/forgejo/secret
INTERNAL_TOKEN_PATH=/var/lib/forgejo/internal_token
case "$1" in
configure)
if [ ! -e "$SECRET_PATH" ]
then
echo -n "Generating secret file..."
cat /dev/urandom | tr -dc '[:alpha:]' | fold -w 100 | head -n 1 > $SECRET_PATH
chown git:git "$SECRET_PATH"
chmod 0400 "$SECRET_PATH"
echo " done."
fi
if [ ! -e "$INTERNAL_TOKEN_PATH" ]
then
echo -n "Generating internal token file..."
cat /dev/urandom | tr -dc '[:alpha:]' | fold -w 100 | head -n 1 > $INTERNAL_TOKEN_PATH
chown git:git "$INTERNAL_TOKEN_PATH"
chmod 0400 "$INTERNAL_TOKEN_PATH"
echo " done."
fi
;;
esac
#DEBHELPER#