Package: hibernate
Version: 1.97-1
Severity: wishlist
Tags: patch

Imagine following situation: I will do
 $ ifup eth0=home
then I will hibernate my laptop. Network scriptlet from hibernate
package does:
 ifdown eth0
 ifup eth0
 (i.e. ifup eth0=eth0).
Now I suppose I have more than one configuration in /etc/network/interfaces
 * if I have there 'map' section, then ifup eth0 is probably ok as
   the mapping script guesses what logical configuration use with given
   interface.
 * if I have no 'map' section, then I surely want to bring the device up
   in state it was brought down. To achieve this, I added UpNoRemap option
   to the network scriptlet. I use /etc/network/run/ifstate to get
   actual configuration of given interface.

----Here is my patch---
--- /usr/share/hibernate/scriptlets.d/network   2007-10-22 15:06:52.000000000 
+0200
+++ /etc/hibernate/scriptlets.d/network 2008-01-17 14:31:40.000000000 +0100
@@ -4,6 +4,7 @@
 AddConfigHandler NetworkConfigOptions
 AddConfigHelp "DownInterfaces auto|<ifname> [...]" "The names of network 
interfaces to bring down before suspending. If the parameter \"auto\" is given, 
all interfaces which are not lo are brought down."
 AddConfigHelp "UpInterfaces auto|<ifname> [...]" "The names of network 
interfaces to bring up after suspending. If the parameter \"auto\" is given, 
the interfaces stopped before suspending will be started in reverse order."
+AddConfigHelp "UpNoRemap <boolean>" "Save mapping to logical interface for 
'UpInterfaces auto'. (Works only if 'Distribution debian' is set."
 
 NetworkStop() {
     # If the script stops networking altogether, there's not much we can do.
@@ -73,6 +74,13 @@
        upinterfaces)
            NETWORK_UPIFS="$NETWORK_UPIFS $* "
            ;;
+       upnoremap)
+           if BoolIsOn "$opt" "$1"; then
+               NETWORK_NOREMAP=true
+           else
+               NETWORK_NOREMAP=false
+           fi
+           ;;
        *)
            return 1
     esac
@@ -114,10 +122,16 @@
                    --startas /sbin/ifup --name "hibernate_ifup_$1" -- $*
            }
            network_ifdown() {
+               if [ "xtrue" != "x$NETWORK_NOREMAP" ]; then
+                       _IFACE=$1
+               else
+                       _IFACE=`egrep "^$1" /etc/network/run/ifstate`
+                       if [ -z "$_IFACE" ]; then _IFACE=$1; fi
+               fi
                 STDERR="$(/sbin/ifdown $1 2>&1 1>/dev/null)" || return $?
                 case "$STDERR" in
                     "/sbin/ifdown: interface $1 not configured") :;;
-                    *) echo $1;;
+                    *) echo $_IFACE;;
                 esac
             }
            ;;
----End of patch---

-- Package-specific info:
--- configuration
==> /etc/hibernate/common.conf <==
Verbosity 0
LogFile /var/log/hibernate.log
LogVerbosity 3
Distribution debian
SaveClock restore-only
UnloadModules video
UnloadBlacklistedModules yes
LoadModules auto
DownInterfaces eth0
UpInterfaces auto
UpNoRemap yes
SwitchToTextMode yes
==> /etc/hibernate/disk.conf <==
TryMethod ususpend-disk.conf
TryMethod sysfs-disk.conf
==> /etc/hibernate/hibernate.conf <==
TryMethod suspend2.conf
TryMethod disk.conf
TryMethod ram.conf
==> /etc/hibernate/ram.conf <==
TryMethod ususpend-ram.conf
TryMethod sysfs-ram.conf
==> /etc/hibernate/suspend2.conf <==
UseSuspend2 yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
Compressor lzf
Encryptor none
FullSpeedCPU yes
Include common.conf
==> /etc/hibernate/sysfs-disk.conf <==
UseSysfsPowerState disk
Include common.conf
==> /etc/hibernate/sysfs-ram.conf <==
UseSysfsPowerState mem
Include common.conf
==> /etc/hibernate/ususpend-both.conf <==
USuspendMethod both
Include common.conf
==> /etc/hibernate/ususpend-disk.conf <==
USuspendMethod disk
Include common.conf
==> /etc/hibernate/ususpend-ram.conf <==
USuspendMethod ram
Include common.conf

--- /sys/power
==> /sys/power/disk <==
[platform] test testproc shutdown reboot 
==> /sys/power/image_size <==
427031674
==> /sys/power/resume <==
8:5
==> /sys/power/state <==
mem disk

--- log
Starting suspend at Thu Jan 17 14:29:01 CET 2008
hibernate: [01] Executing CheckLastResume ... 
hibernate: [01] Executing CheckRunlevel ... 
hibernate: [01] Executing LockFileGet ... 
hibernate: [01] Executing NewKernelFileCheck ... 
hibernate: [10] Executing EnsureUSuspendCapable ... 
hibernate: [11] Executing XHacksSuspendHook1 ... 
hibernate: [59] Executing RemountXFSBootRO ... 
hibernate: [60] Executing NetworkStop ... 
Bringing down interface eth0
hibernate: [89] Executing SaveKernelModprobe ... 
Saved /proc/sys/kernel/modprobe is /sbin/modprobe
hibernate: [90] Executing ModulesUnload ... 
Unloading module video... Removing modules with rmmod.

hibernate: [91] Executing ModulesUnloadBlacklist ... 
Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules
Module version for ipw2100 is 66050
Module version for ipw2200 is 66050
Module version for snd_bt_sco is 
Module version for ndiswrapper is 78592
hibernate: [95] Executing XHacksSuspendHook2 ... 
xhacks: changing console from 7 to 15
hibernate: [98] Executing CheckRunlevel ... 
hibernate: [99] Executing DoUSuspend ... 
hibernate: Running /usr/sbin/s2disk ...
hibernate: [90] Executing ModulesLoad ... 
Loading module video (from auto)...
hibernate: [89] Executing RestoreKernelModprobe ... 
hibernate: [85] Executing XHacksResumeHook2 ... 
xhacks: changing console back to 7
hibernate: [70] Executing ClockRestore ... 
hibernate: [60] Executing NetworkStart ... 
Bringing up interface eth0=eth0 (from auto)
hibernate: [59] Executing RemountXFSBootRW ... 
hibernate: [11] Executing XHacksResumeHook1 ... 
hibernate: [01] Executing NoteLastResume ... 
hibernate: [01] Executing LockFilePut ... 
Resumed at Thu Jan 17 14:29:38 CET 2008

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.23-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hibernate depends on:
ii  console-tools              1:0.2.3dbs-65 Linux console and font utilities

Versions of packages hibernate recommends:
ii  dash                   0.5.3-7           The Debian Almquist Shell
ii  hdparm                 7.7-1             tune hard disk parameters for high
ii  uswsusp                0.3~cvs20060928-7 tools to use userspace software su
ii  vbetool                1.0-1.1           run real-mode video BIOS code to a

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to