Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 141052 - sys-power/hibernate-script-1.93-r3 - hibernate-cleanup do mkswap not labeling partition
Summary: sys-power/hibernate-script-1.93-r3 - hibernate-cleanup do mkswap not labeling...
Status: RESOLVED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Christian Heim (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-19 09:13 UTC by Pavel Ruzicka
Modified: 2006-07-21 17:28 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
hibernate-cleanup-swaplabel.patch for udev systems (hibernate-cleanup-swaplabel.patch,507 bytes, patch)
2006-07-19 09:20 UTC, Pavel Ruzicka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Ruzicka 2006-07-19 09:13:13 UTC
Hello,

i am experiencing problem using /etc/init.d/hibernate-cleanup and LABELed swap partition on linux. It because this sript runs mkswap without -L option. swap parttion is than not found and also not used for that reason. My /etc/fstab looks like this:

LABEL=swap   none   swap    sw    0 0


possible patch, but afaik vol_id is available on udev systems only

# equery b `which vol_id`
[ Searching for file(s) /sbin/vol_id in *... ]
sys-fs/udev-087 (/sbin/vol_id)


--- /etc/init.d/hibernate-cleanup.orig  2006-07-19 01:51:20.000000000 +0200
+++ /etc/init.d/hibernate-cleanup       2006-07-19 18:01:08.000000000 +0200
@@ -29,8 +29,9 @@
        local where wason
        where=$1
        wason=
+       mkswap_label="`vol_id /dev/sda5 | awk -F = '$1 ~ /^ID_FS_LABEL$/ && $2 !~ /^$/ {print "-L", $2}'`"
        swapoff $where 2>/dev/null && wason=yes
-       mkswap $where > /dev/null || echo -n " (failed: $?)"
+       mkswap $mkswap_label $where > /dev/null || echo -n " (failed: $?)"
        [ -n "$wason" ] && swapon $where
 }
Comment 1 Pavel Ruzicka 2006-07-19 09:20:07 UTC
Created attachment 92217 [details, diff]
hibernate-cleanup-swaplabel.patch for udev systems

yet another fix in my patch (missing $where)
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-07-19 09:21:09 UTC
No idea what installs /etc/init.d/hibernate-cleanup... Reopen with ebuild name and version.
Comment 3 Pavel Ruzicka 2006-07-19 09:24:42 UTC
# equery b /etc/init.d/hibernate-cleanup
sys-power/hibernate-script-1.93-r3 (/etc/init.d/hibernate-cleanup)
Comment 4 Christian Heim (RETIRED) gentoo-dev 2006-07-20 00:22:42 UTC
I slightly altered it a bit (udev-096-r1 is having vol_id in /lib/udev), but the rest is nearly the same ...

Index: hibernate-script-1.93/init.d/hibernate-cleanup.sh
===================================================================
--- hibernate-script-1.93.orig/init.d/hibernate-cleanup.sh
+++ hibernate-script-1.93/init.d/hibernate-cleanup.sh
@@ -26,11 +26,19 @@ get_swap_id() {
 }

 clear_swap() {
-       local where wason
+       local where wason swap_label vol_id
        where=$1
        wason=
+
+       if [ -e /sbin/vol_id ] ; then
+               vol_id="/sbin/vol_id"
+       elif [ -e /lib/udev/vol_id ] ; then
+               vol_id="/lib/udev/vol_id"
+       fi
+
+       swap_label="$( ${vol_id} $where | awk -F = '$1 ~ /^ID_FS_LABEL$/ && $2 !~ /^$/ {print "-L", $2}' )"
        swapoff $where 2>/dev/null && wason=yes
-       mkswap $where > /dev/null || echo -n " (failed: $?)"
+       mkswap $swap_label $where > /dev/null || echo -n " (failed: $?)"
        [ -n "$wason" ] && swapon $where
 }
Comment 5 Christian Heim (RETIRED) gentoo-dev 2006-07-21 17:28:16 UTC
I guess I have to close that as LATER. I can't depend on it that everyone has udev on his system ..