[opensuse-factory] Re: rdev missing from util-linux in factory / thumbleweed
On Sun, Jan 16, 2011 at 4:58 PM, Mark Lord
On 11-01-16 03:04 PM, Greg Freemyer wrote:
cc: Adding opensuse-factory
On Fri, Jan 14, 2011 at 10:26 PM, Mark Lord
wrote: On 11-01-12 12:32 PM, Greg Freemyer wrote:
Mark,
I just got a problem report about wiper.sh needing /usr/sbin/rdev.
..
If you need to depend on it, maybe you need to add the above logic to hdparm (or create a small standalone utility inside your package)?
Thanks.
How does this look to you for a bash rdev equivalent:
## Try and determine the device name associated with the root filesystem. ## This is nearly impossible to do in any perfect fashion. ## ## do_rdev *usually* works, but on some distros it may only find "/dev/root", ## and "/dev/root" is not usually a real device. We leave it like that for now, ## because that's the pattern such systems also use in /proc/mounts. ## Later, at time of use, we'll try harder to find the real rootdev. ## ## Redhat/Fedora no longer have an rdev command. Silly them. ## So we now implement it internally, below. ## STAT=/usr/bin/stat FIND=/usr/bin/find function match_rdev() { rdev="" rdevno="$1" while read bdev ; do if [ "$rdev" = "" -o "$bdev" != "/dev/root" ]; then devno=$($STAT -c "0x%t%02T" "$bdev") [ "$devno" = "$rdevno" ] && rdev="$bdev" fi done echo -n "$rdev" } rootdev=$($FIND /dev/ -type b 2>/dev/null | match_rdev $($STAT -c "0x%D" '/')) [ $verbose -gt 0 ] && echo "rootdev=$rootdev"
That's what I'm intending to replace rdev with in wiper.sh v3.3. But I don't have any installs here that use "/dev/root" to re-test with. Gotta hunt around some more, I guess..
Mark, I'm not familiar with /dev/root. On my opensuse 11.3 machine, its a symlink to /dev/sda5. I ran your script and it echos "rootdev=/dev/sda5". My fstab has: LABEL=root / ext3 acl,relatime,user_xattr 1 1 I could change that to have /dev/root in the first column and reboot if you think it a useful test for you, but I suspect you need something booting from a LVM setup for /dev/root to be a meaningful problem? Greg -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org
participants (1)
-
Greg Freemyer