[util-linux] install everything in /usr

Harald Hoyer harald at fedoraproject.org
Wed Jan 25 14:10:01 UTC 2012


commit b2fdd8fbf36e01818925cd30723e066a732148d1
Author: Harald Hoyer <harald at redhat.com>
Date:   Wed Jan 25 15:07:47 2012 +0100

    install everything in /usr
    
    This patch is needed for the /usr-move feature
    https://fedoraproject.org/wiki/Features/UsrMove
    
    This package requires now 'filesystem' >= 3, which is only installable
    on a system which has /bin, /sbin, /lib, /lib64 as symlinks to /usr and
    not regular directories. The 'filesystem' package acts as a guard, to
    prevent *this* package to be installed on old unconverted systems.
    
    New installations will have the 'filesystem' >=3 layout right away, old
    installations need to be converted with anaconda or dracut first; only
    after that, the 'filesystem' package, and also *this* package can be
    installed.
    
    Packages *should* not install files in /bin, /sbin, /lib, /lib64, but
    only in the corresponding directories in /usr. Packages *must* not
    install conflicting files with the same names in the corresponding
    directories in / and /usr. Especially compatibilty symlinks must not be
    installed.
    
    Feel free to modify any of the changes to the spec file, but keep the
    above in mind.

 util-linux.spec |  144 ++++++++++++++++++++++++++----------------------------
 1 files changed, 69 insertions(+), 75 deletions(-)
---
diff --git a/util-linux.spec b/util-linux.spec
index 6c60ce2..8108f7d 100644
--- a/util-linux.spec
+++ b/util-linux.spec
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux
 Version: 2.20.1
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
 Group: System Environment/Base
 URL: http://kernel.org/~kzak/util-linux/
@@ -22,7 +22,7 @@ URL: http://kernel.org/~kzak/util-linux/
 %define floppyver 0.18
 %define cytune_archs %{ix86} alpha %{arm}
 
-### Dependences
+### Dependencies
 BuildRequires: audit-libs-devel >= 1.0.6
 BuildRequires: gettext-devel
 BuildRequires: libselinux-devel
@@ -51,6 +51,17 @@ Conflicts: e2fsprogs < 1.41.8-5
 # rename from util-linux-ng back to util-linux
 Obsoletes: util-linux-ng < 2.19
 Provides: util-linux-ng = %{version}-%{release}
+Conflicts: filesystem < 3
+Provides: /bin/dmesg
+Provides: /bin/kill
+Provides: /bin/more
+Provides: /bin/mount
+Provides: /bin/umount
+Provides: /sbin/blkid
+Provides: /sbin/blockdev
+Provides: /sbin/findfs
+Provides: /sbin/fsck
+Provides: /sbin/nologin
 
 Requires(post): coreutils
 Requires: pam >= 1.1.3-7, /etc/pam.d/system-auth
@@ -60,7 +71,7 @@ Requires: libblkid = %{version}-%{release}
 Requires: libmount = %{version}-%{release}
 
 %if %{include_raw}
-Requires: udev
+Requires: udev >= 176
 %endif
 
 ### Floppy patches (Fedora/RHEL specific)
@@ -98,6 +109,7 @@ Summary: Device mounting library
 Group: Development/Libraries
 License: LGPLv2+
 Requires: libblkid = %{version}-%{release}
+Conflicts: filesystem < 3
 
 %description -n libmount
 This is the device mounting library, part of util-linux.
@@ -120,6 +132,7 @@ Summary: Block device ID library
 Group: Development/Libraries
 License: LGPLv2+
 Requires: libuuid = %{version}-%{release}
+Conflicts: filesystem < 3
 
 %description -n libblkid
 This is block device identification library, part of util-linux.
@@ -141,6 +154,7 @@ part of util-linux.
 Summary: Universally unique ID library
 Group: Development/Libraries
 License: BSD
+Conflicts: filesystem < 3
 
 %description -n libuuid
 This is the universally unique ID library, part of e2fsprogs.
@@ -207,9 +221,6 @@ export CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 export SUID_CFLAGS="-fpie"
 export SUID_LDFLAGS="-pie"
 %configure \
-	--bindir=/bin \
-	--sbindir=/sbin \
-	--libdir=/%{_lib} \
 	--disable-silent-rules \
 	--disable-wall \
 	--enable-partx \
@@ -241,7 +252,6 @@ gcc $CFLAGS -o nologin nologin.c
 
 %install
 rm -rf ${RPM_BUILD_ROOT}
-mkdir -p ${RPM_BUILD_ROOT}/{bin,sbin}
 mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
 mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5}
 mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
@@ -259,15 +269,15 @@ make install DESTDIR=${RPM_BUILD_ROOT}
 popd
 
 # install nologin
-install -m 755 nologin ${RPM_BUILD_ROOT}/sbin
+install -m 755 nologin ${RPM_BUILD_ROOT}%{_sbindir}
 install -m 644 nologin.8 ${RPM_BUILD_ROOT}%{_mandir}/man8
 
 %if %{include_raw}
 echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8
 {
 	# see RH bugzilla #216664
-	mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d
-	pushd ${RPM_BUILD_ROOT}%{_sysconfdir}/udev/rules.d
+	mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib/udev/rules.d
+	pushd ${RPM_BUILD_ROOT}%{_prefix}/lib/udev/rules.d
 	install -m 644 %{SOURCE4} ./60-raw.rules
 	popd
 }
@@ -309,8 +319,7 @@ chmod 755 ${RPM_BUILD_ROOT}%{_bindir}/sunhostid
 	popd
 }
 
-ln -sf ../../sbin/hwclock ${RPM_BUILD_ROOT}/usr/sbin/hwclock
-ln -sf hwclock ${RPM_BUILD_ROOT}/sbin/clock
+ln -sf hwclock ${RPM_BUILD_ROOT}%{_sbindir}/clock
 echo ".so man8/hwclock.8" > ${RPM_BUILD_ROOT}%{_mandir}/man8/clock.8
 
 # unsupported on ix86 alpha armv4l
@@ -322,8 +331,7 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/cytune $RPM_BUILD_ROOT%{_mandir}/man8/cytune.8*
 %ifarch s390 s390x
 for I in /usr/{bin,sbin}/{fdformat,tunelp,floppy} \
 	%{_mandir}/man8/{fdformat,tunelp,floppy}.8* \
-	/sbin/{hwclock,clock} \
-	/usr/sbin/hwclock \
+	/usr/sbin/{hwclock,clock} \
 	%{_mandir}/man8/{hwclock,clock}.8*; do
 	
 	rm -f $RPM_BUILD_ROOT$I
@@ -343,9 +351,9 @@ done
 %endif
 
 # deprecated commands
-for I in /sbin/fsck.minix /sbin/mkfs.{bfs,minix} /sbin/sln \
+for I in /usr/sbin/fsck.minix /usr/sbin/mkfs.{bfs,minix} /usr/sbin/sln \
 	/usr/bin/chkdupexe %{_bindir}/line %{_bindir}/pg %{_bindir}/newgrp \
-	/sbin/shutdown /usr/sbin/vipw /usr/sbin/vigr; do
+	/usr/sbin/shutdown /usr/sbin/vipw /usr/sbin/vigr; do
 	rm -f $RPM_BUILD_ROOT$I
 done
 
@@ -369,28 +377,12 @@ chmod 644 getopt/getopt-*.{bash,tcsh}
 rm -f ${RPM_BUILD_ROOT}%{_datadir}/getopt/*
 rmdir ${RPM_BUILD_ROOT}%{_datadir}/getopt
 
-ln -sf ../../bin/kill $RPM_BUILD_ROOT%{_bindir}/kill
-
 %if %{mtab_symlink}
 	ln -s /proc/mounts %{buildroot}/etc/mtab
 %else
 	touch %{buildroot}/etc/mtab
 %endif
 
-# /usr/sbin -> /sbin
-for I in addpart delpart partx; do
-	if [ -e $RPM_BUILD_ROOT/usr/sbin/$I ]; then
-		mv $RPM_BUILD_ROOT/usr/sbin/$I $RPM_BUILD_ROOT/sbin/$I
-	fi
-done
-
-# /usr/bin -> /bin
-for I in taskset; do
-	if [ -e $RPM_BUILD_ROOT/usr/bin/$I ]; then
-		mv $RPM_BUILD_ROOT/usr/bin/$I $RPM_BUILD_ROOT/bin/$I
-	fi
-done
-
 # /sbin -> /bin
 for I in raw; do
 	if [ -e $RPM_BUILD_ROOT/sbin/$I ]; then
@@ -483,9 +475,9 @@ fi
 %config(noreplace)	%{_sysconfdir}/pam.d/login
 %config(noreplace)	%{_sysconfdir}/pam.d/remote
 
-%attr(4755,root,root)	/bin/mount
-%attr(4755,root,root)	/bin/umount
-%attr(755,root,root)	/bin/login
+%attr(4755,root,root)	%{_bindir}/mount
+%attr(4755,root,root)	%{_bindir}/umount
+%attr(755,root,root)	%{_bindir}/login
 %attr(4711,root,root)	%{_bindir}/chfn
 %attr(4711,root,root)	%{_bindir}/chsh
 %attr(2755,root,tty)	%{_bindir}/write
@@ -493,38 +485,37 @@ fi
 %ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog
 %ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/mtab
 
-/bin/dmesg
-/bin/findmnt
-/bin/kill
-/bin/lsblk
-/bin/more
-/bin/mountpoint
-/bin/taskset
-
-/sbin/addpart
-/sbin/agetty
-/sbin/blkid
-/sbin/blockdev
-/sbin/ctrlaltdel
-/sbin/delpart
-/sbin/fdisk
-/sbin/findfs
-/sbin/fsck
-/sbin/fsck.cramfs
-/sbin/fsfreeze
-/sbin/fstrim
-/sbin/losetup
-/sbin/mkfs
-/sbin/mkfs.cramfs
-/sbin/mkswap
-/sbin/nologin
-/sbin/partx
-/sbin/pivot_root
-/sbin/swaplabel
-/sbin/swapoff
-/sbin/swapon
-/sbin/switch_root
-/sbin/wipefs
+%{_bindir}/dmesg
+%{_bindir}/findmnt
+%{_bindir}/lsblk
+%{_bindir}/more
+%{_bindir}/mountpoint
+%{_bindir}/taskset
+
+%{_sbindir}/addpart
+%{_sbindir}/agetty
+%{_sbindir}/blkid
+%{_sbindir}/blockdev
+%{_sbindir}/ctrlaltdel
+%{_sbindir}/delpart
+%{_sbindir}/fdisk
+%{_sbindir}/findfs
+%{_sbindir}/fsck
+%{_sbindir}/fsck.cramfs
+%{_sbindir}/fsfreeze
+%{_sbindir}/fstrim
+%{_sbindir}/losetup
+%{_sbindir}/mkfs
+%{_sbindir}/mkfs.cramfs
+%{_sbindir}/mkswap
+%{_sbindir}/nologin
+%{_sbindir}/partx
+%{_sbindir}/pivot_root
+%{_sbindir}/swaplabel
+%{_sbindir}/swapoff
+%{_sbindir}/swapon
+%{_sbindir}/switch_root
+%{_sbindir}/wipefs
 
 %{_bindir}/cal
 %{_bindir}/chrt
@@ -641,15 +632,14 @@ fi
 %{_mandir}/man8/wipefs.8*
 
 %if %{include_raw}
-/bin/raw
+%{_bindir}/raw
 %config(noreplace)	%{_sysconfdir}/udev/rules.d/60-raw.rules
 %{_mandir}/man8/raw.8*
 %{_mandir}/man8/rawdevices.8*
 %endif
 
 %ifnarch s390 s390x
-/sbin/clock
-/sbin/hwclock
+%{_sbindir}/clock
 %{_bindir}/floppy
 %{_sbindir}/fdformat
 %{_sbindir}/hwclock
@@ -663,8 +653,8 @@ fi
 
 %ifnarch %{sparc}
 %doc fdisk/sfdisk.examples
-/sbin/cfdisk
-/sbin/sfdisk
+%{_sbindir}/cfdisk
+%{_sbindir}/sfdisk
 %{_mandir}/man8/cfdisk.8*
 %{_mandir}/man8/sfdisk.8*
 %endif
@@ -692,7 +682,7 @@ fi
 %files -n libmount
 %defattr(-,root,root)
 %doc libmount/COPYING.libmount
-/%{_lib}/libmount.so.*
+%{_libdir}/libmount.so.*
 
 %files -n libmount-devel
 %defattr(-,root,root)
@@ -706,7 +696,7 @@ fi
 %defattr(-,root,root)
 %doc libblkid/COPYING.libblkid
 %dir /etc/blkid
-/%{_lib}/libblkid.so.*
+%{_libdir}/libblkid.so.*
 
 %files -n libblkid-devel
 %defattr(-,root,root)
@@ -720,7 +710,7 @@ fi
 %files -n libuuid
 %defattr(-,root,root)
 %doc libuuid/COPYING.libuuid
-/%{_lib}/libuuid.so.*
+%{_libdir}/libuuid.so.*
 
 %files -n libuuid-devel
 %defattr(-,root,root)
@@ -743,6 +733,10 @@ fi
 
 
 %changelog
+* Wed Jan 25 2012 Harald Hoyer <harald at redhat.com> 2.20.1-5
+- install everything in /usr
+  https://fedoraproject.org/wiki/Features/UsrMove
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.20.1-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list