1*4882a593Smuzhiyun################################################################################ 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# skeleton-init-systemd 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun################################################################################ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun# The skeleton can't depend on the toolchain, since all packages depends on the 8*4882a593Smuzhiyun# skeleton and the toolchain is a target package, as is skeleton. 9*4882a593Smuzhiyun# Hence, skeleton would depends on the toolchain and the toolchain would depend 10*4882a593Smuzhiyun# on skeleton. 11*4882a593SmuzhiyunSKELETON_INIT_SYSTEMD_ADD_TOOLCHAIN_DEPENDENCY = NO 12*4882a593SmuzhiyunSKELETON_INIT_SYSTEMD_ADD_SKELETON_DEPENDENCY = NO 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunSKELETON_INIT_SYSTEMD_DEPENDENCIES = skeleton-init-common 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunSKELETON_INIT_SYSTEMD_PROVIDES = skeleton 17*4882a593Smuzhiyun 18*4882a593Smuzhiyunifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) 19*4882a593Smuzhiyun 20*4882a593Smuzhiyundefine SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW 21*4882a593Smuzhiyun echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab 22*4882a593Smuzhiyunendef 23*4882a593Smuzhiyun 24*4882a593Smuzhiyunelse 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun# On a R/O rootfs, /var is a tmpfs filesystem. So, at build time, we 27*4882a593Smuzhiyun# redirect /var to the "factory settings" location. Just before the 28*4882a593Smuzhiyun# filesystem gets created, the /var symlink will be replaced with 29*4882a593Smuzhiyun# a real (but empty) directory, and the "factory files" will be copied 30*4882a593Smuzhiyun# back there by the tmpfiles.d mechanism. 31*4882a593Smuzhiyundefine SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW 32*4882a593Smuzhiyun mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d 33*4882a593Smuzhiyun echo "/dev/root / auto ro 0 1" >$(TARGET_DIR)/etc/fstab 34*4882a593Smuzhiyun echo "tmpfs /var tmpfs mode=1777 0 0" >>$(TARGET_DIR)/etc/fstab 35*4882a593Smuzhiyunendef 36*4882a593Smuzhiyun 37*4882a593Smuzhiyundefine SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR 38*4882a593Smuzhiyun rm -rf $(TARGET_DIR)/usr/share/factory/var 39*4882a593Smuzhiyun mv $(TARGET_DIR)/var $(TARGET_DIR)/usr/share/factory/var 40*4882a593Smuzhiyun mkdir -p $(TARGET_DIR)/var 41*4882a593Smuzhiyun for i in $(TARGET_DIR)/usr/share/factory/var/* \ 42*4882a593Smuzhiyun $(TARGET_DIR)/usr/share/factory/var/lib/* \ 43*4882a593Smuzhiyun $(TARGET_DIR)/usr/share/factory/var/lib/systemd/*; do \ 44*4882a593Smuzhiyun [ -e "$${i}" ] || continue; \ 45*4882a593Smuzhiyun j="$${i#$(TARGET_DIR)/usr/share/factory}"; \ 46*4882a593Smuzhiyun if [ -L "$${i}" ]; then \ 47*4882a593Smuzhiyun printf "L+! %s - - - - %s\n" \ 48*4882a593Smuzhiyun "$${j}" "../usr/share/factory/$${j}" \ 49*4882a593Smuzhiyun || exit 1; \ 50*4882a593Smuzhiyun else \ 51*4882a593Smuzhiyun printf "C! %s - - - -\n" "$${j}" \ 52*4882a593Smuzhiyun || exit 1; \ 53*4882a593Smuzhiyun fi; \ 54*4882a593Smuzhiyun done >$(TARGET_DIR)/etc/tmpfiles.d/var-factory.conf 55*4882a593Smuzhiyunendef 56*4882a593SmuzhiyunSKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_PRE_ROOTFS_VAR 57*4882a593Smuzhiyun 58*4882a593Smuzhiyunendif 59*4882a593Smuzhiyun 60*4882a593Smuzhiyundefine SKELETON_INIT_SYSTEMD_INSTALL_TARGET_CMDS 61*4882a593Smuzhiyun mkdir -p $(TARGET_DIR)/home 62*4882a593Smuzhiyun mkdir -p $(TARGET_DIR)/srv 63*4882a593Smuzhiyun mkdir -p $(TARGET_DIR)/var 64*4882a593Smuzhiyun ln -s ../run $(TARGET_DIR)/var/run 65*4882a593Smuzhiyun $(SKELETON_INIT_SYSTEMD_ROOT_RO_OR_RW) 66*4882a593Smuzhiyunendef 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun$(eval $(generic-package)) 69