mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-09-01 18:48:17 +00:00
Ensure that _some_ password is set. dd /dev/urandom seems to work quite
well, actually.
This commit is contained in:
parent
48f43b18b3
commit
ac49c8c278
@ -33,11 +33,12 @@ if [ "${ADMINPW}" = "" ] ; then
|
||||
#
|
||||
# Generate a random administrative password. If pwgen is available we'll use that,
|
||||
# otherwise try and hack something up using a few standard utilities
|
||||
PWGEN="`which pwgen`"
|
||||
if [ "$PWGEN" = "" ] ; then
|
||||
ADMINPW="`pwgen -Bcny 2>/dev/null | tr \"\\\'\" '^='`"
|
||||
if [ "$ADMINPW" = "" ] ; then
|
||||
ADMINPW="`dd if=/dev/urandom bs=512 count=1 2>/dev/null | tr -c -d "[:alnum:]" | cut -c2-9`"
|
||||
else
|
||||
ADMINPW="`pwgen -Bcny | tr \"\\\'\" '^='`"
|
||||
fi
|
||||
if [ "$ADMINPW" = "" ] ; then
|
||||
ADMINPW="please change this password"
|
||||
fi
|
||||
fi
|
||||
psql -q -c "UPDATE usr SET password = '**${ADMINPW}' WHERE user_no = 1;" "${DBNAME}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user