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

Merge branch 'master' into dev

parents 2efcd61d 51709b02
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,11 @@ Build Instructions ...@@ -5,11 +5,11 @@ Build Instructions
- A POSIX-compliant C development environment - A POSIX-compliant C development environment
- GNU make version 3.81 or later - GNU make version 3.81 or later
- skalibs version 2.10.0.0 or later: http://skarnet.org/software/skalibs/ - skalibs version 2.10.0.3: http://skarnet.org/software/skalibs/
- execline version 2.7.0.0 or later: http://skarnet.org/software/execline/ - execline version 2.8.0.1: http://skarnet.org/software/execline/
- s6 version 2.10.0.0 or later: http://skarnet.org/software/s6/ - s6 version 2.10.0.3: http://skarnet.org/software/s6/
- s6-rc version 0.5.2.1 or later: http://skarnet.org/software/s6-rc/ - s6-rc version 0.5.2.2: http://skarnet.org/software/s6-rc/
- oblibs version 0.1.3.0 or later: https://framagit.org/Obarun/oblibs/ - oblibs version 0.1.3.0: https://framagit.org/Obarun/oblibs/
- lowdown version 0.6.4 or later for man and html pages: https://kristaps.bsd.lv/lowdown/ - lowdown version 0.6.4 or later for man and html pages: https://kristaps.bsd.lv/lowdown/
- linux-api-headers 5.8 or later: https://www.gnu.org/software/libc (only for linux system) - linux-api-headers 5.8 or later: https://www.gnu.org/software/libc (only for linux system)
...@@ -64,27 +64,6 @@ cross-compiled skalibs, the rest is easy. ...@@ -64,27 +64,6 @@ cross-compiled skalibs, the rest is easy.
- Make sure to use the correct version of skalibs for your target, and the correct sysdeps directory, making use of the *--with-include*, *--with-lib*, *--with-dynlib* and *--with-sysdeps* - Make sure to use the correct version of skalibs for your target, and the correct sysdeps directory, making use of the *--with-include*, *--with-lib*, *--with-dynlib* and *--with-sysdeps*
options as necessary. options as necessary.
## The slashpackage convention
The [slashpackage convention](http://cr.yp.to/slashpackage.html) is a package installation scheme that provides a few guarantees over other conventions such as the FHS, for instance fixed absolute pathnames. obarun.org packages support it: use the *--enable-slashpackage* option to configure, or *--enable-slashpackage=DIR* for a prefixed DIR/package tree. This option will activate slashpackage support during the build and set slashpackage-compatible installation directories. If
$version is the current 66 version number:
- *--bindir* will be set to /package/prog/66-$version/command
- *--includedir* will be set to /package/prog/66-$version/include
- *--libdir* will be set to /package/prog/66-$version/library
- *--dynlibdir* will be set to /package/prog/66-$version/library.so
Note that *--datadir* will be unchanged, because the data exported by 66, i.e. the leap second table, is system-wide. You should manually specify *--datadir=...* if you want to deviate from the default.
*--prefix* is pretty much ignored when you use *--enable-slashpackage*: it will only impact *--datadir*. You should probably not use both *--enable-slashpackage* and *--prefix*.
When using slashpackage, two additional Makefile targets are available after `make install`:
- `make -L update` changes the default version of the software to the freshly installed one. (This is useful when you have several installed versions of the same software, which slashpackage supports.)
- `make -L global-links` adds links from DIR/command and DIR/library.so to the default version of the binaries and shared libraries.
The `-L` option to make is necessary because targets are symbolic links, and the default make behaviour is to check the pointed file's timestamp and not the symlink's timestamp.
## Out-of-tree builds ## Out-of-tree builds
obarun.org packages do not support out-of-tree builds. They are small, so it does not cost much to duplicate the entire source tree if parallel builds are needed. obarun.org packages do not support out-of-tree builds. They are small, so it does not cost much to duplicate the entire source tree if parallel builds are needed.
...@@ -92,7 +92,7 @@ ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),) ...@@ -92,7 +92,7 @@ ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),)
exec $(STRIP) -R .note -R .comment $(ALL_BINS) $(SHARED_LIBS) exec $(STRIP) -R .note -R .comment $(ALL_BINS) $(SHARED_LIBS)
endif endif
install: install-dynlib install-libexec install-bin install-lib install-include install-data install-conf install-html install-man install: install-dynlib install-libexec install-bin install-lib install-include install-data install-html install-man
install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so) install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so)
install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%) install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%)
install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%)
......
...@@ -76,9 +76,6 @@ Optional features: ...@@ -76,9 +76,6 @@ Optional features:
--disable-allstatic do not prefer linking against static libraries [enabled] --disable-allstatic do not prefer linking against static libraries [enabled]
--enable-static-libc make entirely static binaries [disabled] --enable-static-libc make entirely static binaries [disabled]
--disable-all-pic do not build static libraries as PIC [enabled] --disable-all-pic do not build static libraries as PIC [enabled]
--enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled]
--enable-absolute-paths do not rely on PATH to access this package's binaries,
hardcode absolute BINDIR/foobar paths instead [disabled]
If no --prefix option is given, by default sysdeps will be fetched from If no --prefix option is given, by default sysdeps will be fetched from
/usr/lib/skalibs/sysdeps. /usr/lib/skalibs/sysdeps.
...@@ -93,69 +90,70 @@ exit 0 ...@@ -93,69 +90,70 @@ exit 0
# generally not a good idea to use echo. # generally not a good idea to use echo.
# See http://www.etalabs.net/sh_tricks.html # See http://www.etalabs.net/sh_tricks.html
echo () { echo () {
IFS=" " IFS=" "
printf %s\\n "$*" printf %s\\n "$*"
} }
quote () { quote () {
tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; } tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
$1 $1
EOF EOF
echo "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#" -e "s|\*/|* /|g" echo "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#" -e "s|\*/|* /|g"
} }
fail () { fail () {
echo "$*" echo "$*"
exit 1 exit 1
} }
fnmatch () { fnmatch () {
eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac"
} }
cmdexists () { cmdexists () {
type "$1" >/dev/null 2>&1 type "$1" >/dev/null 2>&1
} }
trycc () { trycc () {
test -z "$CC_AUTO" && cmdexists "$1" && CC_AUTO="$*" test -z "$CC_AUTO" && cmdexists "$1" && CC_AUTO="$*"
} }
stripdir () { stripdir () {
while eval "fnmatch '*/' \"\${$1}\"" ; do while eval "fnmatch '*/' \"\${$1}\"" ; do
eval "$1=\${$1%/}" eval "$1=\${$1%/}"
done done
} }
tryflag () { tryflag () {
echo "Checking whether compiler accepts $2 ..." echo "Checking whether compiler accepts $2 ..."
echo "typedef int x;" > "$tmpc" echo "typedef int x;" > "$tmpc"
if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST "$2" -c -o "$tmpo" "$tmpc" >/dev/null 2>&1 ; then if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST "$2" -c -o "$tmpo" "$tmpc" >/dev/null 2>&1 ; then
echo " ... yes" echo " ... yes"
eval "$1=\"\${$1} \$2\"" eval "$1=\"\${$1} \$2\""
eval "$1=\${$1# }" eval "$1=\${$1# }"
return 0 return 0
else else
echo " ... no" echo " ... no"
return 1 return 1
fi fi
} }
tryldflag () { tryldflag () {
echo "Checking whether linker accepts $2 ..." echo "Checking whether linker accepts $2 ..."
echo "typedef int x;" > "$tmpc" echo "typedef int x;" > "$tmpc"
if $CC_AUTO $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -nostdlib "$2" -o "$tmpe" "$tmpc" >/dev/null 2>&1 ; then if $CC_AUTO $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -nostdlib "$2" -o "$tmpe" "$tmpc" >/dev/null 2>&1 ; then
echo " ... yes" echo " ... yes"
eval "$1=\"\${$1} \$2\"" eval "$1=\"\${$1} \$2\""
eval "$1=\${$1# }" eval "$1=\${$1# }"
return 0 return 0
else else
echo " ... no" echo " ... no"
return 1 return 1
fi fi
} }
# Actual script # Actual script
CC_AUTO= CC_AUTO=
...@@ -205,11 +203,6 @@ manualsysdeps=false ...@@ -205,11 +203,6 @@ manualsysdeps=false
shared=false shared=false
static=true static=true
allpic=true allpic=true
slashpackage=false
abspath=false
sproot=
home=
exthome=
allstatic=true allstatic=true
evenmorestatic=false evenmorestatic=false
addincpath='' addincpath=''
...@@ -267,11 +260,6 @@ for arg ; do ...@@ -267,11 +260,6 @@ for arg ; do
--disable-static-libc|--enable-static-libc=no) evenmorestatic=false ;; --disable-static-libc|--enable-static-libc=no) evenmorestatic=false ;;
--enable-all-pic|--enable-all-pic=yes) allpic=true ;; --enable-all-pic|--enable-all-pic=yes) allpic=true ;;
--disable-all-pic|--enable-all-pic=no) allpic=false ;; --disable-all-pic|--enable-all-pic=no) allpic=false ;;
--enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;;
--enable-slashpackage) sproot= ; slashpackage=true ;;
--disable-slashpackage) sproot= ; slashpackage=false ;;
--enable-absolute-paths|--enable-absolute-paths=yes) abspath=true ;;
--disable-absolute-paths|--enable-absolute-paths=no) abspath=false ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
--host=*|--target=*) target=${arg#*=} ;; --host=*|--target=*) target=${arg#*=} ;;
--build=*) build=${arg#*=} ;; --build=*) build=${arg#*=} ;;
...@@ -317,7 +305,7 @@ fi ...@@ -317,7 +305,7 @@ fi
stripdir prefix stripdir prefix
for i in exec_prefix dynlibdir libexecdir bindir libdir includedir sysconfdir \ for i in exec_prefix dynlibdir libexecdir bindir libdir includedir sysconfdir \
datarootdir mandir shebangdir livedir skel system_dir system_log \ datarootdir mandir shebangdir livedir skel system_dir system_log \
service_system module_system script_system service_adm module_adm service_admconf sproot sysdeps ; do service_system module_system script_system service_adm module_adm service_admconf sysdeps ; do
eval tmp=\${$i} eval tmp=\${$i}
eval $i=$tmp eval $i=$tmp
stripdir $i stripdir $i
...@@ -368,55 +356,10 @@ while : ; do ...@@ -368,55 +356,10 @@ while : ; do
2>|/dev/null > "$tmpe" && break 2>|/dev/null > "$tmpe" && break
test "$i" -gt 50 && fail "$0: cannot create temporary files" test "$i" -gt 50 && fail "$0: cannot create temporary files"
done done
set +C set +C
trap 'rm -f "$tmpc" "$tmpo" "$tmpe"' EXIT ABRT INT QUIT TERM HUP trap 'rm -f "$tmpc" "$tmpo" "$tmpe"' EXIT ABRT INT QUIT TERM HUP
# Set slashpackage values
if $slashpackage ; then
home=${sproot}/package/${category}/${package}-${version}
exthome=${sproot}/package/${category}/${package}
if $manualsysdeps ; then
:
else
sysdeps=${sproot}/package/prog/skalibs/sysdeps
fi
extbinprefix=${exthome}/command
dynlibdir=${home}/library.so
bindir=${home}/command
libdir=${home}/library
libexecdir=$bindir
includedir=${home}/include
sysconfdir=${home}/etc
datarootdir=${home}/data
mandir=${dataroodir}/doc/man
skel=${skel}
system_dir=${home}/${system_dir}
system_log=${datarootdir}/${system_log}
service_system=${home}/${service_system}
module_system=${home}/${module_system}
script_system=${home}/${script_system}
service_adm=${home}/${sysconfdir}/${service_adm}
module_adm=${home}/${sysconfdir}/${module_adm}
service_admconf=${home}/${sysconfdir}/${service_admconf}
if $shebangisdefault ; then
shebangdir=${extbinprefix}
fi
while read dep condvar ; do
if test -n "$condvar" ; then
eval "cond=$condvar"
else
cond=true
fi
if $cond ; then
addincpath="$addincpath -I${sproot}${dep}/include"
vpaths="$vpaths ${sproot}${dep}/library"
addlibspath="$addlibspath -L${sproot}${dep}/library"
vpathd="$vpathd ${sproot}${dep}/library.so"
addlibdpath="$addlibdpath -L${sproot}${dep}/library.so"
fi
done < package/deps-build
fi
# Find a C compiler to use # Find a C compiler to use
if test -n "$target" && test x${build} != x${target} ; then if test -n "$target" && test x${build} != x${target} ; then
cross=${target}- cross=${target}-
...@@ -498,6 +441,8 @@ tryflag CPPFLAGS_AUTO -Wno-unused-value ...@@ -498,6 +441,8 @@ tryflag CPPFLAGS_AUTO -Wno-unused-value
tryflag CPPFLAGS_AUTO -Wno-parentheses tryflag CPPFLAGS_AUTO -Wno-parentheses
tryflag CFLAGS_AUTO -ffunction-sections tryflag CFLAGS_AUTO -ffunction-sections
tryflag CFLAGS_AUTO -fdata-sections tryflag CFLAGS_AUTO -fdata-sections
tryldflag LDFLAGS_AUTO -Wl,--as-needed
tryldflag LDFLAGS_AUTO -Wl,--sort-section=alignment tryldflag LDFLAGS_AUTO -Wl,--sort-section=alignment
tryldflag LDFLAGS_AUTO -Wl,--sort-common tryldflag LDFLAGS_AUTO -Wl,--sort-common
...@@ -569,11 +514,8 @@ script_user := $script_user ...@@ -569,11 +514,8 @@ script_user := $script_user
service_userconf := $service_userconf service_userconf := $service_userconf
user_log := $user_log user_log := $user_log
sysdeps := $sysdeps sysdeps := $sysdeps
slashpackage := $slashpackage
sproot := $sproot
version := $version version := $version
home := $home
exthome := $exthome
SPAWN_LIB := ${spawn_lib} SPAWN_LIB := ${spawn_lib}
SOCKET_LIB := ${socket_lib} SOCKET_LIB := ${socket_lib}
SYSCLOCK_LIB := ${sysclock_lib} SYSCLOCK_LIB := ${sysclock_lib}
...@@ -658,19 +600,10 @@ All rights reserved.*/ ...@@ -658,19 +600,10 @@ All rights reserved.*/
#define ${package_macro_name}_SCRIPT_USERDIR "$script_user/" #define ${package_macro_name}_SCRIPT_USERDIR "$script_user/"
EOF EOF
if $slashpackage ; then
echo "#define ${package_macro_name}_BINPREFIX \"$bindir/\"" echo "#define ${package_macro_name}_BINPREFIX \"\""
echo "#define ${package_macro_name}_EXTBINPREFIX \"$extbinprefix/\"" echo "#define ${package_macro_name}_EXTBINPREFIX \"\""
echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$extbinprefix/\"" echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$libexecdir/\""
elif $abspath ; then
echo "#define ${package_macro_name}_BINPREFIX \"$bindir/\""
echo "#define ${package_macro_name}_EXTBINPREFIX \"$bindir/\""
echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$libexecdir/\""
else
echo "#define ${package_macro_name}_BINPREFIX \"\""
echo "#define ${package_macro_name}_EXTBINPREFIX \"\""
echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$libexecdir/\""
fi
echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\"" echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\""
echo "#define ${package_macro_name}_EXECLINE_SHEBANGPREFIX \"$shebangdir/\"" echo "#define ${package_macro_name}_EXECLINE_SHEBANGPREFIX \"$shebangdir/\""
echo echo
......
...@@ -11,6 +11,24 @@ author: Eric Vidal <eric@obarun.org> ...@@ -11,6 +11,24 @@ author: Eric Vidal <eric@obarun.org>
--- ---
# In 0.6.1.3
- Adapt to skalibs 2.10.0.3.
- Adapt to execline 2.8.0.1.
- Adapt to s6 2.10.0.3.
- Adapt to s6-rc 0.5.2.2.
- Bugs Fix:
- 66-boot: fix call of 66-scandir -c option.
- configure script: fix installation of skel/init.conf file.
- Configure script: remove the slashpackage convention.
---
# In 0.6.1.2 # In 0.6.1.2
- Bugs fix: - Bugs fix:
......
package=66 package=66
version=0.6.1.2 version=0.6.1.3
category=admin category=admin
package_macro_name=SS package_macro_name=SS
...@@ -663,7 +663,8 @@ int main(int argc, char const *const *argv,char const *const *envp) ...@@ -663,7 +663,8 @@ int main(int argc, char const *const *argv,char const *const *envp)
if (setenv("PATH", path, 1) == -1) sulogin("set initial PATH: ",path) ; if (setenv("PATH", path, 1) == -1) sulogin("set initial PATH: ",path) ;
/** create scandir */ /** create scandir */
{ {
size_t nargc = 6 + catch_log ; size_t ncatch = !catch_log ? 1 : 0 ;
size_t nargc = 6 + ncatch ;
unsigned int m = 0 ; unsigned int m = 0 ;
char const *t[nargc] ; char const *t[nargc] ;
......
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
#ifndef _PATH_WTMP #ifndef _PATH_WTMP
#define _PATH_WTMP "/dev/null/wtmp" #define _PATH_WTMP "/dev/null/wtmp"
# ifdef WTMPX_FILE
# define _PATH_WTMP WTMPX_FILE
# else
# define _PATH_WTMP "/var/log/wtmp"
# endif
#endif #endif
#define USAGE "66-hpr [ -H ] [ -l live ] [ -b banner ] [ -f ] [ -h | -p | -r ] [ -n ] [ -d | -w ] [ -W ]" #define USAGE "66-hpr [ -H ] [ -l live ] [ -b banner ] [ -f ] [ -h | -p | -r ] [ -n ] [ -d | -w ] [ -W ]"
......
...@@ -157,7 +157,7 @@ static void parse_conf(char const *confile,char *rcshut,char const *key) ...@@ -157,7 +157,7 @@ static void parse_conf(char const *confile,char *rcshut,char const *key)
stralloc_free(&src) ; stralloc_free(&src) ;
} }
static inline void run_rcshut (char const *const *envp) static inline void run_rcshut (void)
{ {
log_flow() ; log_flow() ;
...@@ -168,7 +168,7 @@ static inline void run_rcshut (char const *const *envp) ...@@ -168,7 +168,7 @@ static inline void run_rcshut (char const *const *envp)
auto_conf(confile,conflen) ; auto_conf(confile,conflen) ;
parse_conf(confile,rcshut,"RCSHUTDOWN") ; parse_conf(confile,rcshut,"RCSHUTDOWN") ;
char const *rcshut_argv[3] = { rcshut, confile, 0 } ; char const *rcshut_argv[3] = { rcshut, confile, 0 } ;
pid = child_spawn0(rcshut_argv[0], rcshut_argv, envp) ; pid = child_spawn0(rcshut_argv[0], rcshut_argv,(char const *const *)environ) ;
if (pid) if (pid)
{ {
int wstat ; int wstat ;
...@@ -270,8 +270,7 @@ static inline void prepare_stage4 (char what) ...@@ -270,8 +270,7 @@ static inline void prepare_stage4 (char what)
|| buffer_puts(&b, S6_EXTBINPREFIX "66-scanctl ") < 0 || buffer_puts(&b, S6_EXTBINPREFIX "66-scanctl ") < 0
|| buffer_puts(&b, "-l ") < 0 || buffer_puts(&b, "-l ") < 0
|| buffer_puts(&b, live) < 0 || buffer_puts(&b, live) < 0
|| buffer_put(&b, what == 'h' ? "s" : &what, 1) < 0 || buffer_putsflush(&b, " b\n}\n") < 0)
|| buffer_putsflush(&b, "b\n}\n") < 0)
log_dieusys(LOG_EXIT_SYS, "write to ", STAGE4_FILE ".new") ; log_dieusys(LOG_EXIT_SYS, "write to ", STAGE4_FILE ".new") ;
} }
else else
...@@ -345,7 +344,7 @@ static inline void unsupervise_tree (void) ...@@ -345,7 +344,7 @@ static inline void unsupervise_tree (void)
if (errno) log_dieusys(LOG_EXIT_SYS, "readdir: ",tmp) ; if (errno) log_dieusys(LOG_EXIT_SYS, "readdir: ",tmp) ;
} }
int main (int argc, char const *const *argv, char const *const *envp) int main (int argc, char const *const *argv)
{ {
unsigned int grace_time = 3000 ; unsigned int grace_time = 3000 ;
tain_t deadline ; tain_t deadline ;
...@@ -382,9 +381,36 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -382,9 +381,36 @@ int main (int argc, char const *const *argv, char const *const *envp)
/* if we're in stage 4, exec it immediately */ /* if we're in stage 4, exec it immediately */
{ {
char const *stage4_argv[2] = { "./" STAGE4_FILE, 0 } ; char const *stage4_argv[2] = { "./" STAGE4_FILE, 0 } ;
restore_console() ;
execve(stage4_argv[0], (char **)stage4_argv, (char *const *)envp) ; if (!inns && !nologger) {
if (errno != ENOENT) log_warnusys("exec ", stage4_argv[0]) ;
int fd[2] ;
int e ;
fd[0] = fcntl(1, F_DUPFD_CLOEXEC, 0) ;
if (fd[0] < 0)
log_dieusys(LOG_EXIT_SYS, "dup stdout") ;
fd[1] = fcntl(2, F_DUPFD_CLOEXEC, 0) ;
if (fd[1] < 0)
log_dieusys(LOG_EXIT_SYS, "dup stderr") ;
restore_console() ;
execv(stage4_argv[0], (char **)stage4_argv) ;
e = errno ;
if (fd_move2(1, fd[0], 2, fd[1]) < 0)
log_warnusys("restore fds") ;
errno = e ;
} else {
execv(stage4_argv[0], (char **)stage4_argv) ;
if (errno != ENOENT)
log_warnusys("exec ", stage4_argv[0]) ;
}
} }
fdr = open_read(SHUTDOWND_FIFO) ; fdr = open_read(SHUTDOWND_FIFO) ;
...@@ -406,7 +432,7 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -406,7 +432,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (r == -1) log_dieusys(LOG_EXIT_SYS, "iopause") ; if (r == -1) log_dieusys(LOG_EXIT_SYS, "iopause") ;
if (!r) if (!r)
{ {
run_rcshut(envp) ; run_rcshut() ;
tain_now_g() ; tain_now_g() ;
if (what != 'S') break ; if (what != 'S') break ;
tain_add_g(&deadline, &tain_infinite_relative) ; tain_add_g(&deadline, &tain_infinite_relative) ;
...@@ -419,7 +445,8 @@ int main (int argc, char const *const *argv, char const *const *envp) ...@@ -419,7 +445,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
fd_close(fdw) ; fd_close(fdw) ;
fd_close(fdr) ; fd_close(fdr) ;
fd_close(1) ; fd_close(1) ;
restore_console() ; if (!inns && !nologger)
restore_console() ;
/* The end is coming! */ /* The end is coming! */
prepare_stage4(what) ; prepare_stage4(what) ;
......
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