Ensure we don't use a new cookie on every boot

This commit is contained in:
José Valim 2022-12-16 00:18:29 +01:00
parent 10da0a2311
commit 497f372140
2 changed files with 4 additions and 2 deletions

View file

@ -9,7 +9,8 @@ export LIVEBOOK_PORT=0
cookie_path="${RELEASE_ROOT}/releases/COOKIE"
if [ ! -f $cookie_path ]; then
RELEASE_COOKIE=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
[[ $RELEASE_COOKIE > $cookie_path ]] || export RELEASE_COOKIE
echo "$RELEASE_COOKIE" > "$cookie_path"
[ $? -eq 0 ] || export RELEASE_COOKIE
fi
cd $HOME

View file

@ -4,5 +4,6 @@ export RELEASE_MODE=interactive
cookie_path="${RELEASE_ROOT}/releases/COOKIE"
if [ ! -f $cookie_path ]; then
RELEASE_COOKIE=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
[[ $RELEASE_COOKIE > $cookie_path ]] || export RELEASE_COOKIE
echo "$RELEASE_COOKIE" > "$cookie_path"
[ $? -eq 0 ] || export RELEASE_COOKIE
fi