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#518hfreyther/master-next
parent
0172c5958a
commit
7aba3280c5
@ -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…
Reference in new issue