Welcome to little lamb

Code » anopa » jjk » tree

[jjk] / src / scripts / aa-poststage2

#!@BINDIR@/execlineb -s1
#
# anopa - Copyright (C) 2015-2017 Olivier Brunel
#
# aa-post-stage2
# Copyright (C) 2018 Olivier Brunel <jjk@jjacky.com>
#
# This file is part of anopa.
#
# anopa is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# anopa is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# anopa. If not, see http://www.gnu.org/licenses/
#

# Open a shell if the return code ($1) contains either:
# - bit 1 set, i.e. fatal error
# - bit 16 set, i.e. at least one essential service failed
ifelse { aa-bw $1 17 }
{
    foreground { aa-echo -O3 -Be "System initialization failed" }
    foreground { aa-echo -O3 -t "Trying to open a shell; " +g exit +w " to continue" }
    emptyenv -c sh -i
}
# Else we announce success, even if some services might have failed.
foreground { aa-echo -O3 -B "System ready." }
# But in case everything was good, switch to tty2
if { aa-bw -e $1 0 } chvt 2