azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

bring filesystem package inline with Fedora (i.e. don't include files in the filesystem package)

Open ddstreetmicrosoft opened this issue 1 year ago • 6 comments

Move the files contained in the filesystem package out into the appropriate separate packages (mostly the setup package), and update the filesystem package to use Fedora packaging.

Fixes: #6927

ddstreetmicrosoft avatar Mar 08 '24 15:03 ddstreetmicrosoft

Just marking this change as "Request Changes" to hold it until we get a stable build for preview. I'm not sure how necessary it is for that. Happy to discuss offline if you think my reasoning is incorrect.

just waiting on your go ahead to merge.

ddstreetmicrosoft avatar Mar 13 '24 09:03 ddstreetmicrosoft

And here is the diff between our current filesystem scripts and the updated filesystem scripts:

--- /tmp/filesystem-scripts-a	2024-03-13 11:25:20.133313074 +0000
+++ /tmp/filesystem-scripts-b	2024-03-13 11:25:25.657308939 +0000
@@ -1,14 +1,46 @@
 pretrans scriptlet (using <lua>):
+--# If we are running in pretrans in a fresh root, there is no /usr and
+--# symlinks. We cannot be sure, to be the very first rpm in the
+--# transaction list. Let's create the needed base directories and symlinks
+--# here, to place the files from other packages in the right locations.
+--# When our rpm is unpacked by cpio, it will set all permissions and modes
+--# later.
+posix.mkdir("/usr")
+posix.mkdir("/usr/bin")
+posix.mkdir("/usr/sbin")
+posix.mkdir("/usr/lib")
+posix.mkdir("/usr/lib/debug")
+posix.mkdir("/usr/lib/debug/usr/")
+posix.mkdir("/usr/lib/debug/usr/bin")
+posix.mkdir("/usr/lib/debug/usr/sbin")
+posix.mkdir("/usr/lib/debug/usr/lib")
+posix.mkdir("/usr/lib/debug/usr/lib")
+posix.mkdir("/usr/lib")
+posix.symlink("usr/bin", "/bin")
+posix.symlink("usr/sbin", "/sbin")
+posix.symlink("usr/lib", "/lib")
+posix.symlink("usr/bin", "/usr/lib/debug/bin")
+posix.symlink("usr/lib", "/usr/lib/debug/lib")
+posix.symlink("usr/lib", "/usr/lib/debug/lib")
+posix.symlink("../.dwz", "/usr/lib/debug/usr/.dwz")
+posix.symlink("usr/sbin", "/usr/lib/debug/sbin")
+posix.symlink("usr/lib", "/lib")
+posix.mkdir("/run")
 posix.mkdir("/proc")
 posix.mkdir("/sys")
 posix.chmod("/proc", 0555)
 posix.chmod("/sys", 0555)
+st = posix.stat("/media")
+if st and st.type == "link" then
+  os.remove("/media")
+end
+posix.mkdir("/var")
+posix.symlink("../run", "/var/run")
+posix.symlink("../run/lock", "/var/lock")
 return 0
-postinstall scriptlet (using <lua>):
-posix.symlink("lib", "/usr/lib/debug/lib64")
-posix.symlink("../bin", "/usr/lib/debug/usr/bin")
-posix.symlink("../sbin", "/usr/lib/debug/usr/sbin")
-posix.symlink("../lib", "/usr/lib/debug/usr/lib")
-posix.symlink("../lib", "/usr/lib/debug/usr/lib64")
-posix.symlink("../.dwz", "/usr/lib/debug/usr/.dwz")
-return 0
+posttrans scriptlet (using <lua>):
+--# we need to restorecon on some dirs created in %pretrans or by other packages
+if posix.access ("/usr/sbin/restorecon", "x") then
+  rpm.execute("/usr/sbin/restorecon", "/var", "/var/run", "/var/lock", "/sys", "/boot", "/dev", "/media", "/afs")
+  rpm.execute("/usr/sbin/restorecon", "-r", "/usr/lib/debug")
+end

ddstreetmicrosoft avatar Mar 13 '24 11:03 ddstreetmicrosoft

+posix.symlink("usr/lib", "/usr/lib/debug/lib") +posix.symlink("usr/lib", "/usr/lib/debug/lib")

Note that our mis-assignment of %_lib as lib instead of lib64 causes duplicate entries for lib (and leaves out entries for lib64). I was going to fix this in #8152 but left it in with just a comment added, but I really think we need to fix it before 3.0 GA.

-posix.symlink("../lib", "/usr/lib/debug/usr/lib") -posix.symlink("../lib", "/usr/lib/debug/usr/lib64")

ddstreetmicrosoft avatar Mar 13 '24 11:03 ddstreetmicrosoft

I was going to fix this in #8152 but left it in with just a comment added

specifically, https://github.com/microsoft/azurelinux/pull/8152/commits/45333481f6cbb4295bf57648277efe3036e70a92

ddstreetmicrosoft avatar Mar 13 '24 11:03 ddstreetmicrosoft

and files diff (with each listing edited to remove differing sizes and timestamps):

--- /tmp/filesystem-a	2024-03-13 11:37:13.616858549 +0000
+++ /tmp/filesystem-b	2024-03-13 11:37:24.168851966 +0000
@@ -1,121 +1,193 @@
+dr-xr-xr-x    2 root     root            /
+dr-xr-xr-x    2 root     root            /afs
 lrwxrwxrwx    1 root     root            /bin -> usr/bin
-drwx------    2 root     root            /boot
+dr-xr-xr-x    2 root     root            /boot
 drwxr-xr-x    2 root     root            /dev
 drwxr-xr-x    2 root     root            /etc
--rw-r--r--    1 root     root            /etc/fstab
--rw-r--r--    1 root     root            /etc/group
--rw-r--r--    1 root     root            /etc/host.conf
--rw-r--r--    1 root     root            /etc/hosts
--rw-r--r--    1 root     root            /etc/inputrc
-drwxr-xr-x    2 root     root            /etc/modprobe.d
--rw-r--r--    1 root     root            /etc/modprobe.d/usb.conf
-lrwxrwxrwx    1 root     root            /etc/mtab -> /proc/self/mounts
+drwxr-xr-x    2 root     root            /etc/X11
+drwxr-xr-x    2 root     root            /etc/X11/applnk
+drwxr-xr-x    2 root     root            /etc/X11/fontpath.d
+drwxr-xr-x    2 root     root            /etc/X11/xinit
+drwxr-xr-x    2 root     root            /etc/X11/xinit/xinitrc.d
+drwxr-xr-x    2 root     root            /etc/X11/xinit/xinput.d
+drwxr-xr-x    2 root     root            /etc/bash_completion.d
+drwxr-xr-x    2 root     root            /etc/keys
+drwxr-xr-x    2 root     root            /etc/keys/ima
 drwxr-xr-x    2 root     root            /etc/opt
--rw-r--r--    1 root     root            /etc/passwd
--rw-r--r--    1 root     root            /etc/profile
-drwxr-xr-x    2 root     root            /etc/profile.d
--rw-r--r--    1 root     root            /etc/profile.d/proxy.sh
+drwxr-xr-x    2 root     root            /etc/pki
+drwxr-xr-x    2 root     root            /etc/pm
+drwxr-xr-x    2 root     root            /etc/pm/config.d
+drwxr-xr-x    2 root     root            /etc/pm/power.d
+drwxr-xr-x    2 root     root            /etc/pm/sleep.d
+drwxr-xr-x    2 root     root            /etc/rwtab.d
+drwxr-xr-x    2 root     root            /etc/skel
+drwxr-xr-x    2 root     root            /etc/statetab.d
 drwxr-xr-x    2 root     root            /etc/sysconfig
--rw-r--r--    1 root     root            /etc/sysconfig/clock
--rw-r--r--    1 root     root            /etc/sysconfig/console
--rw-r--r--    1 root     root            /etc/sysconfig/proxy
+drwxr-xr-x    2 root     root            /etc/xdg
+drwxr-xr-x    2 root     root            /etc/xdg/autostart
 drwxr-xr-x    2 root     root            /home
 lrwxrwxrwx    1 root     root            /lib -> usr/lib
-lrwxrwxrwx    1 root     root            /lib64 -> usr/lib
 drwxr-xr-x    2 root     root            /media
 drwxr-xr-x    2 root     root            /mnt
-drwxr-xr-x    2 root     root            /mnt/cdrom
-drwxr-xr-x    2 root     root            /mnt/hgfs
 drwxr-xr-x    2 root     root            /opt
 -r-xr-xr-x    1 root     root            /proc
-drwxr-x---    2 root     root            /root
+dr-xr-x---    2 root     root            /root
 drwxr-xr-x    2 root     root            /run
-drwxr-xr-x    2 root     root            /run/lock
-drwxr-xr-x    2 root     root            /run/media/cdrom
-drwxr-xr-x    2 root     root            /run/media/floppy
 lrwxrwxrwx    1 root     root            /sbin -> usr/sbin
-lrwxrwxrwx    1 root     root            /srv -> var/srv
+drwxr-xr-x    2 root     root            /srv
 -r-xr-xr-x    1 root     root            /sys
 drwxrwxrwt    2 root     root            /tmp
 drwxr-xr-x    2 root     root            /usr
-drwxr-xr-x    2 root     root            /usr/bin
+dr-xr-xr-x    2 root     root            /usr/bin
+drwxr-xr-x    2 root     root            /usr/games
 drwxr-xr-x    2 root     root            /usr/include
-drwxr-xr-x    2 root     root            /usr/lib
-drwxr-xr-x    2 root     root            /usr/lib/debug
-drwxr-xr-x    2 root     root            /usr/lib/debug/.dwz
-drwxr-xr-x    2 root     root            /usr/lib/debug/bin
-drwxr-xr-x    2 root     root            /usr/lib/debug/lib
-lrwxrwxrwx    1 root     root            /usr/lib/debug/lib64 -> lib
-drwxr-xr-x    2 root     root            /usr/lib/debug/sbin
-drwxr-xr-x    2 root     root            /usr/lib/debug/usr
+dr-xr-xr-x    2 root     root            /usr/lib
+dr-xr-xr-x    2 root     root            /usr/lib/X11
+dr-xr-xr-x    2 root     root            /usr/lib/bpf
+dr-xr-xr-x    2 root     root            /usr/lib/debug
+dr-xr-xr-x    2 root     root            /usr/lib/debug/.dwz
+lrwxrwxrwx    1 root     root            /usr/lib/debug/bin -> usr/bin
+lrwxrwxrwx    1 root     root            /usr/lib/debug/lib -> usr/lib
+lrwxrwxrwx    1 root     root            /usr/lib/debug/sbin -> usr/sbin
+dr-xr-xr-x    2 root     root            /usr/lib/debug/usr
 lrwxrwxrwx    1 root     root            /usr/lib/debug/usr/.dwz -> ../.dwz
-lrwxrwxrwx    1 root     root            /usr/lib/debug/usr/bin -> ../bin
-lrwxrwxrwx    1 root     root            /usr/lib/debug/usr/lib -> ../lib
-lrwxrwxrwx    1 root     root            /usr/lib/debug/usr/lib64 -> ../lib
-lrwxrwxrwx    1 root     root            /usr/lib/debug/usr/sbin -> ../sbin
-lrwxrwxrwx    1 root     root            /usr/lib64 -> lib
+-rwxr-xr-x    1 root     root            /usr/lib/debug/usr/bin
+-rwxr-xr-x    1 root     root            /usr/lib/debug/usr/lib
+-rwxr-xr-x    1 root     root            /usr/lib/debug/usr/sbin
+dr-xr-xr-x    2 root     root            /usr/lib/games
+dr-xr-xr-x    2 root     root            /usr/lib/locale
+dr-xr-xr-x    2 root     root            /usr/lib/modules
+dr-xr-xr-x    2 root     root            /usr/lib/pm-utils
+dr-xr-xr-x    2 root     root            /usr/lib/pm-utils/module.d
+dr-xr-xr-x    2 root     root            /usr/lib/pm-utils/power.d
+dr-xr-xr-x    2 root     root            /usr/lib/pm-utils/sleep.d
+dr-xr-xr-x    2 root     root            /usr/lib/sysimage
+dr-xr-xr-x    2 root     root            /usr/lib/systemd
+dr-xr-xr-x    2 root     root            /usr/lib/systemd/system
+dr-xr-xr-x    2 root     root            /usr/lib/systemd/user
+dr-xr-xr-x    2 root     root            /usr/lib/sysusers.d
+dr-xr-xr-x    2 root     root            /usr/lib/tmpfiles.d
 drwxr-xr-x    2 root     root            /usr/libexec
 drwxr-xr-x    2 root     root            /usr/local
 drwxr-xr-x    2 root     root            /usr/local/bin
+drwxr-xr-x    2 root     root            /usr/local/etc
+drwxr-xr-x    2 root     root            /usr/local/games
 drwxr-xr-x    2 root     root            /usr/local/include
 drwxr-xr-x    2 root     root            /usr/local/lib
-lrwxrwxrwx    1 root     root            /usr/local/lib64 -> lib
+drwxr-xr-x    2 root     root            /usr/local/lib/bpf
+drwxr-xr-x    2 root     root            /usr/local/libexec
 drwxr-xr-x    2 root     root            /usr/local/sbin
 drwxr-xr-x    2 root     root            /usr/local/share
-drwxr-xr-x    2 root     root            /usr/local/share/color
-drwxr-xr-x    2 root     root            /usr/local/share/dict
-drwxr-xr-x    2 root     root            /usr/local/share/doc
+drwxr-xr-x    2 root     root            /usr/local/share/applications
 drwxr-xr-x    2 root     root            /usr/local/share/info
-drwxr-xr-x    2 root     root            /usr/local/share/locale
 drwxr-xr-x    2 root     root            /usr/local/share/man
 drwxr-xr-x    2 root     root            /usr/local/share/man/man1
+drwxr-xr-x    2 root     root            /usr/local/share/man/man1x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man2
+drwxr-xr-x    2 root     root            /usr/local/share/man/man2x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man3
+drwxr-xr-x    2 root     root            /usr/local/share/man/man3x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man4
+drwxr-xr-x    2 root     root            /usr/local/share/man/man4x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man5
+drwxr-xr-x    2 root     root            /usr/local/share/man/man5x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man6
+drwxr-xr-x    2 root     root            /usr/local/share/man/man6x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man7
+drwxr-xr-x    2 root     root            /usr/local/share/man/man7x
 drwxr-xr-x    2 root     root            /usr/local/share/man/man8
-drwxr-xr-x    2 root     root            /usr/local/share/misc
-drwxr-xr-x    2 root     root            /usr/local/share/terminfo
-drwxr-xr-x    2 root     root            /usr/local/share/zoneinfo
+drwxr-xr-x    2 root     root            /usr/local/share/man/man8x
+drwxr-xr-x    2 root     root            /usr/local/share/man/man9
+drwxr-xr-x    2 root     root            /usr/local/share/man/man9x
+drwxr-xr-x    2 root     root            /usr/local/share/man/mann
 drwxr-xr-x    2 root     root            /usr/local/src
-drwxr-xr-x    2 root     root            /usr/sbin
+dr-xr-xr-x    2 root     root            /usr/sbin
 drwxr-xr-x    2 root     root            /usr/share
-drwxr-xr-x    2 root     root            /usr/share/color
+drwxr-xr-x    2 root     root            /usr/share/X11
+drwxr-xr-x    2 root     root            /usr/share/X11/fonts
+drwxr-xr-x    2 root     root            /usr/share/aclocal
+drwxr-xr-x    2 root     root            /usr/share/appdata
+drwxr-xr-x    2 root     root            /usr/share/applications
+drwxr-xr-x    2 root     root            /usr/share/augeas
+drwxr-xr-x    2 root     root            /usr/share/augeas/lenses
+drwxr-xr-x    2 root     root            /usr/share/backgrounds
+drwxr-xr-x    2 root     root            /usr/share/bash-completion
+drwxr-xr-x    2 root     root            /usr/share/bash-completion/completions
+drwxr-xr-x    2 root     root            /usr/share/bash-completion/helpers
+drwxr-xr-x    2 root     root            /usr/share/desktop-directories
 drwxr-xr-x    2 root     root            /usr/share/dict
 drwxr-xr-x    2 root     root            /usr/share/doc
+dr-xr-xr-x    2 root     root            /usr/share/empty
+drwxr-xr-x    2 root     root            /usr/share/fish
+drwxr-xr-x    2 root     root            /usr/share/fish/vendor_completions.d
+drwxr-xr-x    2 root     root            /usr/share/games
+drwxr-xr-x    2 root     root            /usr/share/gnome
+drwxr-xr-x    2 root     root            /usr/share/help
+drwxr-xr-x    2 root     root            /usr/share/icons
+drwxr-xr-x    2 root     root            /usr/share/idl
 drwxr-xr-x    2 root     root            /usr/share/info
+drwxr-xr-x    2 root     root            /usr/share/licenses
 drwxr-xr-x    2 root     root            /usr/share/locale
 drwxr-xr-x    2 root     root            /usr/share/man
+drwxr-xr-x    2 root     root            /usr/share/man/man0p
 drwxr-xr-x    2 root     root            /usr/share/man/man1
+drwxr-xr-x    2 root     root            /usr/share/man/man1p
+drwxr-xr-x    2 root     root            /usr/share/man/man1x
 drwxr-xr-x    2 root     root            /usr/share/man/man2
+drwxr-xr-x    2 root     root            /usr/share/man/man2x
 drwxr-xr-x    2 root     root            /usr/share/man/man3
+drwxr-xr-x    2 root     root            /usr/share/man/man3p
+drwxr-xr-x    2 root     root            /usr/share/man/man3x
 drwxr-xr-x    2 root     root            /usr/share/man/man4
+drwxr-xr-x    2 root     root            /usr/share/man/man4x
 drwxr-xr-x    2 root     root            /usr/share/man/man5
+drwxr-xr-x    2 root     root            /usr/share/man/man5x
 drwxr-xr-x    2 root     root            /usr/share/man/man6
+drwxr-xr-x    2 root     root            /usr/share/man/man6x
 drwxr-xr-x    2 root     root            /usr/share/man/man7
+drwxr-xr-x    2 root     root            /usr/share/man/man7x
 drwxr-xr-x    2 root     root            /usr/share/man/man8
+drwxr-xr-x    2 root     root            /usr/share/man/man8x
+drwxr-xr-x    2 root     root            /usr/share/man/man9
+drwxr-xr-x    2 root     root            /usr/share/man/man9x
+drwxr-xr-x    2 root     root            /usr/share/man/mann
+drwxr-xr-x    2 root     root            /usr/share/metainfo
+drwxr-xr-x    2 root     root            /usr/share/mime-info
 drwxr-xr-x    2 root     root            /usr/share/misc
-drwxr-xr-x    2 root     root            /usr/share/terminfo
-drwxr-xr-x    2 root     root            /usr/share/zoneinfo
+drwxr-xr-x    2 root     root            /usr/share/omf
+drwxr-xr-x    2 root     root            /usr/share/pixmaps
+drwxr-xr-x    2 root     root            /usr/share/sounds
+drwxr-xr-x    2 root     root            /usr/share/themes
+drwxr-xr-x    2 root     root            /usr/share/wayland-sessions
+drwxr-xr-x    2 root     root            /usr/share/xsessions
+drwxr-xr-x    2 root     root            /usr/share/zsh
+drwxr-xr-x    2 root     root            /usr/share/zsh/site-functions
 drwxr-xr-x    2 root     root            /usr/src
+drwxr-xr-x    2 root     root            /usr/src/debug
+drwxr-xr-x    2 root     root            /usr/src/kernels
+lrwxrwxrwx    1 root     root            /usr/tmp -> ../var/tmp
 drwxr-xr-x    2 root     root            /var
+drwxr-xr-x    2 root     root            /var/adm
 drwxr-xr-x    2 root     root            /var/cache
+drwxr-xr-x    2 root     root            /var/cache/bpf
+drwxr-xr-x    2 root     root            /var/db
+drwxr-xr-x    2 root     root            /var/empty
+drwxr-xr-x    2 root     root            /var/ftp
+drwxr-xr-x    2 root     root            /var/games
 drwxr-xr-x    2 root     root            /var/lib
-drwxr-xr-x    2 root     root            /var/lib/color
-drwxr-xr-x    2 root     root            /var/lib/locate
+drwxr-xr-x    2 root     root            /var/lib/games
 drwxr-xr-x    2 root     root            /var/lib/misc
+drwxr-xr-x    2 root     root            /var/lib/rpm-state
 drwxr-xr-x    2 root     root            /var/local
 lrwxrwxrwx    1 root     root            /var/lock -> ../run/lock
 drwxr-xr-x    2 root     root            /var/log
--rw-------    1 root     root            /var/log/btmp
--rw-rw-r--    1 root     utmp            /var/log/lastlog
--rw-r--r--    1 root     root            /var/log/wtmp
-drwxr-xr-x    2 root     root            /var/mail
-drwxr-xr-x    2 root     root            /var/mnt
+lrwxrwxrwx    1 root     root            /var/mail -> spool/mail
+drwxr-xr-x    2 root     root            /var/nis
 drwxr-xr-x    2 root     root            /var/opt
+drwxr-xr-x    2 root     root            /var/preserve
 lrwxrwxrwx    1 root     root            /var/run -> ../run
 drwxr-xr-x    2 root     root            /var/spool
-drwxr-xr-x    2 root     root            /var/srv
+drwxr-xr-x    2 root     root            /var/spool/lpd
+drwxrwxr-x    2 root     mail            /var/spool/mail
 drwxrwxrwt    2 root     root            /var/tmp
+drwxr-xr-x    2 root     root            /var/yp

ddstreetmicrosoft avatar Mar 13 '24 11:03 ddstreetmicrosoft

-lrwxrwxrwx 1 root root /lib64 -> usr/lib

Note that we need to fix our %_lib macro

ddstreetmicrosoft avatar Mar 13 '24 11:03 ddstreetmicrosoft