mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
skeleton-init-commom: do not assume /etc/hosts and /etc/shadow exist
This commit is contained in:
parent
670925a6a5
commit
89851a1334
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user