blob: a0c2e8c1d1235a647efba993810148e0044565dd [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át05ff1d82018-06-14 16:32:01 +020016 $(INSTALL) -D -m 0644 \
17 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/etc-fstab \
18 $(TARGET_DIR)/etc/fstab
Jan Kundrátde3594f2018-05-24 16:28:06 +020019 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
Jan Kundrát960274e2018-04-09 11:20:56 +020020 $(INSTALL) -D -m 0644 \
21 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/etc-overlay.service \
22 $(TARGET_DIR)/usr/lib/systemd/system/etc-overlay.service
23 ln -sf ../etc-overlay.service $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
Jan Kundrátde3594f2018-05-24 16:28:06 +020024 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system-generators/
Jan Kundrát960274e2018-04-09 11:20:56 +020025 $(INSTALL) -D -m 0755 \
26 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/czechlight-cfg-mount-generator \
27 $(TARGET_DIR)/usr/lib/systemd/system-generators/czechlight-cfg-mount-generator
28 $(INSTALL) -D -m 0644 \
29 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/cfg-restore-etc.service \
30 $(TARGET_DIR)/usr/lib/systemd/system/cfg-restore-etc.service
31 ln -sf ../cfg-restore-etc.service $(TARGET_DIR)/usr/lib/systemd/system/local-fs.target.wants/
Jan Kundrátff8479a2018-04-09 12:01:19 +020032 $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_SYSREPO),y))
Jan Kundrátde3594f2018-05-24 16:28:06 +020033 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
Jan Kundrátff8479a2018-04-09 12:01:19 +020034 $(INSTALL) -D -m 0644 \
35 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/sysrepo-persistent-cfg.service \
36 $(TARGET_DIR)/usr/lib/systemd/system/
37 ln -sf ../sysrepo-persistent-cfg.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
38 $(endif)
Jan Kundrátd7e9cea2018-05-24 18:02:46 +020039 $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_KEYS),y))
40 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
41 $(INSTALL) -D -m 0644 \
42 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service \
43 $(TARGET_DIR)/usr/lib/systemd/system/
44 ln -sf ../netopeer2-keystored-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
45 $(endif)
Jan Kundrát960274e2018-04-09 11:20:56 +020046endef
47
Jan Kundrát86665c42018-06-06 13:38:22 +020048# Configure OpenSSH to look for *user* keys in the /cfg
49define CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH
50 $(SED) 's|^AuthorizedKeysFile.*|AuthorizedKeysFile /cfg/ssh-user-auth/%u|' $(TARGET_DIR)/etc/ssh/sshd_config
51endef
52OPENSSH_POST_INSTALL_TARGET_HOOKS += CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH
53
Jan Kundráte8b18112018-04-04 23:11:23 +020054$(eval $(generic-package))