Commit b69e8c25 authored by Eric Vidal's avatar Eric Vidal 💬

add -c option: Avoid to enable the RB_DISABLE_CAD feature at boot time. If you...

add -c option: Avoid to enable the RB_DISABLE_CAD feature at boot time. If you are coming without initramfs or by a virtualization process like lxc, this feature crash the boot. So add the ability to remove it
parent 77163105
Pipeline #189312 passed with stage
in 1 minute and 12 seconds
......@@ -58,7 +58,7 @@ static char confile[MAXENV+1] ;
static char const *const *genv = 0 ;
static int fdin ;
#define USAGE "66-boot [ -h ] [ -m ] [ -s skel ] [ -l log_user ] [ -e environment ] [ -d dev ] [ -b banner ]"
#define USAGE "66-boot [ -h ] [ -m ] [ -c ] [ -s skel ] [ -l log_user ] [ -e environment ] [ -d dev ] [ -b banner ]"
static void sulogin(char const *msg,char const *arg)
{
......@@ -86,6 +86,7 @@ static inline void info_help (void)
"options :\n"
" -h: print this help\n"
" -m: mount parent live directory\n"
" -c: disable 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 +231,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 ;
int opened = 0, cad = 0 ;
char verbo[UINT_FMT] ;
cver = verbo ;
stralloc envmodifs = STRALLOC_ZERO ;
......@@ -241,13 +242,14 @@ int main(int argc, char const *const *argv,char const *const *envp)
for (;;)
{
int opt = getopt_args(argc,argv, ">hms:e:d:b:l:", &l) ;
int opt = getopt_args(argc,argv, ">hmcs: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 ;
......@@ -359,7 +361,8 @@ 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 (reboot(RB_DISABLE_CAD) == -1) sulogin("trap ctrl-alt-del","") ;
if (!cad)
if (reboot(RB_DISABLE_CAD) == -1) sulogin("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) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment