Jan Kundrát | e8b1811 | 2018-04-04 23:11:23 +0200 | [diff] [blame] | 1 | CZECHLIGHT_CFG_FS_INSTALL_IMAGES = YES |
Jan Kundrát | de3594f | 2018-05-24 16:28:06 +0200 | [diff] [blame] | 2 | CZECHLIGHT_CFG_FS_DEPENDENCIES = host-e2fsprogs |
Jan Kundrát | e8b1811 | 2018-04-04 23:11:23 +0200 | [diff] [blame] | 3 | |
| 4 | CZECHLIGHT_CFG_FS_LOCATION = $(BINARIES_DIR)/cfg.ext4 |
| 5 | |
| 6 | define 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)) |
| 9 | endef |
| 10 | |
Jan Kundrát | 62dbb4a | 2018-04-05 20:42:09 +0200 | [diff] [blame] | 11 | ifeq ($(BR2_PACKAGE_CZECHLIGHT_CFG_FS)-$(call qstrip,$(CZECHLIGHT_CFG_FS_SIZE)),y-) |
| 12 | $(error CZECHLIGHT_CFG_FS_SIZE cannot be empty) |
| 13 | endif |
| 14 | |
Jan Kundrát | 6b05a1d | 2019-03-06 17:01:28 +0100 | [diff] [blame] | 15 | define CZECHLIGHT_CFG_FS_BUILD_CMDS |
Jan Kundrát | 757863a | 2019-12-05 15:57:55 +0100 | [diff] [blame] | 16 | $(TARGET_CC) $(CZECHLIGHT_CFG_FS_PKGDIR)/czechlight-random-seed.c -o $(@D)/czechlight-random-seed |
Jan Kundrát | 6b05a1d | 2019-03-06 17:01:28 +0100 | [diff] [blame] | 17 | endef |
| 18 | |
Jan Kundrát | 960274e | 2018-04-09 11:20:56 +0200 | [diff] [blame] | 19 | define CZECHLIGHT_CFG_FS_INSTALL_TARGET_CMDS |
Jan Kundrát | 960274e | 2018-04-09 11:20:56 +0200 | [diff] [blame] | 20 | $(INSTALL) -D -m 0755 \ |
Jan Kundrát | 567058d | 2018-11-08 19:15:56 +0100 | [diff] [blame] | 21 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/init-czechlight.sh \ |
| 22 | $(TARGET_DIR)/sbin/init-czechlight.sh |
Jan Kundrát | 757863a | 2019-12-05 15:57:55 +0100 | [diff] [blame] | 23 | $(INSTALL) -D -m 0755 $(@D)/czechlight-random-seed $(TARGET_DIR)/sbin/czechlight-random-seed |
Jan Kundrát | 567058d | 2018-11-08 19:15:56 +0100 | [diff] [blame] | 24 | mkdir -p $(TARGET_DIR)/cfg |
Jan Kundrát | ff8479a | 2018-04-09 12:01:19 +0200 | [diff] [blame] | 25 | $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_SYSREPO),y)) |
Jan Kundrát | de3594f | 2018-05-24 16:28:06 +0200 | [diff] [blame] | 26 | mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
Jan Kundrát | ff8479a | 2018-04-09 12:01:19 +0200 | [diff] [blame] | 27 | $(INSTALL) -D -m 0644 \ |
| 28 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/sysrepo-persistent-cfg.service \ |
| 29 | $(TARGET_DIR)/usr/lib/systemd/system/ |
| 30 | ln -sf ../sysrepo-persistent-cfg.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
| 31 | $(endif) |
Jan Kundrát | d7e9cea | 2018-05-24 18:02:46 +0200 | [diff] [blame] | 32 | $(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_KEYS),y)) |
| 33 | mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
| 34 | $(INSTALL) -D -m 0644 \ |
Jan Kundrát | 1e5dfeb | 2018-09-14 13:40:34 +0200 | [diff] [blame] | 35 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/openssh-persistent-keys.service \ |
| 36 | $(TARGET_DIR)/usr/lib/systemd/system/ |
| 37 | ln -sf ../openssh-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
| 38 | $(INSTALL) -D -m 0644 \ |
Jan Kundrát | d7e9cea | 2018-05-24 18:02:46 +0200 | [diff] [blame] | 39 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/netopeer2-keystored-persistent-keys.service \ |
| 40 | $(TARGET_DIR)/usr/lib/systemd/system/ |
| 41 | ln -sf ../netopeer2-keystored-persistent-keys.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
| 42 | $(endif) |
Jan Kundrát | 960274e | 2018-04-09 11:20:56 +0200 | [diff] [blame] | 43 | endef |
| 44 | |
Jan Kundrát | 86665c4 | 2018-06-06 13:38:22 +0200 | [diff] [blame] | 45 | # Configure OpenSSH to look for *user* keys in the /cfg |
| 46 | define CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH |
| 47 | $(SED) 's|^AuthorizedKeysFile.*|AuthorizedKeysFile /cfg/ssh-user-auth/%u|' $(TARGET_DIR)/etc/ssh/sshd_config |
| 48 | endef |
| 49 | OPENSSH_POST_INSTALL_TARGET_HOOKS += CZECHLIGHT_CFG_FS_OPENSSH_AUTH_PATH_PATCH |
| 50 | |
Jan Kundrát | e8b1811 | 2018-04-04 23:11:23 +0200 | [diff] [blame] | 51 | $(eval $(generic-package)) |