From c9e8db242697e0aac04d9c5ce00938a3b1d11f1a Mon Sep 17 00:00:00 2001 From: Colin Guthrie <colin@mageia.org> Date: Thu, 12 Jul 2012 20:47:09 +0100 Subject: [PATCH 508/515] mageia: Add a convertfs hacks for packaging quirks --- modules.d/30convertfs/convertfs.sh | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh index d717c69..3b8e29b 100755 --- a/modules.d/30convertfs/convertfs.sh +++ b/modules.d/30convertfs/convertfs.sh @@ -25,12 +25,18 @@ if [ ! -L $ROOT/var/run -a -e $ROOT/var/run ]; then echo "Converting /var/run to symlink" mv -f $ROOT/var/run $ROOT/var/run.runmove~ ln -sfn ../run $ROOT/var/run + # Prevent the clean script from running. It's not needed now but if it's still + # active on boot, it will remove the symlinks we've just created above! + rm -f "$ROOT/lib/systemd/system/sysinit.target.wants/mandriva-clean-var-run-lock.service" fi if [ ! -L $ROOT/var/lock -a -e $ROOT/var/lock ]; then echo "Converting /var/lock to symlink" mv -f $ROOT/var/lock $ROOT/var/lock.lockmove~ ln -sfn ../run/lock $ROOT/var/lock + # Prevent the clean script from running. It's not needed now but if it's still + # active on boot, it will remove the symlinks we've just created above! + rm -f "$ROOT/lib/systemd/system/sysinit.target.wants/mandriva-clean-var-run-lock.service" fi needconvert() { @@ -132,6 +138,20 @@ for dir in bin sbin lib lib64; do echo "Make a copy of \`$ROOT/usr/$dir'." [[ -d "$ROOT/usr/$dir" ]] \ && cp -ax -l "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-new" + + # (cg) Mageia packaging quirks.... + if [[ "$dir" = "bin" ]]; then + # shadow-utils on mga2 packaged this binary in /usr/bin when it shouldn't... + [[ -f "$ROOT/usr/${dir}.usrmove-new/login" ]] \ + && [[ -f "$ROOT/${dir}/login" ]] \ + && mv "$ROOT/usr/${dir}.usrmove-new/login" "$ROOT/usr/${dir}.usrmove-new/login.usrmove~" + elif [[ "$dir" = "lib" ]]; then + # libgcc1 on x86_64 installs had duplicate symlinks that ultimately point at the same file + [[ -L "$ROOT/${dir}/libgcc_s.so.1" ]] \ + && [[ -L "$ROOT/usr/${dir}.usrmove-new/libgcc_s.so.1" ]] \ + && rm -f "$ROOT/usr/${dir}.usrmove-new/libgcc_s.so.1" + fi + echo "Merge the copy with \`$ROOT/$dir'." [[ -d "$ROOT/usr/${dir}.usrmove-new" ]] \ || mkdir -p "$ROOT/usr/${dir}.usrmove-new" @@ -196,11 +216,32 @@ set +e echo "Run ldconfig." ldconfig -r "$ROOT" -. $ROOT/etc/selinux/config +[[ -f "$ROOT/etc/selinux/config" ]] && . "$ROOT/etc/selinux/config" if [ -n "$(command -v setfiles)" ] && [ "$SELINUX" != "disabled" ] && [ -f /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts ]; then echo "Fixing SELinux labels" setfiles -r $ROOT -p /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts $ROOT/sbin $ROOT/bin $ROOT/lib $ROOT/lib64 $ROOT/usr/lib $ROOT/usr/lib64 $ROOT/etc/ld.so.cache $ROOT/var/cache/ldconfig || : fi +# (cg) iptables package has an unpackaged symlink that conflicts with a script name +if [[ -f "$ROOT/usr/lib64/iptables.usrmove~" ]]; then + mv "$ROOT/usr/lib64/iptables.usrmove~" "$ROOT/usr/lib64/iptables.init" + [[ -f "$ROOT/usr/lib/systemd/system/iptables.service" ]] \ + && sed -i 's,lib64/iptables ,lib64/iptables.init ,' "$ROOT/usr/lib/systemd/system/iptables.service" + if [[ -f "$ROOT/usr/lib64/ip6tables" ]]; then + mv "$ROOT/usr/lib64/ip6tables" "$ROOT/usr/lib64/ip6tables.init" + [[ -f "$ROOT/usr/lib/systemd/system/ip6tables.service" ]] \ + && sed -i 's,lib64/ip6tables ,lib64/ip6tables.init ,' "$ROOT/usr/lib/systemd/system/ip6tables.service" + fi +elif [[ -f "$ROOT/usr/lib/iptables.usrmove~" ]]; then + mv "$ROOT/usr/lib/iptables.usrmove~" "$ROOT/usr/lib/iptables.init" + [[ -f "$ROOT/usr/lib/systemd/system/iptables.service" ]] \ + && sed -i 's,lib/iptables ,lib/iptables.init ,' "$ROOT/usr/lib/systemd/system/iptables.service" + if [[ -f "$ROOT/usr/lib/ip6tables" ]]; then + mv "$ROOT/usr/lib/ip6tables" "$ROOT/usr/lib/ip6tables.init" + [[ -f "$ROOT/usr/lib/systemd/system/ip6tables.service" ]] \ + && sed -i 's,lib/ip6tables ,lib/ip6tables.init ,' "$ROOT/usr/lib/systemd/system/ip6tables.service" + fi +fi + echo "Done." exit 0 -- 1.9.2