#! /bin/sh ### BEGIN INIT INFO # Provides: grub-common # Required-Start: $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Record successful boot for GRUB # Description: GRUB displays the boot menu at the next boot if it # believes that the previous boot failed. This script # informs it that the system booted successfully. ### END INIT INFO which grub-editenv >/dev/null !2 > !1 || exit 0 # Load the VERBOSE setting and other rcS variables source /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. source /lib/lsb/init-functions matchstr $1 { start|restart|force-reload { test $VERBOSE != no && log_action_msg "Recording successful boot for GRUB" test -s /boot/grub/grubenv || rm -f /boot/grub/grubenv mkdir -p /boot/grub grub-editenv /boot/grub/grubenv unset recordfail test $VERBOSE != no && log_end_msg $Status } stop { } status { exit 0 } * { echo "Usage: $0 {start|stop|status|restart|force-reload}" > !2 exit 3 } } exit 0 (CommandList children: [ (AndOr children: [ (SimpleCommand words: [{(which)} {(grub-editenv)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[41]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[44]) ] ) (C {(exit)} {(0)}) ] op_id: Op_DPipe ) (C {(.)} {(/lib/init/vars.sh)}) (C {(.)} {(/lib/lsb/init-functions)}) (Case to_match: {($ VSub_Number "$1")} arms: [ (case_arm pat_list: [{(start)} {(restart)} {(force-reload)}] action: [ (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$VERBOSE"))} {(KW_Bang "!") (Lit_Other "=")} {(no)} {(Lit_Other "]")} ) (C {(log_action_msg)} {(DQ ("Recording successful boot for GRUB"))}) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(-s)} {(/boot/grub/grubenv)} {(Lit_Other "]")}) (C {(rm)} {(-f)} {(/boot/grub/grubenv)}) ] op_id: Op_DPipe ) (C {(mkdir)} {(-p)} {(/boot/grub)}) (C {(grub-editenv)} {(/boot/grub/grubenv)} {(unset)} {(recordfail)}) (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$VERBOSE"))} {(KW_Bang "!") (Lit_Other "=")} {(no)} {(Lit_Other "]")} ) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] op_id: Op_DAmp ) ] spids: [80 85 163 -1] ) (case_arm pat_list:[{(stop)}] spids:[166167170-1]) (case_arm pat_list:[{(status)}] action:[(C {(exit)} {(0)})] spids:[173174182-1]) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Usage: ") ($ VSub_Number "$0") (" {start|stop|status|restart|force-reload}"))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[197])] ) (C {(exit)} {(3)}) ] spids: [185 186 206 -1] ) ] spids: [73 77 208] ) (C {(exit)} {(0)}) ] )