Magellan Linux

Contents of /smage/branches/alx-0_6_0/core/util-linux/util-linux-2.23.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6914 - (show annotations) (download)
Mon Jul 27 13:00:29 2015 UTC (8 years, 9 months ago) by niro
File size: 3646 byte(s)
-added postinstall() to upgrade /etc/fstab to use UUIDs
1 # $Id$
2
3 PNAME="util-linux"
4 PVER="2.23.2"
5 PBUILD="r1"
6
7 PCATEGORIE="sys-apps"
8
9 DESCRIPTION="Various useful Linux utilities."
10 HOMEPAGE="http://www.kernel.org/pub/linux/utils/util-linux-ng/"
11
12 DEPEND=">= virtual/glibc
13 >= sys-libs/ncurses-5.8
14 >= sys-fs/e2fsprogs-1.41"
15
16 SDEPEND=">= virtual/kernel-headers
17 >= virtual/sed
18 >= sys-dev/gettext-0.18"
19
20 SRCFILE="${PNAME}-${PVER}-repack.tar.bz2"
21 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
22
23 REMOVE_DEPRECATED_MAGE_TARGETS=1
24 # keep fullfeatured /sbin/blkid for better fstype guessing and uuid handling
25 # mcookie is needed by xorg's startx
26 ALX_ONLY_KEEP="bin/umount sbin/cfdisk sbin/sfdisk sbin/blkid usr/bin/mcookie usr/$(mlibdir)/*.so usr/$(mlibdir)/*.so.*"
27 sminclude mtools multilib cleanutils alx-split
28
29 SRC_URI=(
30 http://www.kernel.org/pub/linux/utils/${PNAME}/v${PVER/%.?/}/${SRCFILE}
31 mirror://${PNAME}/${SRCFILE}
32 )
33
34 UP2DATE="updatecmd \"${HOMEPAGE}/v\$(updatecmd ${HOMEPAGE} | grep v.*/ | sed -n 's/.*v\(.*\)\/.*/\1/;$ p')/?C=M;O=A\" | grep -v 'rc' | lasttarball"
35
36 src_prepare()
37 {
38 munpack ${SRCFILE} || die
39
40 # fhs compatibility
41 all-abis sed -i 's:etc/adjtime:var/lib/hwclock/adjtime:' \
42 include/pathnames.h \
43 sys-utils/hwclock.c sys-utils/hwclock.8 \
44 sys-utils/rtcwake.c sys-utils/rtcwake.8 || die
45
46 # regen configure
47 autoreconf --verbose --install --force || die
48 }
49
50 src_compile()
51 {
52 # we are using blkid from util linux now (--with-fsprobe=built --enable-fsck)
53 # which merges the old blkid from e2fsprogs and udevs libvolume
54 # see: http://lists.freedesktop.org/archives/hal-commit/2009-May/004936.html
55 mconfigure \
56 --without-pam \
57 --with-fsprobe=builtin \
58 --enable-nls \
59 --enable-agetty \
60 --enable-cramfs \
61 --enable-partx \
62 --enable-raw \
63 --enable-rdev \
64 --enable-rename \
65 --enable-schedutils \
66 --enable-write \
67 --disable-reset \
68 --disable-login-utils \
69 --disable-init \
70 --disable-kill \
71 --disable-last \
72 --disable-mesg \
73 --disable-wall \
74 --enable-fsck \
75 --disable-silent-rules \
76 || die
77
78 mmake || die
79 }
80
81 alx_generic_src_install()
82 {
83 # needed directories
84 mkeepdir /var/lib/hwclock || die
85
86 mmake DESTDIR=${BINDIR} install || die
87 minstalldocs HISTORY MAINTAINER README VERSION || die
88
89 # only keep binaries which are not provided by busybox
90 zapmost ${BINDIR}/bin findmnt lsblk umount || die
91 zapmost ${BINDIR}/usr/bin chkdupexe col colcrt colrm column cytune ddate \
92 fallocate ionice ipcmk isosize line look lscpu mcookie namei pg rename \
93 rev script scriptreplay setterm tailf ul unshare uuidgen whereis || die
94 zapmost ${BINDIR}/sbin agetty blkid blockdev cfdisk ctrlaltdel fsck fsck.cramfs \
95 fsck.minix fsfreeze fstrim mkfs mkfs.bfs mkfs.cramfs raw sfdisk swaplabel wipefs || die
96 zapmost ${BINDIR}/usr/sbin addpart delpart fdformat ldattach partx rtcwake tunelp uuidd || die
97 }
98
99 postinstall()
100 {
101 # upgrade fstab to use UUIDs
102 if [[ -z $(grep UUID /etc/fstab) ]]
103 then
104 echo "Upgrading '/etc/fstab' to use UUIDs"
105
106 # backup fstab and clear it
107 cp -f /etc/fstab{,.alx-backup}
108 :> /etc/fstab
109
110 # update fstab to use UUIDS
111 while read device mountpoint filesystem options check
112 do
113 case "${mountpoint}" in
114 "/"|"/boot")
115 # reset
116 UUID=""
117 # get uuid
118 eval $(blkid "${device}" | grep "${device}:" | sed 's/.*:.*UUID=\(.*\).*TYPE.*/UUID="\1"/;s:\ ::g')
119 echo " '${device}' ==> UUID='${UUID}'"
120 echo "UUID=${UUID} ${mountpoint} ${filesystem} ${options} ${check}" >> /etc/fstab
121 ;;
122 *)
123 echo "${device} ${mountpoint} ${filesystem} ${options} ${check}" >> /etc/fstab
124 ;;
125 esac
126 done < /etc/fstab.alx-backup
127 else
128 echo "No fstab upgrade required, '/etc/fstab' is already using UUIDs"
129 fi
130 }