Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
systemd
1010-sysv-generator-add-back-support-for-SysV-s...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1010-sysv-generator-add-back-support-for-SysV-scripts-for.patch of Package systemd
From 00c11d88328a0b293ab44d74f75384404fcb8ccd Mon Sep 17 00:00:00 2001 From: Franck Bui <fbui@suse.com> Date: Thu, 26 May 2016 08:59:41 +0200 Subject: [PATCH] sysv-generator: add (back) support for SysV scripts for the early boot For the record, the upstream support was removed by commit 3cdebc217c42c8529086f2965319b6a48eaaeabe. The sysv-generator has some weirdos: for example a service at the rc0 runlevel won't be started during shutdown since it will get both "WantedBy=poweroff.target" and "Conflicts=shutdown.target". Anyways what's the current patch implements the following: - a symlink /etc/init.d/boot.d/S??boot.foo will add "WantedBy/Before=sysinit.target" constraints and make sure that the default dependencies added by systemd are turned off. - a symlink /etc/init.d/boot.d/K??boot.foo will add "Conflicts/Before=shutdown.target" so "foo" service will be stopped like any other regular services. If this symlink is not installed however, "foo" will be stopped lately during the systemd killing spree. This is a forward-port of commit 29db8537e1ca10796797d9854d1 in SP1. [Since v232] Support for S* symlinks in runlevel 0 or 6 has been completely and silently removed by 788d2b088b13a2444b9eb2ea82c0cc57d9f0980f. Since it was already broken as pointed out above, this probably wasn't really used and therefore no one will really care. So let's drop it too. However this makes the support for early sysv scripts more difficult. To make things easier, the support of K* symlinks in boot.d/ has been removed too: this is probably not used (anymore) (at least intentionally). The consequence is that early sysv services are stopped during shutdown at the same time as 'normal' services. - Update (03/20/2024) Fix in order to really skip redundant dependencies that references the service itself for early boot scripts too. Note that the removed code had a bug as it didn't freed the original allocated pointer 'filename' but 'filename+5'. [fbui: fixes bsc#1221479] --- src/sysv-generator/sysv-generator.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 30f82d5736..dd14a37a16 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -36,6 +36,9 @@ static const struct { const char *path; const char *target; } rcnd_table[] = { + /* SUSE style boot.d */ + { "boot.d", SPECIAL_SYSINIT_TARGET }, + /* Standard SysV runlevels for start-up */ { "rc1.d", SPECIAL_RESCUE_TARGET }, { "rc2.d", SPECIAL_MULTI_USER_TARGET }, @@ -62,6 +65,7 @@ typedef struct SysvStub { bool has_lsb; bool reload; bool loaded; + bool early; } SysvStub; static SysvStub* free_sysvstub(SysvStub *s) { @@ -151,6 +155,12 @@ static int generate_unit_file(SysvStub *s) { fprintf(f, "Description=%s\n", t); } + if (s->early) { + fprintf(f, "DefaultDependencies=no\n"); + fprintf(f, "Conflicts=%s\n", SPECIAL_SHUTDOWN_TARGET); + fprintf(f, "Before=%s\n", SPECIAL_SHUTDOWN_TARGET); + } + STRV_FOREACH(p, s->before) fprintf(f, "Before=%s\n", *p); STRV_FOREACH(p, s->after) @@ -217,6 +227,10 @@ static char *sysv_translate_name(const char *name) { _cleanup_free_ char *c = NULL; char *res; + if (startswith(name, "boot.")) + /* Drop SUSE-style boot. prefix */ + name += 5; + c = strdup(name); if (!c) return NULL; @@ -654,6 +668,9 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { if (other->sysv_start_priority < 0) continue; + if (s->early != other->early) + continue; + /* If both units have modern headers we don't care * about the priorities */ if (s->has_lsb && other->has_lsb) @@ -783,6 +800,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { .sysv_start_priority = -1, .name = TAKE_PTR(name), .path = TAKE_PTR(fpath), + .early = !!startswith(de->d_name, "boot."), }; r = hashmap_put(all_services, service->name, service); -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor