forked from pool/systemd
Accepting request 79689 from Base:System
- Add tty1.patch: ensure passphrase are handled before starting gettty on tty1. - Add inittab generator, creating default.target at startup based on /etc/inittab value. - No longer try to create /etc/systemd/system/default.target at initial package install (bnc#707418) - Fix configuration path used for systemd user manager. - Ensure pam-config output is no display in install script. - Remove buildrequires on vala, no longer needed. - 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. OBS-URL: https://build.opensuse.org/request/show/79689 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=59
This commit is contained in:
parent
0b60951951
commit
11df4c4a7c
180
0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch
Normal file
180
0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
From e183dbe195058ef921c4bd9760dc3631b425dd92 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Frederic Crozat <fcrozat@suse.com>
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From b1e304bb59e1a80abacfd6f0377ae14c3c1a10cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Frederic Crozat <fcrozat@suse.com>
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 1cf32c016f97b2c99d7df06ce5d5b858f86c507a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Frederic Crozat <fcrozat@suse.com>
|
||||||
|
Date: Wed, 24 Aug 2011 13:39:06 +0200
|
||||||
|
Subject: [PATCH] path-lookup: monitor /etc/systemd/user for user manager
|
||||||
|
|
||||||
|
---
|
||||||
|
src/path-lookup.c | 2 +-
|
||||||
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/path-lookup.c b/src/path-lookup.c
|
||||||
|
index bed9175..5f5ad8c 100644
|
||||||
|
--- a/src/path-lookup.c
|
||||||
|
+++ b/src/path-lookup.c
|
||||||
|
@@ -209,7 +209,7 @@ int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as, bool personal
|
||||||
|
* the arrays in user_dirs() above! */
|
||||||
|
"/run/systemd/user",
|
||||||
|
USER_CONFIG_UNIT_PATH,
|
||||||
|
- "/etc/systemd/system",
|
||||||
|
+ "/etc/systemd/user",
|
||||||
|
"/usr/local/lib/systemd/user",
|
||||||
|
"/usr/local/share/systemd/user",
|
||||||
|
USER_DATA_UNIT_PATH,
|
||||||
|
--
|
||||||
|
1.7.3.4
|
||||||
|
|
99
macros.systemd
Normal file
99
macros.systemd
Normal file
@ -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 <run_level> 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
|
||||||
|
|
8
systemd-inittab
Normal file
8
systemd-inittab
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Try to read default runlevel from the old inittab if it exists
|
||||||
|
runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab 2> /dev/null)
|
||||||
|
if [ -n "$runlevel" -a -e /lib/systemd/system/runlevel$runlevel.target ] ; then
|
||||||
|
/bin/ln -sf /lib/systemd/system/runlevel$runlevel.target $1/default.target 2>&1 && exit 0
|
||||||
|
fi
|
||||||
|
#failsafe
|
||||||
|
/bin/ln -sf /lib/systemd/system/graphical.target $1/default.target
|
148
systemd-sysv-convert
Normal file
148
systemd-sysv-convert
Normal file
@ -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()
|
@ -1,3 +1,25 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Aug 24 13:02:12 UTC 2011 - fcrozat@novell.com
|
||||||
|
|
||||||
|
- Add tty1.patch: ensure passphrase are handled before starting
|
||||||
|
gettty on tty1.
|
||||||
|
- Add inittab generator, creating default.target at startup based
|
||||||
|
on /etc/inittab value.
|
||||||
|
- No longer try to create /etc/systemd/system/default.target at
|
||||||
|
initial package install (bnc#707418)
|
||||||
|
- Fix configuration path used for systemd user manager.
|
||||||
|
- Ensure pam-config output is no display in install script.
|
||||||
|
- Remove buildrequires on vala, no longer needed.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
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
|
Fri Aug 19 08:15:15 UTC 2011 - fcrozat@suse.com
|
||||||
|
|
||||||
|
46
systemd.spec
46
systemd.spec
@ -36,7 +36,7 @@ BuildRequires: tcpd-devel
|
|||||||
BuildRequires: pam-devel
|
BuildRequires: pam-devel
|
||||||
BuildRequires: libcryptsetup-devel
|
BuildRequires: libcryptsetup-devel
|
||||||
BuildRequires: pkg-config
|
BuildRequires: pkg-config
|
||||||
BuildRequires: gtk2-devel libnotify-devel libxslt-devel vala
|
BuildRequires: gtk2-devel libnotify-devel libxslt-devel
|
||||||
BuildRequires: libselinux-devel libsepol-devel
|
BuildRequires: libselinux-devel libsepol-devel
|
||||||
BuildRequires: intltool
|
BuildRequires: intltool
|
||||||
Requires: udev >= 172
|
Requires: udev >= 172
|
||||||
@ -49,7 +49,14 @@ Conflicts: mkinitrd < 2.7.0
|
|||||||
Source0: http://www.freedesktop.org/software/systemd/%{name}-%{version}.tar.bz2
|
Source0: http://www.freedesktop.org/software/systemd/%{name}-%{version}.tar.bz2
|
||||||
Source1: systemd-rpmlintrc
|
Source1: systemd-rpmlintrc
|
||||||
Source2: localfs.service
|
Source2: localfs.service
|
||||||
|
Source3: systemd-sysv-convert
|
||||||
|
Source4: macros.systemd
|
||||||
|
Source5: systemd-inittab
|
||||||
Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch
|
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
|
||||||
|
# don't start getty on tty1 until all password request are done
|
||||||
|
Patch8: tty1.patch
|
||||||
|
|
||||||
# Upstream First - Policy:
|
# Upstream First - Policy:
|
||||||
# Never add any patches to this package without the upstream commit id
|
# Never add any patches to this package without the upstream commit id
|
||||||
@ -63,6 +70,10 @@ Patch3: systemd-cryptsetup.patch
|
|||||||
Patch4: systemd-cryptsetup-query.patch
|
Patch4: systemd-cryptsetup-query.patch
|
||||||
# PATCH-FIX-UPSTREAM aj@suse.com -- fix crash on systemctl enable
|
# PATCH-FIX-UPSTREAM aj@suse.com -- fix crash on systemctl enable
|
||||||
Patch5: fix-crash.patch
|
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
|
||||||
|
# PATCH-FIX-UPSTREAM fcrozat@suse.com -- don't look for system manager configuration when running user manager
|
||||||
|
Patch9: 0001-path-lookup-monitor-etc-systemd-user-for-user-manage.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Systemd is a system and service manager, compatible with SysV and LSB
|
Systemd is a system and service manager, compatible with SysV and LSB
|
||||||
@ -127,6 +138,10 @@ Plymouth integration for systemd
|
|||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
@ -139,14 +154,16 @@ export V=1
|
|||||||
--docdir=%{_docdir}/systemd \
|
--docdir=%{_docdir}/systemd \
|
||||||
--with-rootdir= \
|
--with-rootdir= \
|
||||||
CFLAGS="%{optflags}"
|
CFLAGS="%{optflags}"
|
||||||
# rebuild due to libnotify 0.7 in factory
|
|
||||||
touch *.vala */*.vala
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%makeinstall
|
%makeinstall
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/rpm
|
||||||
|
install -m644 %{S:4} %{buildroot}%{_sysconfdir}/rpm
|
||||||
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
|
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
|
||||||
|
install -m755 %{S:5} %{buildroot}/lib/systemd/system-generators
|
||||||
ln -s ../bin/systemd %{buildroot}/sbin/init
|
ln -s ../bin/systemd %{buildroot}/sbin/init
|
||||||
ln -s ../bin/systemctl %{buildroot}/sbin/reboot
|
ln -s ../bin/systemctl %{buildroot}/sbin/reboot
|
||||||
ln -s ../bin/systemctl %{buildroot}/sbin/halt
|
ln -s ../bin/systemctl %{buildroot}/sbin/halt
|
||||||
@ -156,6 +173,7 @@ ln -s ../bin/systemctl %{buildroot}/sbin/telinit
|
|||||||
ln -s ../bin/systemctl %{buildroot}/sbin/runlevel
|
ln -s ../bin/systemctl %{buildroot}/sbin/runlevel
|
||||||
rm -rf %{buildroot}/etc/systemd/system/*.target.wants
|
rm -rf %{buildroot}/etc/systemd/system/*.target.wants
|
||||||
rm -f %{buildroot}/etc/systemd/system/default.target
|
rm -f %{buildroot}/etc/systemd/system/default.target
|
||||||
|
rm -f %{buildroot}/lib/systemd/system/default.target
|
||||||
%if !%{build_plymouth}
|
%if !%{build_plymouth}
|
||||||
rm -f %{buildroot}/lib/systemd/system/plymouth-*.service
|
rm -f %{buildroot}/lib/systemd/system/plymouth-*.service
|
||||||
rm -f %{buildroot}/lib/systemd/system/*.wants/plymouth-*.service
|
rm -f %{buildroot}/lib/systemd/system/*.wants/plymouth-*.service
|
||||||
@ -169,7 +187,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/crypto-early.service
|
||||||
ln -s /dev/null %{buildroot}/lib/systemd/system/earlysyslog.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/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/ldconfig.service
|
||||||
ln -s /dev/null %{buildroot}/lib/systemd/system/loadmodules.service
|
ln -s /dev/null %{buildroot}/lib/systemd/system/loadmodules.service
|
||||||
install -m644 %{S:2} %{buildroot}/lib/systemd/system/localfs.service
|
install -m644 %{S:2} %{buildroot}/lib/systemd/system/localfs.service
|
||||||
@ -177,6 +194,9 @@ ln -s /dev/null %{buildroot}/lib/systemd/system/localnet.service
|
|||||||
ln -s /dev/null %{buildroot}/lib/systemd/system/proc.service
|
ln -s /dev/null %{buildroot}/lib/systemd/system/proc.service
|
||||||
ln -s fsck-root.service %{buildroot}/lib/systemd/system/rootfsck.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/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-sysctl.service %{buildroot}/lib/systemd/system/sysctl.service
|
||||||
ln -s systemd-random-seed-load.service %{buildroot}/lib/systemd/system/random.service
|
ln -s systemd-random-seed-load.service %{buildroot}/lib/systemd/system/random.service
|
||||||
%if %{build_plymouth}
|
%if %{build_plymouth}
|
||||||
@ -184,19 +204,14 @@ ln -s systemd-random-seed-load.service %{buildroot}/lib/systemd/system/random.se
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%post
|
%post
|
||||||
/usr/sbin/pam-config -a --systemd || :
|
/usr/sbin/pam-config -a --systemd >/dev/null 2>&1 || :
|
||||||
|
/sbin/ldconfig
|
||||||
/bin/systemd-machine-id-setup >/dev/null 2>&1 || :
|
/bin/systemd-machine-id-setup >/dev/null 2>&1 || :
|
||||||
/bin/systemctl daemon-reexec >/dev/null 2>&1 || :
|
/bin/systemctl daemon-reexec >/dev/null 2>&1 || :
|
||||||
/sbin/ldconfig
|
|
||||||
|
|
||||||
# Create default config in /etc at first install.
|
# Create default config in /etc at first install.
|
||||||
# Later package updates should not overwrite these settings.
|
# Later package updates should not overwrite these settings.
|
||||||
if [ "$1" -eq 1 ]; then
|
if [ "$1" -eq 1 ]; then
|
||||||
# Try to read default runlevel from the old inittab if it exists
|
|
||||||
runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab 2> /dev/null)
|
|
||||||
if [ -n "$runlevel" ] ; then
|
|
||||||
/bin/ln -sf /lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target 2>&1 || :
|
|
||||||
fi
|
|
||||||
# Enable these services by default.
|
# Enable these services by default.
|
||||||
/bin/systemctl enable \
|
/bin/systemctl enable \
|
||||||
getty@.service \
|
getty@.service \
|
||||||
@ -211,7 +226,7 @@ if [ $1 -ge 1 ]; then
|
|||||||
/bin/systemctl try-restart systemd-logind.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart systemd-logind.service >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
if [ $1 -eq 0 ]; then
|
if [ $1 -eq 0 ]; then
|
||||||
/usr/sbin/pam-config -d --systemd || :
|
/usr/sbin/pam-config -d --systemd >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
@ -240,6 +255,7 @@ rm -rf %{buildroot}
|
|||||||
/usr/bin/systemd-nspawn
|
/usr/bin/systemd-nspawn
|
||||||
/usr/bin/systemd-stdio-bridge
|
/usr/bin/systemd-stdio-bridge
|
||||||
/usr/bin/systemd-analyze
|
/usr/bin/systemd-analyze
|
||||||
|
%{_sbindir}/systemd-sysv-convert
|
||||||
%{_libdir}/libsystemd-daemon.so.*
|
%{_libdir}/libsystemd-daemon.so.*
|
||||||
%{_libdir}/libsystemd-login.so.*
|
%{_libdir}/libsystemd-login.so.*
|
||||||
%{_bindir}/systemd-cgls
|
%{_bindir}/systemd-cgls
|
||||||
@ -313,6 +329,10 @@ rm -rf %{buildroot}
|
|||||||
%dir %{_sysconfdir}/systemd
|
%dir %{_sysconfdir}/systemd
|
||||||
%dir %{_sysconfdir}/bash_completion.d
|
%dir %{_sysconfdir}/bash_completion.d
|
||||||
/etc/bash_completion.d/systemctl-bash-completion.sh
|
/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
|
%files gtk
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
|
13
tty1.patch
Normal file
13
tty1.patch
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user