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