diff --git a/filesystem.spec b/filesystem.spec index d1db41a..fda77c3 100644 --- a/filesystem.spec +++ b/filesystem.spec @@ -1,6 +1,6 @@ Summary: The basic directory layout for a Linux system Name: filesystem -Version: 2.4.45 +Version: 3 Release: 1%{?dist} License: Public Domain URL: https://fedorahosted.org/filesystem @@ -12,6 +12,10 @@ Source3: iso_3166.sed BuildRequires: iso-codes Requires(pre): setup +# old installations; this ensures we can not install the incompatible +# filesystem.rpm on unconverted systems +Requires: rpmlib(X-CheckUnifiedSystemdir) >= 1 + %description The filesystem package is one of the basic packages that is installed on a Linux system. Filesystem contains the basic directory layout @@ -31,14 +35,18 @@ install -p -c -m755 %SOURCE3 %{buildroot}/iso_3166.sed cd %{buildroot} -mkdir -p bin boot dev \ +mkdir -p boot dev \ etc/{X11/{applnk,fontpath.d},xdg/autostart,opt,pm/{config.d,power.d,sleep.d},xinetd.d,skel,sysconfig,pki} \ - home lib/modules %{_lib}/tls media mnt opt proc root run/lock sbin srv sys tmp \ - usr/{bin,etc,games,include,%{_lib}/{games,sse2,tls,X11,pm-utils/{module.d,power.d,sleep.d}},lib/{games,locale,sse2},libexec,local/{bin,etc,games,lib,%{_lib},sbin,src,share/{applications,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x},info},libexec,include,},sbin,share/{aclocal,applications,augeas/lenses,backgrounds,desktop-directories,dict,doc,empty,games,ghostscript/conf.d,gnome,icons,idl,info,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p},mime-info,misc,omf,pixmaps,sounds,themes,xsessions,X11},src,src/kernels,src/debug} \ + home media mnt opt proc root run/lock srv sys tmp \ + usr/{bin,etc,games,include,%{_lib}/{games,sse2,tls,X11,pm-utils/{module.d,power.d,sleep.d}},lib/{games,locale,modules,sse2},libexec,local/{bin,etc,games,lib,%{_lib},sbin,src,share/{applications,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x},info},libexec,include,},sbin,share/{aclocal,applications,augeas/lenses,backgrounds,desktop-directories,dict,doc,empty,games,ghostscript/conf.d,gnome,icons,idl,info,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p},mime-info,misc,omf,pixmaps,sounds,themes,xsessions,X11},src,src/kernels,src/debug} \ var/{adm,empty,gopher,lib/{games,misc},local,lock/subsys,log,nis,preserve,run,spool/{mail,lpd,uucp},tmp,db,cache,opt,games,yp} ln -snf ../var/tmp usr/tmp ln -snf spool/mail var/mail +ln -snf usr/bin bin +ln -snf usr/sbin sbin +ln -snf usr/lib lib +ln -snf usr/%{_lib} %{_lib} sed -n -f %{buildroot}/iso_639.sed /usr/share/xml/iso-codes/iso_639.xml \ >%{buildroot}/iso_639.tab @@ -60,9 +68,9 @@ cat %{SOURCE1} | grep -v "^#" | grep -v "^$" | while read loc ; do locale=$loc locality= special= - [[ "$locale" =~ "@" ]] && locale=${locale%%@*} + [[ "$locale" =~ "@" ]] && locale=${locale%%%%@*} [[ "$locale" =~ "_" ]] && locality=${locale##*_} - [[ "$locality" =~ "." ]] && locality=${locality%%.*} + [[ "$locality" =~ "." ]] && locality=${locality%%%%.*} [[ "$loc" =~ "_" ]] || [[ "$loc" =~ "@" ]] || special=$loc # If the locality is not official, skip it @@ -71,7 +79,7 @@ cat %{SOURCE1} | grep -v "^#" | grep -v "^$" | while read loc ; do fi # If the locale is not official and not special, skip it if [ -z "$special" ]; then - egrep -q "[[:space:]]${locale%_*}[[:space:]]" \ + egrep -q "[[:space:]]${locale%%_*}[[:space:]]" \ %{buildroot}/iso_639.tab || continue fi echo "%lang(${locale}) /usr/share/locale/${loc}" >> $RPM_BUILD_DIR/filelist @@ -98,6 +106,29 @@ done %clean rm -rf %{buildroot} +%pretrans -p +--# +--# 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, +--# so, let's create the toplevel symlinks here and the directories they point to. +--# When our rpm is unpacked by cpio, it will set all permissions and modes later. +--# + +if posix.stat("/usr") == nil then + posix.mkdir("/usr") +end + +for i,dir in ipairs({"/lib", "/%{_lib}", "/sbin", "/bin"}) do + if posix.stat("/usr"..dir) == nil then + posix.mkdir("/usr"..dir) + if posix.stat(dir, "mode") == nil then + posix.symlink("usr"..dir, dir) + end + end +end + +return 0 + %post -p posix.symlink("../run", "/var/run") posix.symlink("../run/lock", "/var/lock") @@ -105,7 +136,7 @@ posix.symlink("../run/lock", "/var/lock") %files -f filelist %defattr(0755,root,root,-) %dir %attr(555,root,root) / -%attr(555,root,root) /bin +/bin %attr(555,root,root) /boot /dev %dir /etc @@ -118,9 +149,9 @@ posix.symlink("../run/lock", "/var/lock") /etc/sysconfig /etc/pki /home -%attr(555,root,root) /lib +/lib %ifarch x86_64 ppc ppc64 sparc sparc64 s390 s390x -%attr(555,root,root) /%{_lib} +/%{_lib} %endif /media %dir /mnt @@ -128,7 +159,7 @@ posix.symlink("../run/lock", "/var/lock") %attr(555,root,root) /proc %attr(550,root,root) /root /run -%attr(555,root,root) /sbin +/sbin /srv /sys %attr(1777,root,root) /tmp