nixos/pleroma: regenerate empty release cookie files

Since b9cfbcafdf0ca9573de1cdc06137c020e70e44a8, the lack of hexdump in
the closure lead to the generation of empty cookie files. This empty
cookie file is making pleroma to crash at startup now we correctly
read it.

We introduce a migration forcing these empty cookies to be
re-generated to something not empty.
This commit is contained in:
Félix Baylac-Jacqué 2022-03-17 13:21:56 +01:00
parent e7f6370701
commit b205832efe

View file

@ -118,7 +118,7 @@ in {
# Better be safe than sorry migration-wise.
ExecStartPre =
let preScript = pkgs.writers.writeBashBin "pleromaStartPre" ''
if [ ! -f "${cookieFile}" ]
if [ ! -f "${cookieFile}" ] || [ ! -s "${cookieFile}" ]
then
echo "Creating cookie file"
dd if=/dev/urandom bs=1 count=16 | ${pkgs.hexdump}/bin/hexdump -e '16/1 "%02x"' > "${cookieFile}"