Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-fs/udev/files: udev-stop-126.sh
Date: Wed, 27 Aug 2008 20:57:37
Message-Id: E1KYS57-0001QH-Fa@stork.gentoo.org
1 zzam 08/08/27 20:57:33
2
3 Added: udev-stop-126.sh
4 Log:
5 Version bumped. Thanks to Polynomial-C for the ebuild. Build system changed to autotools. This leads to no longer building a static library for libvolume_id. Patched makefile to get correct libvolume_id.so version.
6 (Portage version: 2.2_rc8/cvs/Linux 2.6.25-tuxonice-r6 i686)
7
8 Revision Changes Path
9 1.1 sys-fs/udev/files/udev-stop-126.sh
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-stop-126.sh?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/udev/files/udev-stop-126.sh?rev=1.1&content-type=text/plain
13
14 Index: udev-stop-126.sh
15 ===================================================================
16 # Copyright 1999-2008 Gentoo Foundation
17 # Distributed under the terms of the GNU General Public License v2
18
19 /lib/udev/move_tmp_persistent_rules.sh
20
21 . /lib/udev/shell-compat.sh
22
23 device_tarball=/lib/udev/state/devices.tar.bz2
24
25 rc_device_tarball=${rc_device_tarball:-${RC_DEVICE_TARBALL:-NO}}
26 if [ -e /dev/.devfsd ] || [ ! -e /dev/.udev ] || [ ! -z "${CDBOOT}" ] || \
27 ! yesno "${rc_device_tarball}" || \
28 ! touch "${device_tarball}" 2>/dev/null
29 then
30 exit 0
31 fi
32
33 ebegin "Saving device nodes"
34 # Handle our temp files
35 save_tmp_base=/tmp/udev.savedevices."$$"
36 devices_udev="${save_tmp_base}"/devices.udev
37 devices_real="${save_tmp_base}"/devices.real
38 devices_totar="${save_tmp_base}"/devices.totar
39 device_tmp_tarball="${save_tmp_base}"/devices
40
41 rm -rf "${save_tmp_base}"
42 mkdir "${save_tmp_base}"
43 touch "${devices_udev}" "${devices_real}" \
44 "${devices_totar}" "${device_tmp_tarball}"
45
46 if [ -f "${devices_udev}" -a -f "${devices_real}" -a \
47 -f "${devices_totar}" -a -f "${device_tmp_tarball}" ]
48 then
49 cd /dev
50 # Find all devices, but ignore .udev directory
51 find . -xdev -type b -or -type c -or -type l | \
52 cut -d/ -f2- | \
53 grep -v ^\\.udev >"${devices_real}"
54
55 # Figure out what udev created
56 udevadm info --export-db | sed -ne 's,^[SN]: \(.*\),\1,p' >"${devices_udev}"
57 # These ones we also do not want in there
58 for x in MAKEDEV core fd initctl pts shm stderr stdin stdout root; do
59 echo "${x}" >> "${devices_udev}"
60 done
61 if [ -d /lib/udev/devices ]; then
62 cd /lib/udev/devices
63 find . -xdev -type b -or -type c -or -type l | \
64 cut -d/ -f2- >> "${devices_udev}"
65 cd /dev
66 fi
67
68 fgrep -x -v -f "${devices_udev}" "${devices_real}" > "${devices_totar}"
69
70 # Now only tarball those not created by udev if we have any
71 if [ -s "${devices_totar}" ]; then
72 # we dont want to descend into mounted filesystems (e.g. devpts)
73 # looking up username may involve NIS/network
74 # and net may be down
75 tar --one-file-system --numeric-owner \
76 -jcpf "${device_tmp_tarball}" -T "${devices_totar}"
77 mv -f "${device_tmp_tarball}" "${device_tarball}"
78 else
79 rm -f "${device_tarball}"
80 fi
81 eend 0
82 else
83 eend 1 "Could not create temporary files!"
84 fi
85
86 rm -rf "${save_tmp_base}"