From ce96acc308af66831bd9e1441e75c90aa9e6820f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 7 Jul 2013 19:58:51 -0400 Subject: Further rework of layout for new OSTree layout Add tmpfiles from gnome-ostree-integration as a temporary hack. --- make-fedora-ostree-tarball | 75 ++++++++++++++++++++++++++++++++++++++++------ tmpfiles-gnome-ostree.conf | 17 +++++++++++ 2 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 tmpfiles-gnome-ostree.conf diff --git a/make-fedora-ostree-tarball b/make-fedora-ostree-tarball index 683c53a..823fa50 100755 --- a/make-fedora-ostree-tarball +++ b/make-fedora-ostree-tarball @@ -21,15 +21,72 @@ yum -c ${srcdir}/fedora-ostree.repo -y --releasever=${releasever} --nogpg --inst if test "${mfotbreak}" = "post-yum"; then bash fi -# To have OSTree work, directories need to be writable by the user. -# Also, there's no point in shipping private files; there's no -# security on OSTree repositories, so make everything at least -# readable. -chmod -R u+rw,go+r ${root} - -# These two bits are expected to be visible at the OS/ by OSTree. -mkdir -p ${root}/sysroot -ln -s sysroot/ostree ${root}/ostree + +# Now make an empty "real" root +rm ${root}.real -rf +mkdir ${root}.real +cd ${root}.real + +for d in dev proc run sys var; do + mkdir $d +done + +# Special ostree mount +mkdir sysroot + +# Some FHS targets; these all live in /var +ln -s var/opt opt +ln -s var/srv srv +ln -s var/mnt mnt +ln -s var/roothome root + +# This one is dynamic, so just lives in /run +ln -s run/media media + +# Special OSTree link, so it's /ostree both on +# the real disk and inside the chroot. +ln -s sysroot/ostree ostree + +# /tmp is always /sysroot/tmp +ln -s sysroot/tmp tmp + +# By default, /home -> var/home -> ../sysroot/home +ln -s var/home home + +# These are the only directories we take from the Fedora build +mv ${root}/usr . +# Except /usr/local -> ../var/usrlocal +rm usr/local -rf +ln -s ../var/usrlocal usr/local +# And /etc -> /usr/etc +rm usr/etc -rf +mv ${root}/etc usr/etc + +# Move boot, but rename the kernel/initramfs to have a checksum +mv ${root}/boot . +kernel=$(ls boot/vmlinuz-3*) +initramfs=$(ls boot/initramfs-3*) +bootcsum=$(cat ${kernel} ${initramfs} | sha256sum | cut -f 1 -d ' ') +mv ${kernel} ${kernel}-${bootcsum} +mv ${initramfs} ${initramfs}-${bootcsum} + +# Also move the toplevel compat links +mv ${root}/lib . +if test -L ${root}/lib64; then + mv ${root}/lib64 . +fi +mv ${root}/bin . +mv ${root}/sbin . + +mkdir -p usr/lib/tmpfiles.d +cp $(srcdir)/tmpfiles-gnome-ostree.conf usr/lib/tmpfiles.d + +# Ok, let's globally fix permissions in the Fedora content; +# everything is root owned, all directories are u=rwx,g=rx,og=rx. +chown -R -h 0:0 usr etc boot +for x in usr etc boot; do + find $x -type d -exec chmod u=rwx,g=rx,og=rx "{}" \; +done if test -d ${yumcachedir}; then mv ${yumcachedir} ${yumcache_lookaside} diff --git a/tmpfiles-gnome-ostree.conf b/tmpfiles-gnome-ostree.conf new file mode 100644 index 0000000..23e0f1d --- /dev/null +++ b/tmpfiles-gnome-ostree.conf @@ -0,0 +1,17 @@ +d /var/log/journal 0755 root root - +L /var/home - - - - ../sysroot/home +d /var/opt 0755 root root - +d /var/srv 0755 root root - +d /var/roothome 0700 root root - +d /var/usrlocal 0755 root root - +d /var/usrlocal/bin 0755 root root - +d /var/usrlocal/etc 0755 root root - +d /var/usrlocal/games 0755 root root - +d /var/usrlocal/include 0755 root root - +d /var/usrlocal/lib 0755 root root - +d /var/usrlocal/man 0755 root root - +d /var/usrlocal/sbin 0755 root root - +d /var/usrlocal/share 0755 root root - +d /var/usrlocal/src 0755 root root - +d /var/mnt 0755 root root - +d /run/media 0755 root root - -- cgit