View | Details | Raw Unified | Return to bug 5553
Collapse All | Expand All

(-)../bak/filesystems (-1 / +29 lines)
Lines 4-10 Link Here
4
AddConfigHandler FilesystemsOptions
4
AddConfigHandler FilesystemsOptions
5
AddConfigHelp "Unmount <mount point or device> [...]" "If you have network shares or external devices that should be unmounted before suspending, list them here."
5
AddConfigHelp "Unmount <mount point or device> [...]" "If you have network shares or external devices that should be unmounted before suspending, list them here."
6
AddConfigHelp "Mount <mount point or device> [...]" "If you have network shares or external devices that should be mounted after resuming, list them here."
6
AddConfigHelp "Mount <mount point or device> [...]" "If you have network shares or external devices that should be mounted after resuming, list them here."
7
AddConfigHelp "UnmountFSTypes <fylesystem type> [...]" "Unmount fylesystems by type. Useful for unmounting all filesystems of specific type which are not in /etc/fstab, e.g. manually mounted cifs or smbfs fylesystems"
8
AddConfigHelp "UnmountSleepTime <number>[smhd]" "Time to sleep before sending SIGKILL for processes using filesystems to be unmounted. The parameter value is a number of seconds, suffix has the same meaning as for sleep(1)"
7
9
10
sleeptime=1
8
FilesystemsUnmount() {
11
FilesystemsUnmount() {
9
    local mnt
12
    local mnt
10
    local ret
13
    local ret
Lines 24-30 FilesystemsUnmount() { Link Here
24
	done
27
	done
25
    fi
28
    fi
26
29
27
    [ "$needsleep" -eq 1 ] && sleep 1
30
    [ "$needsleep" -eq 1 ] && sleep $sleeptime
28
31
29
    # Send KILL to processes and unmount
32
    # Send KILL to processes and unmount
30
    ret=0
33
    ret=0
Lines 54-59 FilesystemsMount() { Link Here
54
    return $ret
57
    return $ret
55
}
58
}
56
59
60
FSTypesUnmount() {
61
    local fstype
62
    [ -z "$FS_TYPES" ] && return 0
63
64
    ret=0
65
    FS_UNMOUNTS_SAVE="$FS_UNMOUNTS"
66
    for fstype in $FS_TYPES; do
67
	FS_UNMOUNTS=`awk '($3 == "'$fstype'") {print $2}' /proc/mounts |sort -r`
68
	vecho 2 "Filesystems of type \"$fstype\" to unmount: $FS_UNMOUNTS"
69
	FilesystemsUnmount || ret=1
70
    done
71
72
    FS_UNMOUNTS="$FS_UNMOUNTS_SAVE"
73
    return $ret
74
}
75
57
FilesystemsOptions() {
76
FilesystemsOptions() {
58
    case $1 in
77
    case $1 in
59
	unmount)
78
	unmount)
Lines 61-71 FilesystemsOptions() { Link Here
61
	    shift
80
	    shift
62
	    FS_UNMOUNTS="$FS_UNMOUNTS $@"
81
	    FS_UNMOUNTS="$FS_UNMOUNTS $@"
63
	    ;;
82
	    ;;
83
	unmountfstypes)
84
	    [ -z "$FS_TYPES" ] && AddSuspendHook 45 FSTypesUnmount
85
	    shift
86
	    FS_TYPES="$FS_TYPES $@"
87
	    ;;
64
	mount)
88
	mount)
65
	    [ -z "$FS_MOUNTS" ] && AddResumeHook 50 FilesystemsMount
89
	    [ -z "$FS_MOUNTS" ] && AddResumeHook 50 FilesystemsMount
66
	    shift
90
	    shift
67
	    FS_MOUNTS="$FS_MOUNTS $@"
91
	    FS_MOUNTS="$FS_MOUNTS $@"
68
	    ;;
92
	    ;;
93
	unmountsleeptime)
94
	    shift
95
	    sleeptime="$1"
96
	    ;;
69
	*)
97
	*)
70
	    return 1
98
	    return 1
71
    esac
99
    esac

Return to bug 5553