From 4e462d819df5fc47ba4f6060b763b4712ab3dae49fd80f7678ab50f5ddb03b8c Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Tue, 23 Aug 2011 16:14:51 +0000 Subject: [PATCH] Accepting request 79603 from home:fcrozat:systemd - Handle disable_capslock, compose table and kbd_rate - Add rpm macros.systemd file. - Do not disable klogd, it has its own service now. - Handle kexec correctly (bnc#671673). - Disable preload services, they are conflicting with systemd. >>>>>>> .new OBS-URL: https://build.opensuse.org/request/show/79603 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=181 --- ...aplock-and-compose_table-and-kbd_rat.patch | 180 ++++++++++++++++++ ...r-kexec_loaded-when-reboot-is-reques.patch | 82 ++++++++ fix-agent-crash.patch | 68 +++++++ macros.systemd | 99 ++++++++++ systemd-29-boot-halt-local.patch | 103 ++++++++++ systemd-sysv-convert | 148 ++++++++++++++ systemd.changes | 10 + systemd.spec | 22 ++- tty1.patch | 13 ++ 9 files changed, 723 insertions(+), 2 deletions(-) create mode 100644 0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch create mode 100644 0001-initctl-check-for-kexec_loaded-when-reboot-is-reques.patch create mode 100644 fix-agent-crash.patch create mode 100644 macros.systemd create mode 100644 systemd-29-boot-halt-local.patch create mode 100644 systemd-sysv-convert create mode 100644 tty1.patch diff --git a/0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch b/0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch new file mode 100644 index 00000000..0dc96ceb --- /dev/null +++ b/0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch @@ -0,0 +1,180 @@ +From e183dbe195058ef921c4bd9760dc3631b425dd92 Mon Sep 17 00:00:00 2001 +From: Frederic Crozat +Date: Thu, 18 Aug 2011 18:28:01 +0200 +Subject: [PATCH] handle disable_caplock and compose_table and kbd_rate + +--- + src/vconsole-setup.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 files changed, 90 insertions(+), 3 deletions(-) + +diff --git a/src/vconsole-setup.c b/src/vconsole-setup.c +index 4347a20..28dc1d9 100644 +--- a/src/vconsole-setup.c ++++ b/src/vconsole-setup.c +@@ -39,6 +39,7 @@ + #include "util.h" + #include "log.h" + #include "macro.h" ++#include "strv.h" + + static bool is_vconsole(int fd) { + unsigned char data[1]; +@@ -78,8 +79,8 @@ static int disable_utf8(int fd) { + return r; + } + +-static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) { +- const char *args[8]; ++static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, bool disable_capslock, const char *compose_table, pid_t *_pid) { ++ const char *args[1024]; + int i = 0; + pid_t pid; + +@@ -98,6 +99,35 @@ static int load_keymap(const char *vc, const char *map, const char *map_toggle, + args[i++] = map; + if (map_toggle) + args[i++] = map_toggle; ++ if (disable_capslock) ++ args[i++] = "disable.capslock"; ++ if (compose_table) { ++ char **strv_compose_table = NULL; ++ ++ strv_compose_table = strv_split(compose_table, WHITESPACE); ++ if (strv_compose_table) { ++ bool compose_loaded = false; ++ bool compose_clear = false; ++ char **name; ++ char *arg; ++ ++ STRV_FOREACH (name, strv_compose_table) { ++ if (streq(*name,"-c") || streq(*name,"clear")) { ++ compose_clear = true; ++ continue; ++ } ++ if (!compose_loaded) { ++ if (compose_clear) ++ args[i++] = "-c"; ++ } ++ asprintf(&arg, "compose.%s",*name); ++ compose_loaded = true; ++ args[i++] = arg; ++ ++ } ++ } ++ strv_free(strv_compose_table); ++ } + args[i++] = NULL; + + if ((pid = fork()) < 0) { +@@ -149,6 +179,42 @@ static int load_font(const char *vc, const char *font, const char *map, const ch + return 0; + } + ++#ifdef TARGET_SUSE ++static int set_kbd_rate(const char *vc, const char *kbd_rate, const char *kbd_delay, pid_t *_pid) { ++ const char *args[7]; ++ int i = 0; ++ pid_t pid; ++ ++ if (isempty(kbd_rate) && isempty(kbd_delay)) { ++ *_pid = 0; ++ return 0; ++ } ++ ++ args[i++] = "/bin/kbdrate"; ++ if (!isempty(kbd_rate)) { ++ args[i++] = "-r"; ++ args[i++] = kbd_rate; ++ } ++ if (!isempty(kbd_delay)) { ++ args[i++] = "-d"; ++ args[i++] = kbd_delay; ++ } ++ args[i++] = "-s"; ++ args[i++] = NULL; ++ ++ if ((pid = fork()) < 0) { ++ log_error("Failed to fork: %m"); ++ return -errno; ++ } else if (pid == 0) { ++ execv(args[0], (char **) args); ++ _exit(EXIT_FAILURE); ++ } ++ ++ *_pid = pid; ++ return 0; ++} ++#endif ++ + int main(int argc, char **argv) { + const char *vc; + char *vc_keymap = NULL; +@@ -156,14 +222,22 @@ int main(int argc, char **argv) { + char *vc_font = NULL; + char *vc_font_map = NULL; + char *vc_font_unimap = NULL; ++ char *vc_compose_table = NULL; + #ifdef TARGET_GENTOO + char *vc_unicode = NULL; + #endif + #ifdef TARGET_MANDRIVA + char *vc_keytable = NULL; + #endif ++#ifdef TARGET_SUSE ++ char *vc_kbd_delay = NULL; ++ char *vc_kbd_rate = NULL; ++ char *vc_kbd_disable_caps_lock = NULL; ++ pid_t kbd_rate_pid = 0; ++#endif + int fd = -1; + bool utf8; ++ bool disable_capslock = false; + int r = EXIT_FAILURE; + pid_t font_pid = 0, keymap_pid = 0; + +@@ -268,6 +342,10 @@ int main(int argc, char **argv) { + #elif defined(TARGET_SUSE) + if ((r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE, + "KEYTABLE", &vc_keymap, ++ "KBD_DELAY", &vc_kbd_delay, ++ "KBD_RATE", &vc_kbd_rate, ++ "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock, ++ "COMPOSETABLE", &vc_compose_table, + NULL)) < 0) { + + if (r != -ENOENT) +@@ -283,6 +361,7 @@ int main(int argc, char **argv) { + if (r != -ENOENT) + log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r)); + } ++ disable_capslock = strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0; + + #elif defined(TARGET_ARCH) + if ((r = parse_env_file("/etc/rc.conf", NEWLINE, +@@ -439,7 +518,10 @@ int main(int argc, char **argv) { + if (!utf8) + disable_utf8(fd); + +- if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 && ++ if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, vc_compose_table, &keymap_pid) >= 0 && ++#ifdef TARGET_SUSE ++ set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid) >= 0 && ++#endif + load_font(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0) + r = EXIT_SUCCESS; + +@@ -447,6 +529,11 @@ finish: + if (keymap_pid > 0) + wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); + ++#ifdef TARGET_SUSE ++ if (kbd_rate_pid > 0) ++ wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid); ++#endif ++ + if (font_pid > 0) + wait_for_terminate_and_warn(KBD_SETFONT, font_pid); + +-- +1.7.3.4 + diff --git a/0001-initctl-check-for-kexec_loaded-when-reboot-is-reques.patch b/0001-initctl-check-for-kexec_loaded-when-reboot-is-reques.patch new file mode 100644 index 00000000..cda7b578 --- /dev/null +++ b/0001-initctl-check-for-kexec_loaded-when-reboot-is-reques.patch @@ -0,0 +1,82 @@ +From b1e304bb59e1a80abacfd6f0377ae14c3c1a10cc Mon Sep 17 00:00:00 2001 +From: Frederic Crozat +Date: Mon, 22 Aug 2011 14:58:50 +0200 +Subject: [PATCH] initctl: check for kexec_loaded when reboot is requested through initctl + +--- + src/initctl.c | 2 ++ + src/systemctl.c | 12 ------------ + src/util.c | 12 ++++++++++++ + src/util.h | 2 ++ + 4 files changed, 16 insertions(+), 12 deletions(-) + +diff --git a/src/initctl.c b/src/initctl.c +index f36f1cc..eaa717a 100644 +--- a/src/initctl.c ++++ b/src/initctl.c +@@ -93,6 +93,8 @@ static const char *translate_runlevel(int runlevel, bool *isolate) { + for (i = 0; i < ELEMENTSOF(table); i++) + if (table[i].runlevel == runlevel) { + *isolate = table[i].isolate; ++ if (runlevel == '6' && kexec_loaded()) ++ return SPECIAL_KEXEC_TARGET; + return table[i].special; + } + +diff --git a/src/systemctl.c b/src/systemctl.c +index bb998d3..0ff9221 100644 +--- a/src/systemctl.c ++++ b/src/systemctl.c +@@ -4403,18 +4403,6 @@ static int parse_time_spec(const char *t, usec_t *_u) { + return 0; + } + +-static bool kexec_loaded(void) { +- bool loaded = false; +- char *s; +- +- if (read_one_line_file("/sys/kernel/kexec_loaded", &s) >= 0) { +- if (s[0] == '1') +- loaded = true; +- free(s); +- } +- return loaded; +-} +- + static int shutdown_parse_argv(int argc, char *argv[]) { + + enum { +diff --git a/src/util.c b/src/util.c +index 8d54049..247156d 100644 +--- a/src/util.c ++++ b/src/util.c +@@ -5680,3 +5680,15 @@ static const char *const signal_table[] = { + }; + + DEFINE_STRING_TABLE_LOOKUP(signal, int); ++ ++bool kexec_loaded(void) { ++ bool loaded = false; ++ char *s; ++ ++ if (read_one_line_file("/sys/kernel/kexec_loaded", &s) >= 0) { ++ if (s[0] == '1') ++ loaded = true; ++ free(s); ++ } ++ return loaded; ++} +diff --git a/src/util.h b/src/util.h +index 407160d..8b31e5b 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -497,4 +497,6 @@ int signal_from_string_try_harder(const char *s); + extern int saved_argc; + extern char **saved_argv; + ++bool kexec_loaded(void); ++ + #endif +-- +1.7.3.4 + diff --git a/fix-agent-crash.patch b/fix-agent-crash.patch new file mode 100644 index 00000000..dae4ef50 --- /dev/null +++ b/fix-agent-crash.patch @@ -0,0 +1,68 @@ +From 148ded5c56d62dc358f566d322ea96dddfdd8faf Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 4 Jul 2011 18:59:54 +0200 +Subject: [PATCH 1/2] password-agent: make sure not to access unallocated memory + +Tracked down by Frederic Crozat +--- + src/tty-ask-password-agent.c | 14 ++++++++------ + 1 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c +index d7e1eba..bee2f97 100644 +--- a/src/tty-ask-password-agent.c ++++ b/src/tty-ask-password-agent.c +@@ -376,12 +376,14 @@ static int parse_password(const char *filename, char **wall) { + release_terminal(); + } + +- packet_length = 1+strlen(password)+1; +- if (!(packet = new(char, packet_length))) +- r = -ENOMEM; +- else { +- packet[0] = '+'; +- strcpy(packet+1, password); ++ if (r >= 0) { ++ packet_length = 1+strlen(password)+1; ++ if (!(packet = new(char, packet_length))) ++ r = -ENOMEM; ++ else { ++ packet[0] = '+'; ++ strcpy(packet+1, password); ++ } + } + + free(password); +-- +1.7.3.4 + + +From 722dad411964f71adc0a22a74609d35308c8ab9b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 4 Jul 2011 19:06:32 +0200 +Subject: [PATCH 2/2] password-agent: actually really don't access unallocated memory + +Fix for 9726f9ff11fa7b94dceed2972cd2453a08b9ee6a +--- + src/tty-ask-password-agent.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c +index bee2f97..70d33ea 100644 +--- a/src/tty-ask-password-agent.c ++++ b/src/tty-ask-password-agent.c +@@ -384,9 +384,9 @@ static int parse_password(const char *filename, char **wall) { + packet[0] = '+'; + strcpy(packet+1, password); + } +- } + +- free(password); ++ free(password); ++ } + } + + if (r == -ETIME || r == -ENOENT) { +-- +1.7.3.4 + diff --git a/macros.systemd b/macros.systemd new file mode 100644 index 00000000..363fb9ff --- /dev/null +++ b/macros.systemd @@ -0,0 +1,99 @@ +# RPM macros for packages installing systemd unit files +# +### +# +# When a package install systemd unit files, it should use the following macros: +# +# add %systemd_requires in the specfile +# +# %post +# %service_add demo.service demo1.service +# +# %preun +# %service_del_preun demo.service +# +# %postun +# %service_del_postun demo.service +# +# +# when migrating a package from sysvinit to systemd : +# %triggerun -- package_name < version_where_switch_occured +# %service_migrate_to_systemd [ -l run_level ] service_name.service +# foobar.socket +# +# -l is optional +### + +# This is for /bin/systemctl +%systemd_requires \ +Requires(pre): systemd \ +Requires(post): systemd \ +Requires(preun): systemd \ +Requires(postun): systemd \ + +%_unitdir /lib/systemd/system + +# On install, tell systemd to reload its unit files +%service_add() \ +test -n "$FIRST_ARG" || FIRST_ARG=$1 \ +if [ $FIRST_ARG -eq 1 ]; then \ +# Initial installation \ + /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ +fi + +# On uninstall, disable and stop services +%service_del_preun() \ +test -n "$FIRST_ARG" || FIRST_ARG=$1 \ +if [ $FIRST_ARG -eq 0 ]; then \ +# Package removal, not upgrade \ + /bin/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \ + /bin/systemctl stop %{?*} > /dev/null 2>&1 || : \ +fi + +# On uninstall, tell systemd to reload its unit files +%service_del_postun() \ +test -n "$FIRST_ARG" || FIRST_ARG=$1 \ +/bin/systemctl daemon-reload >/dev/null 2>&1 || : \ +if [ $FIRST_ARG -ge 1 ]; then \ +# Package upgrade, not uninstall \ + /bin/systemctl try-restart %{?*} >/dev/null 2>&1 || : \ +fi + +%service_migrate_to_systemd_pre() \ +test -n "$FIRST_ARG" || FIRST_ARG=$1 \ +# disable migration if initial install under systemd \ +if [ $FIRST_ARG -eq 1 ]; then \ + for service in %{?*} ; do \ + touch "/var/lib/systemd/migrated/$service" \ + done \ +else \ + for service in %{?*} ; do \ + if [ ! -e "/var/lib/systemd/migrated/$service" ]; then \ + services_to_migrate="$services_to_migrate $service" \ + fi \ + done \ + if [ -n "$services_to_migrate" ]; then \ + /usr/sbin/systemd-sysv-convert --save $services_to_migrate >/dev/null 2>&1 || : \ + fi \ +fi + +%service_migrate_to_systemd_post() \ +for service in %{?*} ; do \ + if [ ! -e "/var/lib/systemd/migrated/$service" ]; then \ + services_to_migrate="$services_to_migrate $service" \ + touch "/var/lib/systemd/migrated/$service" \ + fi \ +done \ +if [ -n "$services_to_migrate" ]; then \ + /usr/sbin/systemd-sysv-convert --apply $services_to_migrate >/dev/null 2>&1 || : \ + /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ +fi \ + +%service_migrate_to_systemd_postun() \ +test -n "$FIRST_ARG" || FIRST_ARG=$1 \ +if [ $FIRST_ARG -eq 0 ]; then \ + for service in %{?*} ; do \ + rm -f "/var/lib/systemd/migrated/$service" 2> /dev/null \ + done \ +fi + diff --git a/systemd-29-boot-halt-local.patch b/systemd-29-boot-halt-local.patch new file mode 100644 index 00000000..c4864520 --- /dev/null +++ b/systemd-29-boot-halt-local.patch @@ -0,0 +1,103 @@ +From 06238c421548f9af6ebebd54eba99bba2a2049d4 Mon Sep 17 00:00:00 2001 +From: Frederic Crozat +Date: Thu, 7 Jul 2011 14:56:30 +0200 +Subject: [PATCH] units: add units for boot.local/halt.local on SUSE distributions. + +--- + Makefile.am | 19 +++++++++++++++++++ + units/suse/halt-local.service | 20 ++++++++++++++++++++ + units/suse/rc-local.service | 18 ++++++++++++++++++ + 3 files changed, 57 insertions(+), 0 deletions(-) + create mode 100644 units/suse/halt-local.service + create mode 100644 units/suse/rc-local.service + +diff --git a/Makefile.am b/Makefile.am +index 78e5caf..d3265b0 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -436,6 +436,12 @@ dist_systemunit_DATA += \ + units/frugalware/display-manager.service + endif + ++if TARGET_SUSE ++dist_systemunit_DATA += \ ++ units/suse/rc-local.service \ ++ units/suse/halt-local.service ++endif ++ + if HAVE_PLYMOUTH + dist_systemunit_DATA += \ + units/plymouth-start.service \ +@@ -1689,6 +1695,19 @@ if TARGET_DEBIAN_OR_UBUNTU + $(LN_S) multi-user.target runlevel5.target ) + endif + ++if TARGET_SUSE ++ $(MKDIR_P) -m 0755 $(DESTDIR)$(systemunitdir)/final.target.wants ++ ( cd $(DESTDIR)$(systemunitdir)/multi-user.target.wants && \ ++ rm -f rc-local.service && \ ++ $(LN_S) $(systemunitdir)/rc-local.service rc-local.service ) ++ ( cd $(DESTDIR)$(systemunitdir) && \ ++ rm -f local.service && \ ++ $(LN_S) rc-local.service local.service ) ++ ( cd $(DESTDIR)$(systemunitdir)/final.target.wants && \ ++ rm -f halt-local.service && \ ++ $(LN_S) $(systemunitdir)/halt-local.service halt-local.service ) ++endif ++ + if HAVE_SYSV_COMPAT + ( cd $(DESTDIR)$(systemunitdir)/local-fs.target.wants && \ + rm -f var-lock.mount && \ +diff --git a/units/suse/halt-local.service b/units/suse/halt-local.service +new file mode 100644 +index 0000000..68cacc6 +--- /dev/null ++++ b/units/suse/halt-local.service +@@ -0,0 +1,20 @@ ++# This file is part of systemd. ++# ++# systemd is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++ ++[Unit] ++Description=/etc/init.d/halt.local Compatibility ++ConditionPathExists=/etc/init.d/halt.local ++DefaultDependencies=no ++After=shutdown.target ++Before=final.target ++ ++[Service] ++Type=oneshot ++ExecStart=/etc/init.d/halt.local ++TimeoutSec=0 ++StandardOutput=tty ++RemainAfterExit=yes +diff --git a/units/suse/rc-local.service b/units/suse/rc-local.service +new file mode 100644 +index 0000000..38884c5 +--- /dev/null ++++ b/units/suse/rc-local.service +@@ -0,0 +1,18 @@ ++# This file is part of systemd. ++# ++# systemd is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++ ++[Unit] ++Description=/etc/init.d/boot.local Compatibility ++ConditionPathExists=/etc/init.d/boot.local ++ ++[Service] ++Type=oneshot ++ExecStart=/etc/init.d/boot.local ++TimeoutSec=0 ++StandardOutput=tty ++RemainAfterExit=yes ++SysVStartPriority=99 +-- +1.7.3.4 + diff --git a/systemd-sysv-convert b/systemd-sysv-convert new file mode 100644 index 00000000..1cf2b025 --- /dev/null +++ b/systemd-sysv-convert @@ -0,0 +1,148 @@ +#!/usr/bin/python +# -*- Mode: Python; python-indent: 8; indent-tabs-mode: t -*- + +import sys, os, argparse, errno + +def find_service(service, runlevel): + priority = -1 + + for l in os.listdir("/etc/rc.d/rc%i.d" % runlevel): + if len(l) < 4: + continue + + if l[0] != 'S' or l[3:] != service: + continue + + p = int(l[1:3]) + + if p >= 0 and p <= 99 and p >= priority: + priority = p; + + return priority + +def lookup_database(services): + try: + database = open("/var/lib/systemd/sysv-convert/database", "r") + except IOError, e: + if e.errno != errno.ENOENT: + raise e + + return {} + + found = {} + k = 0 + + for line in database: + service, r, p = line.strip().split("\t", 3) + k += 1 + + try: + runlevel = int(r) + priority = int(p) + except ValueError, e: + sys.stderr.write("Failed to parse database line %i. Ignoring." % k) + continue + + if runlevel not in (2, 3, 4, 5): + sys.stderr.write("Runlevel out of bounds in database line %i. Ignoring." % k) + continue + + if priority < 0 or priority > 99: + sys.stderr.write("Priority out of bounds in database line %i. Ignoring." % k) + continue + + if service not in services: + continue + + if service not in found: + found[service] = {} + + if runlevel not in found[service] or found[service][runlevel] < priority: + found[service][runlevel] = priority + + return found + +def mkdir_p(path): + try: + os.makedirs(path, 0755) + except OSError, e: + if e.errno != errno.EEXIST: + raise e + +if os.geteuid() != 0: + sys.stderr.write("Need to be root.\n") + sys.exit(1) + +parser = argparse.ArgumentParser(description='Save and Restore SysV Service Runlevel Information') + +parser.add_argument('services', metavar='SERVICE', type=str, nargs='+', + help='Service names') + +parser.add_argument('--save', dest='save', action='store_const', + const=True, default=False, + help='Save SysV runlevel information for one or more services') + +parser.add_argument('--show', dest='show', action='store_const', + const=True, default=False, + help='Show saved SysV runlevel information for one or more services') + +parser.add_argument('--apply', dest='apply', action='store_const', + const=True, default=False, + help='Apply saved SysV runlevel information for one or more services to systemd counterparts') + +a = parser.parse_args() + +if a.save: + for service in a.services: + if not os.access("/etc/init.d/%s" % service, os.F_OK): + sys.stderr.write("SysV service %s does not exist.\n" % service) + sys.exit(1) + + mkdir_p("/var/lib/systemd/sysv-convert") + database = open("/var/lib/systemd/sysv-convert/database", "a") + + for runlevel in (2, 3, 4, 5): + priority = find_service(service, runlevel) + + if priority >= 0: + database.write("%s\t%s\t%s\n" % (service, runlevel, priority)) + +elif a.show: + found = lookup_database(a.services) + + if len(found) <= 0: + sys.stderr.write("No information about passed services found.\n") + sys.exit(1) + + for service, data in found.iteritems(): + for runlevel, priority in data.iteritems(): + sys.stdout.write("SysV service %s enabled in runlevel %s at priority %s\n" % (service, runlevel, priority)) + +elif a.apply: + for service in a.services: + if not os.access("/lib/systemd/system/%s.service" % service, os.F_OK): + sys.stderr.write("systemd service %s.service does not exist.\n" % service) + sys.exit(1) + + found = lookup_database(a.services) + + if len(found) <= 0: + sys.stderr.write("No information about passed services found.\n") + sys.exit(1) + + for service, data in found.iteritems(): + for runlevel in data.iterkeys(): + + sys.stderr.write("ln -sf /lib/systemd/system/%s.service /etc/systemd/system/runlevel%i.target.wants/%s.service\n" % (service, runlevel, service)) + + mkdir_p("/etc/systemd/system/runlevel%i.target.wants" % runlevel) + + try: + os.symlink("/lib/systemd/system/%s.service" % service, + "/etc/systemd/system/runlevel%i.target.wants/%s.service" % (runlevel, service)) + except OSError, e: + if e.errno != errno.EEXIST: + raise e + +else: + parser.print_help() diff --git a/systemd.changes b/systemd.changes index 54376ba8..d52772a2 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Aug 19 15:29:49 UTC 2011 - fcrozat@suse.com + +- Handle disable_capslock, compose table and kbd_rate +- Add rpm macros.systemd file. +- Do not disable klogd, it has its own service now. +- Handle kexec correctly (bnc#671673). +- Disable preload services, they are conflicting with systemd. + ------------------------------------------------------------------- Fri Aug 19 08:15:15 UTC 2011 - fcrozat@suse.com @@ -81,6 +90,7 @@ Tue Jul 19 11:56:43 UTC 2011 - aj@suse.de + add support for systemctl --root ------------------------------------------------------------------- +>>>>>>> .new Wed Jun 29 12:54:24 UTC 2011 - fcrozat@suse.com - Make sure to not start kbd initscript, it is handled by systemd diff --git a/systemd.spec b/systemd.spec index 2863345e..63fafb39 100644 --- a/systemd.spec +++ b/systemd.spec @@ -49,7 +49,11 @@ Conflicts: mkinitrd < 2.7.0 Source0: http://www.freedesktop.org/software/systemd/%{name}-%{version}.tar.bz2 Source1: systemd-rpmlintrc Source2: localfs.service +Source3: systemd-sysv-convert +Source4: macros.systemd Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch +# handle SUSE specific kbd settings +Patch6: 0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch # Upstream First - Policy: # Never add any patches to this package without the upstream commit id @@ -63,6 +67,8 @@ Patch3: systemd-cryptsetup.patch Patch4: systemd-cryptsetup-query.patch # PATCH-FIX-UPSTREAM aj@suse.com -- fix crash on systemctl enable Patch5: fix-crash.patch +# PATCH-FIX-UPSTREAM fcrozat@suse.com bnc671673 -- fix kexec support +Patch7: 0001-initctl-check-for-kexec_loaded-when-reboot-is-reques.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -127,6 +133,8 @@ Plymouth integration for systemd %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 %build autoreconf -fiv @@ -145,8 +153,11 @@ make %{?_smp_mflags} %install %makeinstall +mkdir -p %{buildroot}%{_sysconfdir}/rpm +install -m644 %{S:4} %{buildroot}%{_sysconfdir}/rpm find %{buildroot} -type f -name '*.la' -exec rm -f {} ';' -mkdir -p %{buildroot}/sbin +mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} +install -m755 %{S:3} -D %{buildroot}%{_sbindir}/systemd-sysv-convert ln -s ../bin/systemd %{buildroot}/sbin/init ln -s ../bin/systemctl %{buildroot}/sbin/reboot ln -s ../bin/systemctl %{buildroot}/sbin/halt @@ -169,7 +180,6 @@ ln -s /dev/null %{buildroot}/lib/systemd/system/crypto.service ln -s /dev/null %{buildroot}/lib/systemd/system/crypto-early.service ln -s /dev/null %{buildroot}/lib/systemd/system/earlysyslog.service ln -s /dev/null %{buildroot}/lib/systemd/system/kbd.service -ln -s /dev/null %{buildroot}/lib/systemd/system/klog.service ln -s /dev/null %{buildroot}/lib/systemd/system/ldconfig.service ln -s /dev/null %{buildroot}/lib/systemd/system/loadmodules.service install -m644 %{S:2} %{buildroot}/lib/systemd/system/localfs.service @@ -177,6 +187,9 @@ ln -s /dev/null %{buildroot}/lib/systemd/system/localnet.service ln -s /dev/null %{buildroot}/lib/systemd/system/proc.service ln -s fsck-root.service %{buildroot}/lib/systemd/system/rootfsck.service ln -s /dev/null %{buildroot}/lib/systemd/system/swap.service +ln -s /dev/null %{buildroot}/lib/systemd/system/startpreload.service +ln -s /dev/null %{buildroot}/lib/systemd/system/stoppreload.service +ln -s /dev/null %{buildroot}/lib/systemd/system/earlyxdm.service ln -s systemd-sysctl.service %{buildroot}/lib/systemd/system/sysctl.service ln -s systemd-random-seed-load.service %{buildroot}/lib/systemd/system/random.service %if %{build_plymouth} @@ -240,6 +253,7 @@ rm -rf %{buildroot} /usr/bin/systemd-nspawn /usr/bin/systemd-stdio-bridge /usr/bin/systemd-analyze +%{_sbindir}/systemd-sysv-convert %{_libdir}/libsystemd-daemon.so.* %{_libdir}/libsystemd-login.so.* %{_bindir}/systemd-cgls @@ -313,6 +327,10 @@ rm -rf %{buildroot} %dir %{_sysconfdir}/systemd %dir %{_sysconfdir}/bash_completion.d /etc/bash_completion.d/systemctl-bash-completion.sh +/etc/rpm/macros.systemd +%dir /var/lib/systemd +%dir /var/lib/systemd/sysv-convert +%dir /var/lib/systemd/migrated %files gtk %defattr(-,root,root,-) diff --git a/tty1.patch b/tty1.patch new file mode 100644 index 00000000..938066fd --- /dev/null +++ b/tty1.patch @@ -0,0 +1,13 @@ +Index: systemd-29/units/systemd-ask-password-wall.service.in +=================================================================== +--- systemd-29.orig/units/systemd-ask-password-wall.service.in ++++ systemd-29/units/systemd-ask-password-wall.service.in +@@ -7,7 +7,7 @@ + + [Unit] + Description=Forward Password Requests to Wall +-After=systemd-user-sessions.service ++After=systemd-user-sessions.service getty@tty1.service + + [Service] + ExecStartPre=-@rootbindir@/systemctl stop systemd-ask-password-console.path systemd-ask-password-console.service