posttrans: ensure /lib and /lib64 symlinks exist or create [release 2.3-8mamba;Sat Sep 02 2023]
This commit is contained in:
parent
5a36052126
commit
d737621195
@ -2,13 +2,13 @@
|
||||
|
||||
Name: filesystem
|
||||
Version: 2.3
|
||||
Release: 6mamba
|
||||
Release: 8mamba
|
||||
Summary: The basic directory layout for a Linux system
|
||||
Group: System/Configuration
|
||||
Vendor: openmamba
|
||||
Distribution: openmamba
|
||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
URL: http://www.pathname.com/fhs/
|
||||
URL: https://www.pathname.com/fhs/
|
||||
License: Public Domain
|
||||
## AUTOBUILDREQ-BEGIN
|
||||
## AUTOBUILDREQ-END
|
||||
@ -28,7 +28,7 @@ install -d %{buildroot}/{boot,dev,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}
|
||||
install -d $dirname/{bin,etc,include,%_lib,share,src}
|
||||
# ln -s share/{man,doc,info} $dirname
|
||||
install -d $dirname/share/{dict,doc,info,locale,man,empty}
|
||||
install -d $dirname/share/{nls,misc,terminfo,zoneinfo}
|
||||
@ -51,8 +51,10 @@ 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 usr/bin %{buildroot}/bin
|
||||
ln -s usr/sbin %{buildroot}/sbin
|
||||
#ln -s bin %{buildroot}/usr/sbin
|
||||
#ln -s bin %{buildroot}/usr/local/sbin
|
||||
ln -s ../var/tmp %{buildroot}/usr
|
||||
ln -s ../mail %{buildroot}/var/spool/mail
|
||||
ln -s ../run %{buildroot}/var/run
|
||||
@ -74,6 +76,47 @@ ln -s ../run %{buildroot}/var/run
|
||||
[ -e /run/$b ] || mv $f /run/
|
||||
done
|
||||
}
|
||||
# /usr/sbin -> /usr/bin merge
|
||||
[ -L /usr/sbin ] || {
|
||||
echo "Migrating /usr/sbin to /usr/bin..."
|
||||
for d in /usr/sbin /usr/local/sbin; do
|
||||
for f in $d/*; do
|
||||
dest=${d/sbin/bin}/`basename $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 bin $d
|
||||
done
|
||||
}
|
||||
:
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
@ -89,6 +132,7 @@ fi
|
||||
:
|
||||
|
||||
%posttrans
|
||||
# usr merge
|
||||
[ -L /bin -a -L /sbin ] || {
|
||||
# /bin -> /usr/bin and /sbin -> /usr/sbin migration
|
||||
for f in mv rm rmdir ln; do
|
||||
@ -135,12 +179,18 @@ fi
|
||||
}
|
||||
[ -e /bin ] || /usr/bin/ln -s usr/bin /bin
|
||||
[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin
|
||||
[ -e /lib ] || /usr/bin/ln -s usr/lib /lib
|
||||
%ifarch x86_64 aarch64
|
||||
[ -e /lib64 ] || /usr/bin/ln -s usr/lib64 /lib64
|
||||
%endif
|
||||
[ -e /usr/sbin ] || /usr/bin/ln -s bin /usr/sbin
|
||||
[ -e /usr/local/sbin ] || /usr/bin/ln -s bin /usr/local/sbin
|
||||
:
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%attr(0755,root,root) %dir /
|
||||
#/bin
|
||||
/bin
|
||||
%dir /boot
|
||||
%dir /dev
|
||||
%dir /etc
|
||||
@ -152,7 +202,7 @@ fi
|
||||
%dir /proc
|
||||
%attr(0750,root,root) %dir /root
|
||||
%dir /run
|
||||
#/sbin
|
||||
/sbin
|
||||
%dir /srv
|
||||
%dir /sys
|
||||
%attr(1777,root,root) %dir /tmp
|
||||
@ -162,7 +212,7 @@ fi
|
||||
%dir /usr/etc
|
||||
%dir /usr/include
|
||||
%dir /usr/%_lib
|
||||
%dir /usr/sbin
|
||||
#/usr/sbin
|
||||
%dir /usr/src
|
||||
%dir /usr/share
|
||||
%dir /usr/share/dict
|
||||
@ -184,7 +234,7 @@ fi
|
||||
%dir /usr/local/include
|
||||
%dir /usr/local/%_lib
|
||||
%dir /usr/local/man
|
||||
%dir /usr/local/sbin
|
||||
#/usr/local/sbin
|
||||
%dir /usr/local/share
|
||||
%dir /usr/local/share/dict
|
||||
%dir /usr/local/share/doc
|
||||
@ -225,6 +275,12 @@ fi
|
||||
/usr/tmp
|
||||
|
||||
%changelog
|
||||
* Sat Sep 02 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-8mamba
|
||||
- posttrans: ensure /lib and /lib64 symlinks exist or create
|
||||
|
||||
* Sat Apr 15 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-7mamba
|
||||
- provide pre script to merge /usr/sbin to /usr/bin; own /sbin, /bin, /usr/sbin
|
||||
|
||||
* Sun Apr 25 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-6mamba
|
||||
- don't own /dev/pts
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user