diff --git a/filesystem.spec b/filesystem.spec index 9bda07c..3b133d1 100644 --- a/filesystem.spec +++ b/filesystem.spec @@ -1,8 +1,8 @@ %define tty_group 4 Name: filesystem -Version: 2.2 -Release: 21mamba +Version: 2.3 +Release: 4mamba Summary: The basic directory layout for a Linux system Group: System/Configuration Vendor: openmamba @@ -13,7 +13,6 @@ License: Public Domain ## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-END BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description The filesystem package is one of the basic packages that is installed on an openmamba Linux system. @@ -25,8 +24,8 @@ Filesystem contains the basic directory layout for a Linux operating system, inc %install [ "%{buildroot}" != / ] && rm -rf %{buildroot} -install -d %{buildroot}/{bin,boot,dev/pts,etc/opt,home,%_lib,mnt,proc} -install -d %{buildroot}/{root,sbin,tmp,usr/local,var,opt,initrd} +install -d %{buildroot}/{boot,dev/pts,etc/opt,home,%_lib,mnt,proc} +install -d %{buildroot}/{root,tmp,usr/local,var,opt,initrd} for dirname in %{buildroot}/usr %{buildroot}/usr/local; do install -d $dirname/{bin,etc,include,%_lib,sbin,share,src} @@ -51,6 +50,9 @@ install -d %{buildroot}/run install -d %{buildroot}/srv install -d %{buildroot}/sys +# Owning /bin and /sbin symlinks +#ln -s usr/bin %{buildroot}/bin +#ln -s usr/sbin %{buildroot}/sbin ln -s ../var/tmp %{buildroot}/usr ln -s ../mail %{buildroot}/var/spool/mail ln -s ../run %{buildroot}/var/run @@ -65,12 +67,60 @@ ln -s ../run %{buildroot}/var/run %pre [ -L /var/run ] || { + # /var/run -> /run migration mv /var/run /var/run.rpmold for f in /var/run.rpmold/*; do b=`basename $f` [ -e /run/$b ] || mv $f /run/ done } +[ -L /bin -a -L /sbin ] || { + # /bin -> /usr/bin and /sbin -> /usr/sbin migration + for f in mv rm rmdir ln; do + [ -e /usr/bin/$f ] || cp /bin/$f /usr/bin/$f + done + for d in bin sbin; do + [ -L /$d ] && continue + echo "Migrating /$d to /usr/$d..." + for f in /$d/*; do + dest=/usr$f + if [ -e $dest ]; then + #echo "$f exists as $dest" + if [ -L $f ]; then + linkdest=`readlink $f` + #echo "$f is a symlink to $linkdest" + /usr/bin/rm -f $f + elif [ -L $dest ]; then + linkdest=`readlink $dest` + #echo "$dest is a symlink to $linkdest" + /usr/bin/rm -f $dest && mv $f $dest + else + #echo "$f exists as a file also as $linkdest" + /usr/bin/rm -f $f + fi + else + if [ -L $f ]; then + linkdest=`readlink $f` + if [ "${linkdest:0:3}" = "../" ]; then + fulllinkdest=`readlink -f $f` + #echo "$f is a symlink pointing to ../ -> fixing" + /usr/bin/ln -s $fulllinkdest $dest + /usr/bin/rm -f $f + else + /usr/bin/mv $f $dest + fi + else + /usr/bin/mv $f $dest + fi + fi + done + /usr/bin/rmdir /$d || /usr/bin/mv /$d /$d.notmigrated + /usr/bin/ln -s usr/$d /$d + done +} +# Add if missing for safety +[ -e /bin ] || /usr/bin/ln -s usr/bin /bin +[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin : %post @@ -80,10 +130,22 @@ if [ $1 -ge 1 ]; then fi : +%triggerpostun -p /usr/bin/bash -- filesystem < 2.3 +# /bin and /sbin are removed during old filesystem postun +[ -e /bin ] || /usr/bin/ln -s usr/bin /bin +[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin +: + +%posttrans -p /usr/bin/bash +# /bin and /sbin are removed on upgrade +[ -e /bin ] || /usr/bin/ln -s usr/bin /bin +[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin +: + %files %defattr(-,root,root) %attr(0755,root,root) %dir / -%dir /bin +#/bin %dir /boot %dir /dev %dir /dev/pts @@ -96,7 +158,7 @@ fi %dir /proc %attr(0750,root,root) %dir /root %dir /run -%dir /sbin +#/sbin %dir /srv %dir /sys %attr(1777,root,root) %dir /tmp @@ -169,6 +231,20 @@ fi /usr/tmp %changelog +* Fri Mar 05 2021 Silvan Calarco 2.3-4mamba +- use /usr/bin/bash insted of /usr/bin/sh in posttrans script +- add triggerpostun to try to fix further problems + +* Tue Mar 02 2021 Silvan Calarco 2.3-3mamba +- add -p /usr/bin/sh to posttrans as fix attempt for symlink disappearing after upgrade + +* Tue Mar 02 2021 Silvan Calarco 2.3-2mamba +- fix attempt for symlink disappearing after upgrade + +* Tue Mar 02 2021 Silvan Calarco 2.3-1mamba +- update to 2.3 +- migrate /bin and /sbin files to /usr/bin and /usr/sbin and make the former symlinks + * Tue Nov 24 2020 Silvan Calarco 2.2-21mamba - specfile fixes with recent rpm