1
0
forked from brl/citadel

big refactor of how state is handled on /storage

This commit is contained in:
Bruce Leidl 2018-02-17 17:44:33 -05:00
parent 68a15849be
commit 165b86e4aa
5 changed files with 67 additions and 6 deletions

View File

@ -6,18 +6,35 @@ SRC_URI += "\
file://environment.sh \
file://fstab \
file://99-grsec-debootstrap.conf \
file://00-storage-tmpfiles.conf \
file://NetworkManager.conf \
"
dirs1777_remove = "${localstatedir}/volatile/tmp"
dirs755="/boot /dev /usr/bin /usr/sbin /usr/lib /etc /etc/default /etc/skel /usr/lib /mnt /proc /home/root /run /usr /usr/bin /usr/share/doc/base-files-3.0.14 /usr/include /usr/lib /usr/sbin /usr/share /usr/share/common-licenses /usr/share/info /usr/share/man /usr/share/misc /var /sys /home /media"
volatiles = ""
do_install_append () {
install -m 0755 -d ${D}/storage
install -m 0755 -d ${D}/var/lib/machines
install -d ${D}${libdir}/sysctl.d
install -m 0755 -d ${D}${sysconfdir}/profile.d
install -m 0755 -d ${D}${sysconfdir}/tmpfiles.d
install -m 0755 -d ${D}${sysconfdir}/NetworkManager
install -m 0700 -d ${D}${localstatedir}/lib/NetworkManager
install -m 0700 -d ${D}${localstatedir}/lib/NetworkManager/system-connections
install -m 0644 ${WORKDIR}/locale.conf ${D}${sysconfdir}/locale.conf
install -m 0644 ${WORKDIR}/environment.sh ${D}${sysconfdir}/profile.d/environment.sh
install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
install -m 0644 ${WORKDIR}/00-storage-tmpfiles.conf ${D}${sysconfdir}/tmpfiles.d
install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager
# disable some pax and grsecurity features so that debootstrap will work
# this should be removed later
install -d ${D}${libdir}/sysctl.d
install -m 0644 ${WORKDIR}/99-grsec-debootstrap.conf ${D}${libdir}/sysctl.d/
ln -s /storage/citadel-state/resolv.conf ${D}${sysconfdir}/resolv.conf
ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf
ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf
}

View File

@ -0,0 +1,16 @@
C /var/cache - - - -
C /var/lib/AccountsService - - - -
C /var/lib/NetworkManager - - - -
C /var/lib/colord - - - -
C /var/lib/dbus - - - -
C /var/lib/dhcp - - - -
C /var/lib/gdm - - - -
C /var/lib/plymouth - - - -
C /var/lib/upower - - - -
C /var/log - - - -
C /var/spool - - - -
C /home - - - -
C /home/citadel - - - -
C /home/root - - - -
f /storage/citadel-state/resolv.conf 0644 root root

View File

@ -0,0 +1,4 @@
[main]
[keyfile]
path=/var/lib/NetworkManager/system-connections

View File

@ -1,7 +1,5 @@
/dev/root / auto defaults 1 1
tmpfs /var tmpfs defaults 0 0
/dev/mapper/citadel-storage /storage auto defaults 0 0
/storage/citadel-state/home /home none bind 0 0
/storage/citadel-state/var/log /var/log none bind 0 0
/storage/citadel-state/etc/NetworkManager/system-connections /etc/NetworkManager/system-connections none bind 0 0
/storage/citadel-state/var /var none bind 0 0

View File

@ -6,7 +6,7 @@ SYSTEMD_DEFAULT_TARGET = "graphical.target"
require citadel-image-base.bb
ROOTFS_POSTPROCESS_COMMAND += "set_citadel_user_password; symlink_lib64; "
ROOTFS_POSTPROCESS_COMMAND += "set_citadel_user_password; symlink_lib64; setup_var; "
#IMAGE_FSTYPES += "ext2"
IMAGE_FSTYPES = "ext2"
@ -24,6 +24,32 @@ set_citadel_user_password() {
sed -i 's%^citadel:!:%citadel:aadg8rGtZzOY6:%' ${IMAGE_ROOTFS}/etc/shadow
}
setup_var() {
install -m 0755 -d ${IMAGE_ROOTFS}/usr/share/factory/var
install -m 0755 -d ${IMAGE_ROOTFS}/usr/share/factory/home
install -m 0755 -o 1000 -g 1000 -d ${IMAGE_ROOTFS}/home/citadel/.local/share/applications
mv ${IMAGE_ROOTFS}/var/lib ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/var/log ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/var/cache ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/var/spool ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/var/run ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/var/lock ${IMAGE_ROOTFS}/usr/share/factory/var
mv ${IMAGE_ROOTFS}/home/citadel ${IMAGE_ROOTFS}/usr/share/factory/home
mv ${IMAGE_ROOTFS}/home/root ${IMAGE_ROOTFS}/usr/share/factory/home
# do_rootfs() will fail otherwise
ln -sf ../usr/share/factory/var/lib ${IMAGE_ROOTFS}/var/lib
}
do_rm_var_link() {
rm ${IMAGE_ROOTFS}/var/lib
}
addtask rm_var_link after do_rootfs before do_image_qa
symlink_lib64() {
ln -s /usr/lib ${IMAGE_ROOTFS}/lib64
}