LIBDIR -> LIB. When interuppted, ensure service state is restored correctly. When stopping, don't uncoldplug too early.
This commit is contained in:
parent
a66136655e
commit
6e2ef07dd3
@ -77,7 +77,7 @@ endif
|
||||
|
||||
# We also define _BSD_SOURCE so both Linux and the BSDs get a few
|
||||
# handy functions which makes our lives a lot easier
|
||||
override CFLAGS += -DLIBDIR=\"$(LIB)\"
|
||||
override CFLAGS += -DLIB=\"$(LIB)\"
|
||||
|
||||
# IMPORTANT!!!
|
||||
# Remove this when releasing as it's a security risk
|
||||
|
@ -637,15 +637,17 @@ char **rc_config_env (char **env)
|
||||
}
|
||||
rc_strlist_free (config);
|
||||
|
||||
i = strlen ("RC_LIBDIR=//rcscripts") + strlen (LIBDIR) + 2;
|
||||
/* One char less to drop the trailing / */
|
||||
i = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR);
|
||||
line = rc_xmalloc (sizeof (char *) * i);
|
||||
snprintf (line, i, "RC_LIBDIR=/" LIBDIR "/rcscripts");
|
||||
snprintf (line, i, "RC_LIBDIR=" RC_LIBDIR);
|
||||
env = rc_strlist_add (env, line);
|
||||
free (line);
|
||||
|
||||
i += strlen ("/init.d");
|
||||
/* One char less to drop the trailing / */
|
||||
i = strlen ("RC_SVCDIR=") + strlen (RC_SVCDIR);
|
||||
line = rc_xmalloc (sizeof (char *) * i);
|
||||
snprintf (line, i, "RC_SVCDIR=/" LIBDIR "/rcscripts/init.d");
|
||||
snprintf (line, i, "RC_SVCDIR=" RC_SVCDIR);
|
||||
env = rc_strlist_add (env, line);
|
||||
free (line);
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
#ifndef __RC_MISC_H__
|
||||
#define __RC_MISC_H__
|
||||
|
||||
#ifndef LIBDIR
|
||||
# define LIBDIR "lib"
|
||||
#ifndef LIB
|
||||
# define LIB "lib"
|
||||
#endif
|
||||
|
||||
#define RC_LIBDIR "/" LIBDIR "/rcscripts/"
|
||||
#define RC_LIBDIR "/" LIB "/rcscripts/"
|
||||
#define RC_SVCDIR RC_LIBDIR "init.d/"
|
||||
#define RC_DEPTREE RC_SVCDIR "deptree"
|
||||
#define RC_RUNLEVELDIR "/etc/runlevels/"
|
||||
|
2
src/rc.c
2
src/rc.c
@ -1109,7 +1109,7 @@ int main (int argc, char **argv)
|
||||
sulogin (false);
|
||||
}
|
||||
|
||||
mkdir (RC_SVCDIR "/softscripts.old", 0755);
|
||||
mkdir (RC_SVCDIR "softscripts.old", 0755);
|
||||
rc_plugin_run (rc_hook_runlevel_start_in, runlevel);
|
||||
|
||||
/* Re-add our coldplugged services if they stopped */
|
||||
|
@ -237,13 +237,15 @@ static void cleanup (void)
|
||||
else if (rc_service_state (applet, rc_service_stopping))
|
||||
{
|
||||
/* If the we're shutting down, do it cleanly */
|
||||
if ((softlevel && rc_runlevel_stopping () &&
|
||||
if ((softlevel &&
|
||||
rc_runlevel_stopping () &&
|
||||
(strcmp (softlevel, RC_LEVEL_SHUTDOWN) == 0 ||
|
||||
strcmp (softlevel, RC_LEVEL_REBOOT) == 0)) ||
|
||||
! rc_service_state (applet, rc_service_wasinactive))
|
||||
strcmp (softlevel, RC_LEVEL_REBOOT) == 0)))
|
||||
rc_mark_service (applet, rc_service_stopped);
|
||||
else
|
||||
else if (rc_service_state (applet, rc_service_wasinactive))
|
||||
rc_mark_service (applet, rc_service_inactive);
|
||||
else
|
||||
rc_mark_service (applet, rc_service_started);
|
||||
}
|
||||
if (exclusive && rc_exists (exclusive))
|
||||
unlink (exclusive);
|
||||
@ -1049,11 +1051,14 @@ int main (int argc, char **argv)
|
||||
{
|
||||
if (in_background)
|
||||
get_started_services ();
|
||||
else if (! rc_runlevel_stopping ())
|
||||
uncoldplug (applet);
|
||||
|
||||
svc_stop (service, deps);
|
||||
|
||||
if (! in_background &&
|
||||
! rc_runlevel_stopping () &&
|
||||
rc_service_state (service, rc_service_stopped))
|
||||
uncoldplug (applet);
|
||||
|
||||
if (in_background &&
|
||||
rc_service_state (service, rc_service_inactive))
|
||||
{
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
#include <rc.h>
|
||||
|
||||
#ifndef LIBDIR
|
||||
# define LIBDIR "lib"
|
||||
#ifndef LIB
|
||||
# define LIB "lib"
|
||||
#endif
|
||||
|
||||
#define SPLASH_CACHEDIR "/" LIBDIR "/splash/cache"
|
||||
#define SPLASH_CACHEDIR "/" LIB "/splash/cache"
|
||||
|
||||
#define SPLASH_CMD "bash -c 'export SOFTLEVEL='%s'; export BOOTLEVEL=${RC_BOOTLEVEL}; export DEFAULTLEVEL=${RC_DEFAULTLEVEL}; export svcdir=${RC_SVCDIR}; add_suffix() { echo \"$@\"; }; . /etc/init.d/functions.sh; . /sbin/splash-functions.sh; splash %s %s %s'"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user