diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/s6-linux-init-maker.html | 11 | ||||
-rw-r--r-- | doc/upgrade.html | 12 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | package/modes | 16 | ||||
-rwxr-xr-x | skel/runlevel | 3 | ||||
-rw-r--r-- | src/init/s6-linux-init-maker.c | 45 |
9 files changed, 73 insertions, 30 deletions
@@ -5,3 +5,4 @@ Thanks to: Colin Booth <colin@heliocat.net> multiplexd <multiplexd@gmx.com> Luis Ressel <aranea@aixah.de> + Samuel Holland <samuel@sholland.org> @@ -1,5 +1,16 @@ Changelog for s6-linux-init. +In 1.0.1.0 +---------- + + - New -f option to s6-linux-init-maker, for use +in distribution packaging scripts with a staging directory. + - Better permissions on the binaries. + - The skeleton runlevel script now includes a guard to +avoid calling the service manager without an argument. + - /run/uncaught-logs directory permissions changed to 02750. + + In 1.0.0.0 ---------- diff --git a/doc/index.html b/doc/index.html index 4cffd46..cb9cd58 100644 --- a/doc/index.html +++ b/doc/index.html @@ -110,7 +110,7 @@ all the other packages against the <em>static</em> version of libskarnet. <ul> <li> The current released version of s6-linux-init is -<a href="s6-linux-init-1.0.0.0.tar.gz">1.0.0.0</a>. </li> +<a href="s6-linux-init-1.0.1.0.tar.gz">1.0.1.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-linux-init/">s6-linux-init git repository</a>: diff --git a/doc/s6-linux-init-maker.html b/doc/s6-linux-init-maker.html index 34fa829..218af02 100644 --- a/doc/s6-linux-init-maker.html +++ b/doc/s6-linux-init-maker.html @@ -59,7 +59,8 @@ machine</em>. If it is not the case, the system will fail to boot. [ -e <em>initial_envvar</em> ] ... \ [ -q <em>finalsleeptime</em> ] \ [ -D <em>initdefault</em> ] \ - [ -n | -N ] + [ -n | -N ] \ + [ -f <em>skeldir</em> ] \ [ -U <em>utmp_user</em> ] \ <em>dir</em> </pre> @@ -295,6 +296,14 @@ option if your rootfs is read-only: failure to write to <tt>/run</tt> will cause init to die and the kernel to panic. This option is incompatible with the <tt>-n</tt> option. </li> <p /> + <li> <tt>-f</tt> <em>skeldir</em> : copy the skeleton +scripts from directory <em>skeldir</em>. By default, <em>skeldir</em> +is <tt>/etc/s6-linux-init/skel</tt>, or the directory that has been +given as an argument to the <tt>--skeldir</tt> configure option at +build time. This option is typically useful when distributions run +<tt>s6-linux-init-maker</tt> in packaging scripts, when preparing +files in a staging directory. </li> <p /> + <li> <tt>-U</tt> <em>utmp_user</em> : this option is only available when the s6-linux-init package has been built with the <tt>--enable-utmps</tt> configure option, that enables support for the diff --git a/doc/upgrade.html b/doc/upgrade.html index 7c27f49..3804ac6 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,18 @@ <h1> What has changed in s6-linux-init </h1> +<h2> in 1.0.1.0 </h2> + +<ul> + <li> <tt>-f</tt> option added to +<a href="s6-linux-init-maker.html">s6-linux-init-maker</a> for use +in distribution packaging scripts with a staging directory. </li> + <li> Permissions on the binaries have been adjusted. </li> + <li> The skeleton <tt>runlevel</tt> script now includes a guard to +avoid calling the service manager without an argument. </li> + <li> The permissions of the <tt>/run/uncaught-logs</tt> directory +in the generated image have been changed to 02750. </li> +</ul> <h2> in 1.0.0.0 </h2> diff --git a/package/info b/package/info index d58a5f1..f5264c0 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-linux-init -version=1.0.0.0 +version=1.0.1.0 category=admin package_macro_name=S6_LINUX_INIT diff --git a/package/modes b/package/modes index ab52a84..f2c9b24 100644 --- a/package/modes +++ b/package/modes @@ -1,9 +1,9 @@ -s6-linux-init 0700 -s6-linux-init-hpr 0750 -s6-linux-init-shutdown 0755 -s6-linux-init-shutdownd 0700 -s6-linux-init-telinit 0750 -s6-linux-init-logouthookd 0700 +s6-linux-init 0744 +s6-linux-init-hpr 0744 +s6-linux-init-shutdown 0744 +s6-linux-init-shutdownd 0744 +s6-linux-init-telinit 0744 +s6-linux-init-logouthookd 0744 s6-linux-init-echo 0755 -s6-linux-init-umountall 0750 -s6-linux-init-maker 0700 +s6-linux-init-umountall 0744 +s6-linux-init-maker 0744 diff --git a/skel/runlevel b/skel/runlevel index 51789f3..8ca2fd1 100755 --- a/skel/runlevel +++ b/skel/runlevel @@ -5,6 +5,9 @@ ### requests a machine state change via telinit. ### Ideally, it should just be a call to the service manager. +test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } + + ### If your services are managed by sysv-rc: # exec /etc/init.d/rc "$1" diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index 1005811..8de17fe 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -28,12 +28,12 @@ #ifdef S6_LINUX_INIT_UTMPD_PATH # include <utmps/config.h> -# define USAGE "s6-linux-init-maker [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] [ -U utmp_user ] dir" -# define OPTION_STRING "c:u:G:1Lp:m:t:d:s:e:E:q:D:nNU:" +# define USAGE "s6-linux-init-maker [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] [ -f skeldir ] [ -U utmp_user ] dir" +# define OPTION_STRING "c:u:G:1Lp:m:t:d:s:e:E:q:D:nNf:U:" # define UTMPS_DIR "utmps" #else -# define USAGE "s6-linux-init-maker [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] dir" -# define OPTION_STRING "c:u:G:1Lp:m:t:d:s:e:E:q:D:nN" +# define USAGE "s6-linux-init-maker [ -c basedir ] [ -u log_user ] [ -G early_getty_cmd ] [ -1 ] [ -L ] [ -p initial_path ] [ -m initial_umask ] [ -t timestamp_style ] [ -d slashdev ] [ -s env_store ] [ -e initial_envvar ... ] [ -q default_grace_time ] [ -D initdefault ] [ -n | -N ] [ -f skeldir ] dir" +# define OPTION_STRING "c:u:G:1Lp:m:t:d:s:e:E:q:D:nNf:" #endif #define dieusage() strerr_dieusage(100, USAGE) @@ -48,6 +48,7 @@ static char const *early_getty = 0 ; static char const *slashdev = 0 ; static char const *log_user = "root" ; static char const *initdefault = 0 ; +static char const *skeldir = S6_LINUX_INIT_SKELDIR ; static unsigned int initial_umask = 0022 ; static unsigned int timestamp_style = 1 ; static unsigned int finalsleep = 3000 ; @@ -272,10 +273,10 @@ static void auto_dir_internal (char const *base, char const *dir, uid_t uid, gid { if (errno != EEXIST || strict) goto err ; } - else if (uid || gid) + else { - if (chown(fn, uid, gid) < 0 - || chmod(fn, mode) < 0) goto err ; + if ((uid || gid) && chown(fn, uid, gid) < 0) goto err ; + if (mode & 07000 && chmod(fn, mode) < 0) goto err ; } return ; @@ -358,18 +359,23 @@ static void auto_script (char const *base, char const *file, writetobuf_func_t_r fd_close(fd) ; } -static void copy_script (char const *base, char const *src, char const *dst) +static void copy_script (char const *base, char const *name) { size_t baselen = strlen(base) ; - size_t dstlen = strlen(dst) ; - char fn[baselen + dstlen + 2] ; - memcpy(fn, base, baselen) ; - fn[baselen] = '/' ; - memcpy(fn + baselen + 1, dst, dstlen + 1) ; - if (!filecopy_unsafe(src, fn, 0755)) + size_t namelen = strlen(name) ; + size_t skellen = strlen(skeldir) ; + char dst[baselen + sizeof("/scripts/") + namelen] ; + char src[skellen + namelen + 2] ; + memcpy(dst, base, baselen) ; + memcpy(dst + baselen, "/scripts/", sizeof("/scripts/") - 1) ; + memcpy(dst + baselen + sizeof("/scripts/") - 1, name, namelen + 1) ; + memcpy(src, skeldir, skellen) ; + src[skellen] = '/' ; + memcpy(src + skellen + 1, name, namelen + 1) ; + if (!filecopy_unsafe(src, dst, 0755)) { cleanup(base) ; - strerr_diefu4sys(111, "copy ", src, " to ", fn) ; + strerr_diefu4sys(111, "copy ", src, " to ", dst) ; } } @@ -498,7 +504,7 @@ static inline void make_image (char const *base) uid_t uid ; gid_t gid ; getug(base, log_user, &uid, &gid) ; - auto_dir(base, "run-image/" UNCAUGHT_DIR, uid, gid, 02700) ; + auto_dir(base, "run-image/" UNCAUGHT_DIR, uid, gid, 02750) ; } auto_dir(base, "run-image/" SCANDIR, 0, 0, 0755) ; auto_dir(base, "run-image/" SCANDIR "/.s6-svscan", 0, 0, 0755) ; @@ -545,9 +551,9 @@ static inline void make_image (char const *base) static inline void make_scripts (char const *base) { auto_dir(base, "scripts", 0, 0, 0755) ; - copy_script(base, S6_LINUX_INIT_SKELDIR "/runlevel", "scripts/runlevel") ; - copy_script(base, S6_LINUX_INIT_SKELDIR "/" STAGE2, "scripts/" STAGE2) ; - copy_script(base, S6_LINUX_INIT_SKELDIR "/" STAGE3, "scripts/" STAGE3) ; + copy_script(base, "runlevel") ; + copy_script(base, STAGE2) ; + copy_script(base, STAGE3) ; } static inline void make_bins (char const *base) @@ -587,6 +593,7 @@ int main (int argc, char const *const *argv, char const *const *envp) case 'D' : initdefault = l.arg ; break ; case 'n' : mounttype = 2 ; break ; case 'N' : mounttype = 0 ; break ; + case 'f' : skeldir = l.arg ; break ; #ifdef S6_LINUX_INIT_UTMPD_PATH case 'U' : utmp_user = l.arg ; break ; #endif |