File: hibernate

package info (click to toggle)
bridge-utils 1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 376 kB
  • sloc: ansic: 1,305; sh: 694; makefile: 150
file content (38 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This is to be used with the hibernate package, it should be copied to
# /etc/hibernate/scriptlets.d/bridge
# To enable it add RecoverBridge to the network section of
# /etc/hibernate/common.conf

AddConfigHandler BridgeOptions

BridgeSuspend() {
    for i in `/sbin/brctl show|sed -n "s/^[^ ]*\t\([^\t]*\)/\1/p"`
    do
      ip link set dev $i down
    done
    return 0
}

BridgeResume() {
    for i in `/sbin/brctl show|sed -n "s/^[^ ]*\t\([^\t]*\)/\1/p"`
    do
      ip link set dev $i up
    done
    return 0
}

BridgeOptions() {
    case $1 in
        recoverbridge)
            ;;
        *)
            return 1
    esac

    if [ -z "$BRIDGE_HOOKED" ] ; then
        AddSuspendHook 65 BridgeSuspend
        AddResumeHook 65 BridgeResume
        BRIDGE_HOOKED=1
    fi
    return 0
}