sudo: don't use hardening flags on host tools
[buildroot-gz.git] / system / system.mk
blobb6146158daf5c11724f0821f11c265e42ccda3be
1 TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
2 TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
3 TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
4 TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD))
5 TARGET_GENERIC_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
6 TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
7 TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
8 TARGET_GENERIC_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
10 ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
11 define SYSTEM_SECURETTY
12 grep -q '^$(TARGET_GENERIC_GETTY_PORT)$$' $(TARGET_DIR)/etc/securetty || \
13 echo '$(TARGET_GENERIC_GETTY_PORT)' >> $(TARGET_DIR)/etc/securetty
14 endef
15 TARGET_FINALIZE_HOOKS += SYSTEM_SECURETTY
16 endif
18 ifneq ($(TARGET_GENERIC_HOSTNAME),)
19 define SYSTEM_HOSTNAME
20 mkdir -p $(TARGET_DIR)/etc
21 echo "$(TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
22 $(SED) '$$a \127.0.1.1\t$(TARGET_GENERIC_HOSTNAME)' \
23 -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
24 endef
25 TARGET_FINALIZE_HOOKS += SYSTEM_HOSTNAME
26 endif
28 ifneq ($(TARGET_GENERIC_ISSUE),)
29 define SYSTEM_ISSUE
30 mkdir -p $(TARGET_DIR)/etc
31 echo "$(TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
32 endef
33 TARGET_FINALIZE_HOOKS += SYSTEM_ISSUE
34 endif
36 ifneq ($(TARGET_GENERIC_ROOT_PASSWD),)
37 TARGETS += host-mkpasswd
38 endif
40 ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
42 define SYSTEM_ROOT_PASSWD
43 [ -n "$(TARGET_GENERIC_ROOT_PASSWD)" ] && \
44 TARGET_GENERIC_ROOT_PASSWD_HASH=$$($(MKPASSWD) -m "$(TARGET_GENERIC_PASSWD_METHOD)" "$(TARGET_GENERIC_ROOT_PASSWD)"); \
45 $(SED) "s,^root:[^:]*:,root:$$TARGET_GENERIC_ROOT_PASSWD_HASH:," $(TARGET_DIR)/etc/shadow
46 endef
47 TARGET_FINALIZE_HOOKS += SYSTEM_ROOT_PASSWD
49 ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
50 ifeq ($(BR2_PACKAGE_SYSVINIT),y)
51 # In sysvinit inittab, the "id" must not be longer than 4 bytes, so we
52 # skip the "tty" part and keep only the remaining.
53 define SYSTEM_GETTY
54 $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_OPTIONS) $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \
55 $(TARGET_DIR)/etc/inittab
56 endef
57 else
58 # Add getty to busybox inittab
59 define SYSTEM_GETTY
60 $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(TARGET_GENERIC_GETTY_PORT)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY_OPTIONS) $(TARGET_GENERIC_GETTY_PORT) $(TARGET_GENERIC_GETTY_BAUDRATE) $(TARGET_GENERIC_GETTY_TERM) #~' \
61 $(TARGET_DIR)/etc/inittab
62 endef
63 endif
64 TARGET_FINALIZE_HOOKS += SYSTEM_GETTY
65 endif
67 ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
68 # Find commented line, if any, and remove leading '#'s
69 define SYSTEM_REMOUNT_RW
70 $(SED) '/^#.*# REMOUNT_ROOTFS_RW$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
71 endef
72 else
73 # Find uncommented line, if any, and add a leading '#'
74 define SYSTEM_REMOUNT_RW
75 $(SED) '/^[^#].*# REMOUNT_ROOTFS_RW$$/s~^~#~' $(TARGET_DIR)/etc/inittab
76 endef
77 endif
78 TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_RW
80 endif # BR2_ROOTFS_SKELETON_DEFAULT