diff --git a/files/etc.mount b/files/etc.mount deleted file mode 100644 index 7501f78a5558abc902d0ecdaafad1353fe8fd083..0000000000000000000000000000000000000000 --- a/files/etc.mount +++ /dev/null @@ -1,26 +0,0 @@ -## Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. - # KubeOS is licensed under the Mulan PSL v2. - # You can use this software according to the terms and conditions of the Mulan PSL v2. - # You may obtain a copy of Mulan PSL v2 at: - # http://license.coscl.org.cn/MulanPSL2 - # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR - # IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR - # PURPOSE. -## See the Mulan PSL v2 for more details. - -[Unit] -Description=etc Dir -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target -Wants=persist.mount -After=persist.mount - -[Mount] -What=overlay -Where=/etc -Type=overlay -Options=upperdir=/persist/etc,lowerdir=/etc,workdir=/persist/etcwork - -[Install] -WantedBy=local-fs.target diff --git a/files/persist.mount b/files/persist.mount deleted file mode 100644 index edc46d2b13bcd423c369ae7516ff49dd63c734b3..0000000000000000000000000000000000000000 --- a/files/persist.mount +++ /dev/null @@ -1,24 +0,0 @@ -## Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. - # KubeOS is licensed under the Mulan PSL v2. - # You can use this software according to the terms and conditions of the Mulan PSL v2. - # You may obtain a copy of Mulan PSL v2 at: - # http://license.coscl.org.cn/MulanPSL2 - # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR - # IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR - # PURPOSE. -## See the Mulan PSL v2 for more details. - -[Unit] -Description=PERSIST Dir (/persist) -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target - -[Mount] -What=/dev/disk/by-label/PERSIST -Where=/persist -Type=ext4 -Options=defaults - -[Install] -WantedBy=local-fs.target diff --git a/files/var.mount b/files/var.mount deleted file mode 100644 index 4343207d007da47c235286b91ae9be61242825df..0000000000000000000000000000000000000000 --- a/files/var.mount +++ /dev/null @@ -1,26 +0,0 @@ -## Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. - # KubeOS is licensed under the Mulan PSL v2. - # You can use this software according to the terms and conditions of the Mulan PSL v2. - # You may obtain a copy of Mulan PSL v2 at: - # http://license.coscl.org.cn/MulanPSL2 - # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR - # IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR - # PURPOSE. -## See the Mulan PSL v2 for more details. - -[Unit] -Description=var Dir -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target -Wants=persist.mount -After=persist.mount - -[Mount] -What=/persist/var -Where=/var -Type=node -Options=bind - -[Install] -WantedBy=local-fs.target diff --git a/scripts/00bootup/10-mount-etc.sh b/scripts/00bootup/10-mount-etc.sh new file mode 100644 index 0000000000000000000000000000000000000000..65a1cdf431f39728114b92d9241d27f89c569c03 --- /dev/null +++ b/scripts/00bootup/10-mount-etc.sh @@ -0,0 +1,4 @@ +mount -t ext4 /dev/disk/by-label/PERSIST /sysroot/persist +mount -t overlay -o upperdir=/sysroot/persist/etc,lowerdir=/sysroot/etc,workdir=/sysroot/persist/etcwork overlay /sysroot/etc + +mount --bind /sysroot/persist/var /sysroot/var \ No newline at end of file diff --git a/scripts/set_in_chroot.sh b/scripts/set_in_chroot.sh index 80b5a91b851824cfb6ec42b8d40ebf86fe67f2b9..b83cec557e19780950e24ff821d923ba98db0883 100644 --- a/scripts/set_in_chroot.sh +++ b/scripts/set_in_chroot.sh @@ -6,7 +6,6 @@ if [ "$BOOT_MODE" = "legacy" ]; then else ln -s /usr/lib/systemd/system/boot-efi.mount /lib/systemd/system/local-fs.target.wants/boot-efi.mount fi -ln -s /usr/lib/systemd/system/etc.mount /lib/systemd/system/local-fs.target.wants/etc.mount str=`sed -n '/^root:/p' /etc/shadow | awk -F "root:" '{print $2}'` umask 0666 @@ -16,5 +15,13 @@ echo "root:"${ROOT_PWD}${str:1} > /etc/shadow cat /etc/shadow_bak >> /etc/shadow rm -rf /etc/shadow_bak -dracut -f -v --add bootup /initramfs.img --kver `ls /lib/modules` -rm -rf /usr/lib/dracut/modules.d/00bootup \ No newline at end of file +# move the 10-mount-etc.sh out +mv /usr/lib/dracut/modules.d/00bootup/10-mount-etc.sh / + +# make initramfs.img for baremetal PXE mode +dracut -f -v --add bootup /initramfs.img --include /10-mount-etc.sh /usr/lib/dracut/hooks/pre-pivot/10-mount-etc.sh --kver `ls /lib/modules` + +# make initramfs.img for vms +rm -f /boot/initramfs.img +dracut -f -v /boot/initramfs.img --include /10-mount-etc.sh /usr/lib/dracut/hooks/pre-pivot/10-mount-etc.sh --force --kver `ls /lib/modules` +rm -rf /usr/lib/dracut/modules.d/00bootup /10-mount-etc.sh \ No newline at end of file