mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-19 01:34:26 +00:00
Improved layout and comments.
This commit is contained in:
parent
51b45e71c8
commit
76f64d863d
@ -34,13 +34,20 @@ if [ "${ADMINPW}" = "" ] ; then
|
|||||||
# Generate a random administrative password. If pwgen is available we'll use that,
|
# Generate a random administrative password. If pwgen is available we'll use that,
|
||||||
# otherwise try and hack something up using a few standard utilities
|
# otherwise try and hack something up using a few standard utilities
|
||||||
ADMINPW="`pwgen -Bcny 2>/dev/null | tr \"\\\'\" '^='`"
|
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`"
|
|
||||||
fi
|
|
||||||
if [ "$ADMINPW" = "" ] ; then
|
|
||||||
ADMINPW="please change this password"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ADMINPW" = "" ] ; then
|
||||||
|
# OK. They didn't supply one, and pwgen didn't work, so we hack something
|
||||||
|
# together from /dev/random ...
|
||||||
|
ADMINPW="`dd if=/dev/urandom bs=512 count=1 2>/dev/null | tr -c -d "[:alnum:]" | cut -c2-9`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ADMINPW" = "" ] ; then
|
||||||
|
# Right. We're getting desperate now. We'll have to use a default password
|
||||||
|
# and hope that they change it to something more sensible.
|
||||||
|
ADMINPW="please change this password"
|
||||||
|
fi
|
||||||
|
|
||||||
psql -q -c "UPDATE usr SET password = '**${ADMINPW}' WHERE user_no = 1;" "${DBNAME}"
|
psql -q -c "UPDATE usr SET password = '**${ADMINPW}' WHERE user_no = 1;" "${DBNAME}"
|
||||||
|
|
||||||
echo "The password for the 'admin' user has been set to '${ADMINPW}'"
|
echo "The password for the 'admin' user has been set to '${ADMINPW}'"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user