33 lines
578 B
Bash
Executable File
33 lines
578 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Password change tool.
|
|
#
|
|
|
|
. /opt/puzzlefw/lib/functions.sh
|
|
|
|
# Store changed password on the SD card.
|
|
store_password() {
|
|
|
|
# Lock to avoid conflicting changes.
|
|
lock_config || exit 1
|
|
|
|
echo "Writing new password to SD card ..."
|
|
|
|
grep "^root:" /etc/shadow > ${CONFIG_DIR}/passwd.conf.new
|
|
sync_config passwd.conf || exit 1
|
|
}
|
|
|
|
if [ $# -ne 0 ]; then
|
|
script="${0##*/}"
|
|
cat <<EOF
|
|
Usage: $script
|
|
|
|
Change root password and write the new password hash to the SD card
|
|
to make it persistent accross reboot.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
passwd && store_password
|
|
|