mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-12 07:54:49 +08:00
Improve RELEASE_COOKIE handling on read-only fs (#1919)
This commit is contained in:
parent
8e4f3067da
commit
01bf6cd27d
2 changed files with 6 additions and 5 deletions
|
@ -5,6 +5,8 @@ set RELEASE_MODE=interactive
|
|||
|
||||
set cookie_path="!RELEASE_ROOT!\releases\COOKIE"
|
||||
if not exist %cookie_path% (
|
||||
for /f "skip=1" %%X in ('wmic os get localdatetime') do if not defined TIMESTAMP set TIMESTAMP=%%X
|
||||
echo cookie-!TIMESTAMP:~0,11!-!RANDOM! > %cookie_path%
|
||||
if not defined RELEASE_COOKIE (
|
||||
for /f "skip=1" %%X in ('wmic os get localdatetime') do if not defined TIMESTAMP set TIMESTAMP=%%X
|
||||
echo cookie-!TIMESTAMP:~0,11!-!RANDOM! > %cookie_path%
|
||||
)
|
||||
)
|
||||
|
|
|
@ -3,8 +3,7 @@ export RELEASE_DISTRIBUTION=${LIVEBOOK_DISTRIBUTION:-${RELEASE_DISTRIBUTION:-sna
|
|||
export RELEASE_MODE=interactive
|
||||
|
||||
cookie_path="${RELEASE_ROOT}/releases/COOKIE"
|
||||
if [ ! -f $cookie_path ]; then
|
||||
if [ ! -f $cookie_path ] && [ -z "$RELEASE_COOKIE" ]; then
|
||||
RELEASE_COOKIE=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||
echo "$RELEASE_COOKIE" > "$cookie_path"
|
||||
[ $? -eq 0 ] || export RELEASE_COOKIE
|
||||
echo "$RELEASE_COOKIE" > "$cookie_path" || export RELEASE_COOKIE
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue