skeleton: use backtick instead of $(shell ...) make function
authorArnout Vandecappelle <arnout@mind.be>
Sun, 12 Jul 2015 14:35:30 +0000 (16:35 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 14 Jul 2015 22:43:39 +0000 (00:43 +0200)
Only the instance for setting the root password is changed. The
instance in SYSTEM_GETTY is harmless since it just uses echo and tail.

If SKELETON_TARGET_GENERIC_ROOT_PASSWD is passed as a hashed password
by the user, it contains $, so the '-quotes are needed. If it is not,
we need the backtick to be expanded so "-quotes are needed. Therefore,
the quoting is moved to the definition of SYSTEM_ROOT_PASSWORD.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/skeleton/skeleton.mk

index 70d1258d1e55f7d96091a5e0408aea4f3025cb1d..48e708515d669a7eba266e5b1a7a2876b6584abf 100644 (file)
@@ -95,19 +95,19 @@ ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
 ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
 SYSTEM_ROOT_PASSWORD =
 else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),)
-SYSTEM_ROOT_PASSWORD = $(SKELETON_TARGET_GENERIC_ROOT_PASSWD)
+SYSTEM_ROOT_PASSWORD = '$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)'
 else
 SKELETON_DEPENDENCIES += host-mkpasswd
 # This variable will only be evaluated in the finalize stage, so we can
 # be sure that host-mkpasswd will have already been built by that time.
-SYSTEM_ROOT_PASSWORD = $(shell $(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)")
+SYSTEM_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"
 endif
 else # !BR2_TARGET_ENABLE_ROOT_LOGIN
-SYSTEM_ROOT_PASSWORD = *
+SYSTEM_ROOT_PASSWORD = "*"
 endif
 
 define SKELETON_SYSTEM_SET_ROOT_PASSWD
-       $(SED) 's,^root:[^:]*:,root:$(SYSTEM_ROOT_PASSWORD):,' $(TARGET_DIR)/etc/shadow
+       $(SED) s,^root:[^:]*:,root:$(SYSTEM_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
 endef
 TARGET_FINALIZE_HOOKS += SKELETON_SYSTEM_SET_ROOT_PASSWD