File: newkernel

package info (click to toggle)
hibernate 1.07-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 316 kB
  • ctags: 52
  • sloc: sh: 1,014; makefile: 33
file content (26 lines) | stat: -rw-r--r-- 953 bytes parent folder | download
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
# -*- sh -*-
# vim:ft=sh:ts=8:sw=4:noet
#
# newkernel scriptlet - suggested by Martin F Krafft (madduck), and
# written by Cameron Patrick.  Based (very loosely) on the lockfile
# scriptlet.

NEWKERNELFILE="/var/run/suspend2-new-kernel"

AddSuspendHook 01 NewKernelFileCheck

# Check to see if $NEWKERNELFILE exists, and if so print a message and
# refuse to hibernate.
NewKernelFileCheck() {
    if ! [ -f "$NEWKERNELFILE" ]; then
	return 0 # no file present, so go ahead and hibernate
    fi
    vecho 0 "$EXE: You have upgraded your kernel, and a suspend image from this"
    vecho 0 "$EXE: kernel will not resume correctly with the new one.  Please"
    vecho 0 "$EXE: reboot your machine before suspending again."
    vecho 0 ""
    vecho 0 "$EXE: If you think this message is incorrect, or you know what you're"
    vecho 0 "$EXE: doing and want to suspend anyway, please remove $NEWKERNELFILE"
    return 2 # refuse to hibernate, even with -f
}