diff --git a/package/skeleton-init-common/skeleton-init-common.mk b/package/skeleton-init-common/skeleton-init-common.mk index 8228a8103f..6a187b54b6 100644 --- a/package/skeleton-init-common/skeleton-init-common.mk +++ b/package/skeleton-init-common/skeleton-init-common.mk @@ -44,8 +44,9 @@ ifneq ($(SKELETON_INIT_COMMON_HOSTNAME),) define SKELETON_INIT_COMMON_SET_HOSTNAME mkdir -p $(TARGET_DIR)/etc echo "$(SKELETON_INIT_COMMON_HOSTNAME)" > $(TARGET_DIR)/etc/hostname - $(SED) '$$a \127.0.1.1\t$(SKELETON_INIT_COMMON_HOSTNAME)' \ - -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts + test -f $(TARGET_DIR)/etc/hosts && $(SED) \ + '$$a \127.0.1.1\t$(SKELETON_INIT_COMMON_HOSTNAME)' \ + -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts || true endef SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_SET_HOSTNAME endif @@ -70,7 +71,7 @@ else # !BR2_TARGET_ENABLE_ROOT_LOGIN SKELETON_INIT_COMMON_ROOT_PASSWORD = "*" endif define SKELETON_INIT_COMMON_SET_ROOT_PASSWD - $(SED) s,^root:[^:]*:,root:$(SKELETON_INIT_COMMON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow + test -f $(TARGET_DIR)/etc/shadow && $(SED) s,^root:[^:]*:,root:$(SKELETON_INIT_COMMON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow || true endef SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_SET_ROOT_PASSWD