Skip to content
Snippets Groups Projects
Commit ebfe6df9 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

reverse the CAD behavior but warn instead of crash in case of fail

parent e47ae735
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@
<h2>Interface</h2>
<pre>
66-boot [ -h ] [ -s <em>skel</em> ] [ -m ] [ -c ] [ -l <em>log_user</em> ] [ -e environment ] [ -d <em>dev</em> ] [ -b <em>banner</em> ]
66-boot [ -h ] [ -s <em>skel</em> ] [ -m ] [ -l <em>log_user</em> ] [ -e environment ] [ -d <em>dev</em> ] [ -b <em>banner</em> ]
</pre>
<p>
......@@ -47,9 +47,6 @@
By default, the <em>LIVE</em> basename is mounted if it not already a valid mountpoint. Otherwise without the <tt>-m</tt> option, it does nothing.
</li>
<li>
<tt><b>-c</b></tt> : enable the CTRL-ALT-DEL combination key ability.
</li>
<li>
<tt><b>-l <em>log_user</em></b></tt> : the catch&#8209;all logger will run as <em>log_user</em>. Default is <tt>%%s6log_user%%</tt>. The default can also be changed at compile-time by passing the <tt>&#8209;&#8209;with&#8209;s6&#8209;log&#8209;user=<em>user</em></tt> option to <tt>./configure</tt>.
</li>
......
......@@ -5,7 +5,7 @@
# SYNOPSIS
66-boot [ *-h* ] [ *-s* _skel_ ] [ *-m* ] [ *-c* ] [ *-l* _log_user_ ] [ *-e* _environment_ ] [ *-d* _dev_ ] [ *-b* _banner_ ]
66-boot [ *-h* ] [ *-s* _skel_ ] [ *-m* ] [ *-l* _log_user_ ] [ *-e* _environment_ ] [ *-d* _dev_ ] [ *-b* _banner_ ]
# DESCRIPTION
......@@ -30,9 +30,6 @@
the _LIVE_ basename is mounted if it not already a valid mountpoint.
Otherwise without the *-m* option, it does nothing.
*-c*
Enable the CTRL-ALT-DEL combination key ability.
*-l* _log_user_
The catch-all logger will run as the _log_user_ user. Default is *%%s6log_user%%*.
The default can also be changed at compile-time by passing the
......
......@@ -57,7 +57,7 @@ static char confile[MAXENV+1] ;
static char const *const *genv = 0 ;
static int fdin ;
#define USAGE "66-boot [ -h ] [ -m ] [ -c ] [ -s skel ] [ -l log_user ] [ -e environment ] [ -d dev ] [ -b banner ]"
#define USAGE "66-boot [ -h ] [ -m ] [ -s skel ] [ -l log_user ] [ -e environment ] [ -d dev ] [ -b banner ]"
static void sulogin(char const *msg,char const *arg)
{
......@@ -85,7 +85,6 @@ static inline void info_help (void)
"options :\n"
" -h: print this help\n"
" -m: mount parent live directory\n"
" -c: enable CTRL-ALT-DEL feature\n"
" -l: run catch-all logger as log_user user\n"
" -s: skeleton directory\n"
" -e: environment directory or file\n"
......@@ -230,7 +229,7 @@ int main(int argc, char const *const *argv,char const *const *envp)
unsigned int r , tmpfs = 0 ;
size_t bannerlen, livelen ;
pid_t pid ;
int opened = 0, cad = 0 ;
int opened = 0 ;
char verbo[UINT_FMT] ;
cver = verbo ;
stralloc envmodifs = STRALLOC_ZERO ;
......@@ -241,14 +240,13 @@ int main(int argc, char const *const *argv,char const *const *envp)
for (;;)
{
int opt = getopt_args(argc,argv, ">hmcs:e:d:b:l:", &l) ;
int opt = getopt_args(argc,argv, ">hms:e:d:b:l:", &l) ;
if (opt == -1) break ;
if (opt == -2) sulogin("options must be set first","") ;
switch (opt)
{
case 'h' : info_help(); return 0 ;
case 'm' : tmpfs = 1 ; break ;
case 'c' : cad = 1 ; break ;
case 's' : skel = l.arg ; break ;
case 'e' : envdir = l.arg ; break ;
case 'd' : slashdev = l.arg ; break ;
......@@ -361,8 +359,7 @@ int main(int argc, char const *const *argv,char const *const *envp)
pid = fork() ;
if (pid == -1) sulogin("fork: ",rcinit) ;
if (!pid) run_stage2(newenvp, 2, envmodifs.s,envmodifs.len) ;
if (cad)
if (reboot(RB_DISABLE_CAD) == -1) sulogin("trap ctrl-alt-del","") ;
if (reboot(RB_DISABLE_CAD) == -1) log_warnu("trap ctrl-alt-del","") ;
if (fd_copy(2, 1) == -1) sulogin("copy stderr to stdout","") ;
fd_close(fdin) ;
xpathexec_r(newargv, newenvp, 2, envmodifs.s, envmodifs.len) ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment