meta-digi-dey: use 'extrausers' class to set root password
This simplifies the code and as an extra allows to override the default root password from the project's local.conf (setting MD5_ROOT_PASSWD variable) https://jira.digi.com/browse/DEL-1558 Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
ef92164fb2
commit
7f3e1a4d1a
|
|
@ -7,26 +7,17 @@
|
|||
#
|
||||
inherit image-buildinfo
|
||||
|
||||
## DEY rootfs final tuning
|
||||
dey_rootfs_tuning() {
|
||||
#######################################################################
|
||||
## Set root password to 'root' if 'debug-tweaks' is NOT enabled.
|
||||
## command: echo -n 'root' | mkpasswd -5 -s
|
||||
#######################################################################
|
||||
MD5_ROOT_PASSWD='$1$SML0de4S$lOWs3t82QAH0oEf8NyNKA0'
|
||||
if echo "${IMAGE_FEATURES}" | grep -qs debug-tweaks; then
|
||||
: # No-op
|
||||
else
|
||||
# Shadow passwords ENABLED
|
||||
if [ -f "${IMAGE_ROOTFS}/etc/shadow" ]; then
|
||||
sed 's%^root:[^:]*:%root:x:%' <${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
|
||||
sed "s%^root:[^:]*:%root:${MD5_ROOT_PASSWD}:%" <${IMAGE_ROOTFS}/etc/shadow >${IMAGE_ROOTFS}/etc/shadow.new
|
||||
mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
|
||||
mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow
|
||||
# Shadow passwords DISABLED
|
||||
else
|
||||
sed "s%^root:[^:]*:%root:${MD5_ROOT_PASSWD}:%" <${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
|
||||
mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
|
||||
fi
|
||||
fi
|
||||
}
|
||||
#
|
||||
# Set root password using 'extrausers' class if 'debug-tweaks' is NOT enabled
|
||||
#
|
||||
# To get the encrypted password (with escaped '$' char: '\$') run following
|
||||
# command in your development computer:
|
||||
#
|
||||
# echo -n 'root' | mkpasswd -5 -s | sed -e 's,\$,\\$,g'
|
||||
#
|
||||
inherit ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "", "extrausers",d)}
|
||||
|
||||
MD5_ROOT_PASSWD ?= "\$1\$SML0de4S\$lOWs3t82QAH0oEf8NyNKA0"
|
||||
EXTRA_USERS_PARAMS += "\
|
||||
usermod -p '${MD5_ROOT_PASSWD}' root; \
|
||||
"
|
||||
|
|
|
|||
|
|
@ -41,5 +41,3 @@ IMAGE_ROOTFS_SIZE = "8192"
|
|||
|
||||
# Do not install udev-cache
|
||||
BAD_RECOMMENDATIONS += "udev-cache"
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND += "dey_rootfs_tuning;"
|
||||
|
|
|
|||
|
|
@ -31,4 +31,3 @@ IMAGE_FSTYPES_remove = "ext4"
|
|||
IMAGE_FSTYPES_append = " ext2"
|
||||
|
||||
BAD_RECOMMENDATIONS += "busybox-syslog"
|
||||
ROOTFS_POSTPROCESS_COMMAND += "dey_rootfs_tuning;"
|
||||
|
|
|
|||
Loading…
Reference in New Issue