forgejo_debian_packager/debian/forgejo.postinst
Benjamin Renard a65bae33f0
Some checks failed
ci/woodpecker/tag/woodpecker Pipeline failed
Release 1.20.2-0
2023-07-31 23:16:54 +02:00

29 lines
655 B
Bash

#!/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#