Commit 5190f77e authored by Eric Vidal's avatar Eric Vidal

Merge branch 'dev'

parents a151c446 01b3a0df
......@@ -43,7 +43,8 @@
</li>
<li>
<tt><b>-m</b></tt> : umount the basename of the <em>LIVE</em> directory set in the <tt>init.conf</tt> skeleton file and mount a tmpfs on it. This is the default.
<tt><b>-m</b></tt> : umount the basename of the <em>LIVE</em> directory set into the <tt>init.conf</tt> skeleton file if it already mounted and mount a tmpfs on it.
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>
......@@ -88,7 +89,6 @@
<li>
It becomes a session leader.
</li>
<li>
It mounts a devtmpfs on <em>dev</em>, if requested.
</li>
......@@ -98,7 +98,7 @@
</li>
<li>
It checks if the <em>LIVE</em> basename is a valid mountpoint and if so unmounts it. If requested it then mounts a tmpfs on top. If the <em>LIVE</em> basename is not a valid mountpoint it directly mounts tmpfs.
It checks if the <em>LIVE</em> basename is a valid mountpoint and if so mounts it. If requested, it unmounts if the <em>LIVE</em> basename is a valid mountpoint and performs a mount.
</li>
<li>
......@@ -247,7 +247,7 @@
<br><hr>
<p>
The following skeleton files are called to execute their corresponding power related functions and are safe wrappers that accept their corresponding command options. They <strong>should be copied or symlinked</strong> to the binary directory of the system.
The following skeleton files are called to execute their corresponding power related functions and are safe wrappers that accept their corresponding command options. They <b>should be copied or symlinked</b> to the binary directory of the system.
</p>
<li>
......
......@@ -23,7 +23,7 @@
<h2> Interface </h2>
<pre>
66-scandir [ -h help ] [ -v <em>verbosity</em> ] [ -b ] [ -l <em>live</em> ] [ -t <em>rescan</em> ] [ -L <em>log_user</em> ] [ -s <em>skel</em> ] [ -e <em>environment</em> ] [ -c | r | u ] owner
66-scandir [ -h help ] [ -v <em>verbosity</em> ] [ -b ] [ -l <em>live</em> ] [ -d notif ][ -t <em>rescan</em> ] [ -L <em>log_user</em> ] [ -s <em>skel</em> ] [ -e <em>environment</em> ] [ -c | r | u ] owner
</pre>
<p>
......@@ -48,7 +48,9 @@
<li>
<tt><b>-l <em>live</em></b></tt> : an absolute path. create the <tt><em>scandir</em></tt> at <em>live</em>. Default is <tt>%%livedir%%</tt>. The default can also be changed at compile-time by passing the <tt>&#8209;&#8209;livedir=<em>live</em></tt> option to <tt>./configure</tt>. Should be available within a writable filesystem - likely a RAM filesystem.
</li>
<li>
<tt><b>-d <em>notif</em></b></tt> : notify readiness on file descriptor notif. When <tt><em>scandir</em></tt> is ready to accept commands from <a href="66-scanctl.html">66&#8209;scanctl</a>, it will write a newline to <tt>notif</tt>. <tt>notif</tt> cannot be lesser than 3. By default, no notification is sent. If <tt>-b</tt> is set, this option have no effects.
</li>
<li>
<tt><b>-t <em>rescan</em></b></tt> : perform a scan every <tt><em>rescan</em></tt> milliseconds. If <tt><em>rescan</em></tt> is set to <tty>0</tty> (the default), automatic scans are never performed after the first one and s6&#8209;svscan will only detect new services by issuing either <tt><em>66&#8209;scanctl reload</em></tt> or <tt><em><a href="https://skarnet.org/software/s6/s6-svscanctl.html">s6&#8209;svscanctl &#8209;a</a></em></tt>. It is <em>strongly</em> discouraged to set <tt><em>rescan</em></tt> to a positive value under 500.
</li>
......
......@@ -25,6 +25,11 @@
*-m*
Umount the basename of the _LIVE_ directory set into the _init.conf_
skeleton file and mount a tmpfs on it. This is the default.
Umount the basename of the _LIVE_ directory set into the _init.conf_
skeleton file if it already mounted and mount a tmpfs on it. By default,
the _LIVE_ basename is mounted if it not already a valid mountpoint.
Otherwise without the *-m* option, it does nothing.
*-l* _log_user_
The catch-all logger will run as the _log_user_ user. Default is *root*.
......@@ -58,9 +63,9 @@ When booting a system, *66-boot* performs the following operations:
- It mounts a devtmpfs on */dev*, if requested.
- It uses */dev/null* as its stdin (instead of */dev/console*).
- *dev/console* is still used, for now, as stdout and stderr.
- It check the _LIVE_ basename as valid mountpoint and unmount it in such
case then mount a tmpfs on it if requested. If _LIVE_ basename is not
valid mountpoint it mount directly a tmpfs on it.
- It checks if the _LIVE_ basename is a valid mountpoint and if so mounts it.
If requested, it unmounts if the _LIVE_ basename is a valid mountpoint
and performs a mount.
- It create _LIVE_ directory invocating
"66-scandir -v _VERBOSITY_ -l _LIVE_ -b -c -s _skel_" more "-L user_log" if
requested.
......
......@@ -39,6 +39,12 @@ explicitely set then the user of the current process will be used instead.
\--livedir=_live_ option to *./configure*. Should be under a writable
filesystem - likely a RAM filesystem.
*-d* _notif_
notify readiness on file descriptor _notif_. When scandir is ready to
accept commands from *66-scanctl*, it will write a newline to _notif_.
_notif_ cannot be lesser than 3. By default, no notification is sent.
if *-b* is set, this option have no effects.
*-t* _rescan_
Perform a scan every _rescan_ milliseconds. If _rescan_ is set to *0*
(the default), automatic scans are never performed after the first
......
#!@EXECLINE_SHEBANGPREFIX@/execlineb -P
66-boot -m
66-boot
......@@ -299,17 +299,17 @@ int main(int argc, char const *const *argv,char const *const *envp)
if (!opened)
if (open("/dev/null", O_RDONLY)) sulogin("open: ", "/dev/null") ;
if (tmpfs)
char fs[livelen + 1] ;
split_tmpfs(fs,live) ;
r = is_mnt(fs) ;
if (!r || tmpfs)
{
char fs[livelen + 1] ;
split_tmpfs(fs,live) ;
r = is_mnt(fs) ;
if (r)
if (r && tmpfs)
{
strerr_warni2x("Umount: ",fs) ;
if (umount(fs) == -1) sulogin ("umount: ",fs ) ;
}
strerr_warni2x("Mount: ",fs) ;
if (mount("tmpfs", fs, "tmpfs", MS_NODEV | MS_NOSUID, "mode=0755") == -1)
sulogin("mount: ",fs) ;
......
......@@ -15,6 +15,9 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
//#include <stdio.h>
#include <oblibs/obgetopt.h>
#include <oblibs/error2.h>
......@@ -38,8 +41,6 @@
#include <66/constants.h>
#include <66/environ.h>
//#include <stdio.h>
#define CRASH 0
#define FINISH 1
#define HUP 2
......@@ -63,8 +64,9 @@ static char const *skel = SS_SKEL_DIR ;
static char const *log_user = "root" ;
static unsigned int BOOT = 0 ;
unsigned int VERBOSITY = 1 ;
unsigned int NOTIF = 0 ;
#define USAGE "66-scandir [ -h ] [ -v verbosity ] [ -b ] [ -l live ] [ -t rescan ] [ -L log_user ] [ -s skel ] [ -e environment ] [ -c | u | r ] owner"
#define USAGE "66-scandir [ -h ] [ -v verbosity ] [ -b ] [ -l live ] [ -d notif ] [ -t rescan ] [ -L log_user ] [ -s skel ] [ -e environment ] [ -c | u | r ] owner"
static inline void info_help (void)
{
......@@ -76,6 +78,7 @@ static inline void info_help (void)
" -v: increase/decrease verbosity\n"
" -b: create scandir for a boot process\n"
" -l: live directory\n"
" -d: notify readiness on file descriptor\n"
" -t: rescan scandir every milliseconds\n"
" -L: run catch-all logger as log_user user\n"
" -s: skeleton directory\n"
......@@ -100,12 +103,19 @@ void scandir_up(char const *scandir, unsigned int timeout, char const *const *en
return ;
}
char const *newup[6] ;
unsigned int no = NOTIF ? 2 : 0 ;
char const *newup[6 + no] ;
unsigned int m = 0 ;
char fmt[UINT_FMT] ;
fmt[uint_fmt(fmt, timeout)] = 0 ;
char notif[UINT_FMT] ;
notif[uint_fmt(notif, NOTIF)] = 0 ;
newup[m++] = S6_BINPREFIX "s6-svscan" ;
if (no) {
newup[m++] = "-d" ;
newup[m++] = notif ;
}
newup[m++] = "-st" ;
newup[m++] = fmt ;
newup[m++] = "--" ;
......@@ -479,7 +489,7 @@ int main(int argc, char const *const *argv, char const *const *envp)
for (;;)
{
int opt = getopt_args(argc,argv, ">hv:bl:t:s:e:cruL:", &l) ;
int opt = getopt_args(argc,argv, ">hv:bl:d:t:s:e:cruL:", &l) ;
if (opt == -1) break ;
if (opt == -2) strerr_dief1x(110,"options must be set first") ;
switch (opt)
......@@ -490,6 +500,10 @@ int main(int argc, char const *const *argv, char const *const *envp)
case 'l' : if(!stralloc_cats(&live,l.arg)) retstralloc(111,"main") ;
if(!stralloc_0(&live)) retstralloc(111,"main") ;
break ;
case 'd' : if (!uint0_scan(l.arg, &NOTIF)) exitusage(USAGE) ;
if (NOTIF < 3) strerr_dief1x(110, "notification fd must be 3 or more") ;
if (fcntl(NOTIF, F_GETFD) < 0) strerr_dief1sys(110, "invalid notification fd") ;
break ;
case 't' : if (!uint0_scan(l.arg, &rescan)) break ;
case 's' : skel = l.arg ; break ;
case 'e' : if(!stralloc_cats(&envdir,l.arg)) retstralloc(111,"main") ;
......@@ -507,7 +521,8 @@ int main(int argc, char const *const *argv, char const *const *envp)
if (!argc) OWNER = MYUID ;
else if (!youruid(&OWNER,argv[0])) strerr_diefu2sys(111,"set uid of: ",argv[0]) ;
if (BOOT && NOTIF) NOTIF = 0 ;
if (BOOT && OWNER) strerr_dief1x(110,"-b options can be set only with root") ;
OWNERSTR[uid_fmt(OWNERSTR,OWNER)] = 0 ;
......
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