forgejo_debian_packager/debian/forgejo.postinst
Benjamin Renard 2594a6b28d
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
Release 1.20.2-0
2023-08-01 00:18:04 +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#