attempt to solve /usr/sbin upgrade error when owning directory to symlink [release 2.3-10mamba;Tue Sep 05 2023]
This commit is contained in:
parent
b453e3369f
commit
4704809907
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: filesystem
|
Name: filesystem
|
||||||
Version: 2.3
|
Version: 2.3
|
||||||
Release: 9mamba
|
Release: 10mamba
|
||||||
Summary: The basic directory layout for a Linux system
|
Summary: The basic directory layout for a Linux system
|
||||||
Group: System/Configuration
|
Group: System/Configuration
|
||||||
Vendor: openmamba
|
Vendor: openmamba
|
||||||
@ -78,6 +78,35 @@ ln -s ../run %{buildroot}/var/run
|
|||||||
#%pre
|
#%pre
|
||||||
#[ -L /usr/local/man ] && rm -f /usr/local/man || :
|
#[ -L /usr/local/man ] && rm -f /usr/local/man || :
|
||||||
|
|
||||||
|
%pretrans -p <lua>
|
||||||
|
-- Remove /usr/sbin early to avoid error due to package upgrade from owned dir to symlink
|
||||||
|
path = "/usr/sbin"
|
||||||
|
st = posix.stat(path)
|
||||||
|
if st and st.type == "directory" then
|
||||||
|
status = os.rename(path, path .. ".rpmmoved")
|
||||||
|
if not status then
|
||||||
|
suffix = 0
|
||||||
|
while not status do
|
||||||
|
suffix = suffix + 1
|
||||||
|
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
|
||||||
|
end
|
||||||
|
os.rename(path, path .. ".rpmmoved")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
path = "/usr/local/sbin"
|
||||||
|
st = posix.stat(path)
|
||||||
|
if st and st.type == "directory" then
|
||||||
|
status = os.rename(path, path .. ".rpmmoved")
|
||||||
|
if not status then
|
||||||
|
suffix = 0
|
||||||
|
while not status do
|
||||||
|
suffix = suffix + 1
|
||||||
|
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
|
||||||
|
end
|
||||||
|
os.rename(path, path .. ".rpmmoved")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
[ -L /var/run ] || {
|
[ -L /var/run ] || {
|
||||||
# /var/run -> /run migration
|
# /var/run -> /run migration
|
||||||
@ -88,18 +117,18 @@ ln -s ../run %{buildroot}/var/run
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
# /usr/sbin -> /usr/bin merge
|
# /usr/sbin -> /usr/bin merge
|
||||||
[ -L /usr/sbin ] || {
|
[ -e /usr/sbin.rpmmoved ] && {
|
||||||
echo "Migrating /usr/sbin to /usr/bin..."
|
echo "Migrating /usr/sbin to /usr/bin..."
|
||||||
for d in /usr/sbin /usr/local/sbin; do
|
for d in /usr/sbin /usr/local/sbin; do
|
||||||
for f in $d/*; do
|
for f in $d.rpmmoved/*; do
|
||||||
dest=${d/sbin/bin}/`basename $f`
|
dest="${d/sbin/bin}/`basename $f`"
|
||||||
if [ -e $dest ]; then
|
if [ -e "$dest" ]; then
|
||||||
#echo "$f exists as $dest"
|
#echo "$f exists as $dest"
|
||||||
if [ -L $f ]; then
|
if [ -L $f ]; then
|
||||||
linkdest=`readlink $f`
|
linkdest=`readlink $f`
|
||||||
#echo "$f is a symlink to $linkdest"
|
#echo "$f is a symlink to $linkdest"
|
||||||
/usr/bin/rm -f $f
|
/usr/bin/rm -f $f
|
||||||
elif [ -L $dest ]; then
|
elif [ -L "$dest" ]; then
|
||||||
linkdest=`readlink $dest`
|
linkdest=`readlink $dest`
|
||||||
#echo "$dest is a symlink to $linkdest"
|
#echo "$dest is a symlink to $linkdest"
|
||||||
/usr/bin/rm -f $dest && mv $f $dest
|
/usr/bin/rm -f $dest && mv $f $dest
|
||||||
@ -108,7 +137,7 @@ ln -s ../run %{buildroot}/var/run
|
|||||||
/usr/bin/rm -f $f
|
/usr/bin/rm -f $f
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -L $f ]; then
|
if [ -L "$f" ]; then
|
||||||
linkdest=`readlink $f`
|
linkdest=`readlink $f`
|
||||||
if [ "${linkdest:0:3}" = "../" ]; then
|
if [ "${linkdest:0:3}" = "../" ]; then
|
||||||
fulllinkdest=`readlink -f $f`
|
fulllinkdest=`readlink -f $f`
|
||||||
@ -123,7 +152,7 @@ ln -s ../run %{buildroot}/var/run
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
/usr/bin/rmdir $d || /usr/bin/mv $d $d.notmigrated
|
/usr/bin/rmdir $d.rpmmoved || /usr/bin/mv $d.rpmmoved $d.notmigrated
|
||||||
/usr/bin/ln -s bin $d
|
/usr/bin/ln -s bin $d
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -295,6 +324,9 @@ fi
|
|||||||
/usr/tmp
|
/usr/tmp
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 05 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-10mamba
|
||||||
|
- attempt to solve /usr/sbin upgrade error when owning directory to symlink
|
||||||
|
|
||||||
* Mon Sep 04 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-9mamba
|
* Mon Sep 04 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-9mamba
|
||||||
- own lib and lib64 dirs and symlinks
|
- own lib and lib64 dirs and symlinks
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user