blob: 98ca80c4f2e82f751bcd3f19c126ac5cbad5f730 [file] [log] [blame]
Jan Kundráte8b18112018-04-04 23:11:23 +02001CZECHLIGHT_CFG_FS_INSTALL_IMAGES = YES
Jan Kundrátde3594f2018-05-24 16:28:06 +02002CZECHLIGHT_CFG_FS_DEPENDENCIES = host-e2fsprogs
Jan Kundráte8b18112018-04-04 23:11:23 +02003
4CZECHLIGHT_CFG_FS_LOCATION = $(BINARIES_DIR)/cfg.ext4
5
6define CZECHLIGHT_CFG_FS_INSTALL_IMAGES_CMDS
7 rm -f $(CZECHLIGHT_CFG_FS_LOCATION)
8 $(HOST_DIR)/sbin/mkfs.ext4 -L cfg $(CZECHLIGHT_CFG_FS_LOCATION) $(call qstrip,$(CZECHLIGHT_CFG_FS_SIZE))
9endef
10
Jan Kundrát62dbb4a2018-04-05 20:42:09 +020011ifeq ($(BR2_PACKAGE_CZECHLIGHT_CFG_FS)-$(call qstrip,$(CZECHLIGHT_CFG_FS_SIZE)),y-)
12$(error CZECHLIGHT_CFG_FS_SIZE cannot be empty)
13endif
14
Jan Kundrát960274e2018-04-09 11:20:56 +020015define CZECHLIGHT_CFG_FS_INSTALL_TARGET_CMDS
Jan Kundrát960274e2018-04-09 11:20:56 +020016 $(INSTALL) -D -m 0755 \
Jan Kundrát567058d2018-11-08 19:15:56 +010017 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/init-czechlight.sh \
18 $(TARGET_DIR)/sbin/init-czechlight.sh
19 mkdir -p $(TARGET_DIR)/cfg
Jan Kundrátff8479a2018-04-09 12:01:19 +020020 $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_SYSREPO),y))
Jan Kundrátde3594f2018-05-24 16:28:06 +020021 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
Jan Kundrátff8479a2018-04-09 12:01:19 +020022 $(INSTALL) -D -m 0644 \
23 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/sysrepo-persistent-cfg.service \
24 $(TARGET_DIR)/usr/lib/systemd/system/
25 ln -sf ../sysrepo-persistent-cfg.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
26 $(endif)
Jan Kundrátd7e9cea2018-05-24 18:02:46 +020027 $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_KEYS),y))
28 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
29 $(INSTALL) -D -m 0644 \
Jan Kundrát1e5dfeb2018-09-14 13:40:34 +020030 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/openssh-persistent-keys.service \
31 $(TARGET_DIR)/usr/lib/systemd/system/
32 ln -sf ../openssh-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
33 $(INSTALL) -D -m 0644 \
Jan Kundrátd7e9cea2018-05-24 18:02:46 +020034 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service \
35 $(TARGET_DIR)/usr/lib/systemd/system/
36 ln -sf ../netopeer2-keystored-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
37 $(endif)
Jan Kundrát960274e2018-04-09 11:20:56 +020038endef
39
Jan Kundrát86665c42018-06-06 13:38:22 +020040# Configure OpenSSH to look for *user* keys in the /cfg
41define CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH
42 $(SED) 's|^AuthorizedKeysFile.*|AuthorizedKeysFile /cfg/ssh-user-auth/%u|' $(TARGET_DIR)/etc/ssh/sshd_config
43endef
44OPENSSH_POST_INSTALL_TARGET_HOOKS += CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH
45
Jan Kundráte8b18112018-04-04 23:11:23 +020046$(eval $(generic-package))