Browse Source

recipes: add functions for generating a rootpasswd

The rootpassword can be set via the
enviroment variable ROOT_PASS either in
the local.conf or on the cmdline
before bitbake.

Fixes: partly SYS#518
hfreyther/master-next
Henning Heinold 7 years ago
committed by Henning
parent
commit
7aba3280c5
  1. 16
      recipes-apps/images/image-passwd.inc

16
recipes-apps/images/image-passwd.inc

@ -0,0 +1,16 @@
DEPENDS += "openssl-native"
rootpasswd = "${@d.getVar('ROOT_PASS', True) or ""}"
ROOTFS_POSTPROCESS_COMMAND += "set_root_passwd;"
set_root_passwd() {
if [ -n "${rootpasswd}" ]; then
HASHED_PASS=`openssl passwd -1 ${rootpasswd}`
if [ -n "${HASHED_PASS}" ]; then
sed -e "s%^root:[^:]*:%root:${HASHED_PASS}:%" \
-i ${IMAGE_ROOTFS}/etc/shadow
echo "Generated new root-passwd"
fi
fi
}
Loading…
Cancel
Save