forked from pool/systemd
Accepting request 155556 from home:fcrozat:branches:Base:System
- Add early-sync-shutdown.patch: start sync just when shutdown.target is beginning - Update parse-multiline-env-file.patch to better handle continuing lines. - Add handle-HOSTNAME.patch: handle /etc/HOSTNAME (bnc#803653). - Add systemctl-print-wall-on-if-successful.patch: only print on wall if successful. - Add improve-bash-completion.patch: improve bash completion. OBS-URL: https://build.opensuse.org/request/show/155556 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=348
This commit is contained in:
parent
409881632d
commit
96bd006b89
209
early-sync-shutdown.patch
Normal file
209
early-sync-shutdown.patch
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
From c65eb8365344eeb72ee2c0b333ab54d925263b3f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lennart Poettering <lennart@poettering.net>
|
||||||
|
Date: Fri, 25 Jan 2013 22:33:33 +0100
|
||||||
|
Subject: [PATCH] shutdown: issue a sync() as soon as shutdown.target is queued
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile.am | 7 ++++--
|
||||||
|
src/core/job.c | 26 ++++++++++++++++++++
|
||||||
|
src/core/job.h | 2 ++
|
||||||
|
src/core/sync.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/core/sync.h | 24 +++++++++++++++++++
|
||||||
|
src/core/transaction.c | 1 +
|
||||||
|
6 files changed, 123 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 src/core/sync.c
|
||||||
|
create mode 100644 src/core/sync.h
|
||||||
|
|
||||||
|
Index: systemd-195/Makefile.am
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/Makefile.am
|
||||||
|
+++ systemd-195/Makefile.am
|
||||||
|
@@ -1038,7 +1038,9 @@ libsystemd_core_la_SOURCES = \
|
||||||
|
src/core/syscall-list.c \
|
||||||
|
src/core/syscall-list.h \
|
||||||
|
src/core/audit-fd.c \
|
||||||
|
- src/core/audit-fd.h
|
||||||
|
+ src/core/audit-fd.h \
|
||||||
|
+ src/core/sync.c \
|
||||||
|
+ src/core/sync.h
|
||||||
|
|
||||||
|
nodist_libsystemd_core_la_SOURCES = \
|
||||||
|
src/core/load-fragment-gperf.c \
|
||||||
|
@@ -1052,7 +1054,8 @@ libsystemd_core_la_CFLAGS = \
|
||||||
|
$(LIBWRAP_CFLAGS) \
|
||||||
|
$(PAM_CFLAGS) \
|
||||||
|
$(AUDIT_CFLAGS) \
|
||||||
|
- $(KMOD_CFLAGS)
|
||||||
|
+ $(KMOD_CFLAGS) \
|
||||||
|
+ -pthread
|
||||||
|
|
||||||
|
libsystemd_core_la_LIBADD = \
|
||||||
|
libsystemd-capability.la \
|
||||||
|
Index: systemd-195/src/core/job.c
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/core/job.c
|
||||||
|
+++ systemd-195/src/core/job.c
|
||||||
|
@@ -34,6 +34,9 @@
|
||||||
|
#include "load-dropin.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "dbus-job.h"
|
||||||
|
+#include "special.h"
|
||||||
|
+#include "sync.h"
|
||||||
|
+#include "virt.h"
|
||||||
|
|
||||||
|
JobBusClient* job_bus_client_new(DBusConnection *connection, const char *name) {
|
||||||
|
JobBusClient *cl;
|
||||||
|
@@ -1045,6 +1048,29 @@ int job_coldplug(Job *j) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void job_shutdown_magic(Job *j) {
|
||||||
|
+ assert(j);
|
||||||
|
+
|
||||||
|
+ /* The shutdown target gets some special treatment here: we
|
||||||
|
+ * tell the kernel to begin with flushing its disk caches, to
|
||||||
|
+ * optimize shutdown time a bit. Ideally we wouldn't hardcode
|
||||||
|
+ * this magic into PID 1. However all other processes aren't
|
||||||
|
+ * options either since they'd exit much sooner than PID 1 and
|
||||||
|
+ * asynchronous sync() would cause their exit to be
|
||||||
|
+ * delayed. */
|
||||||
|
+
|
||||||
|
+ if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (j->type != JOB_START)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (detect_container(NULL) > 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ asynchronous_sync();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static const char* const job_state_table[_JOB_STATE_MAX] = {
|
||||||
|
[JOB_WAITING] = "waiting",
|
||||||
|
[JOB_RUNNING] = "running"
|
||||||
|
Index: systemd-195/src/core/job.h
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/core/job.h
|
||||||
|
+++ systemd-195/src/core/job.h
|
||||||
|
@@ -217,6 +217,8 @@ int job_finish_and_invalidate(Job *j, Jo
|
||||||
|
|
||||||
|
char *job_dbus_path(Job *j);
|
||||||
|
|
||||||
|
+void job_shutdown_magic(Job *j);
|
||||||
|
+
|
||||||
|
const char* job_type_to_string(JobType t);
|
||||||
|
JobType job_type_from_string(const char *s);
|
||||||
|
|
||||||
|
Index: systemd-195/src/core/sync.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ systemd-195/src/core/sync.c
|
||||||
|
@@ -0,0 +1,65 @@
|
||||||
|
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||||
|
+
|
||||||
|
+/***
|
||||||
|
+ This file is part of systemd.
|
||||||
|
+
|
||||||
|
+ Copyright 2013 Lennart Poettering
|
||||||
|
+
|
||||||
|
+ systemd is free software; you can redistribute it and/or modify it
|
||||||
|
+ under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
+ (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ systemd is distributed in the hope that it will be useful, but
|
||||||
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+***/
|
||||||
|
+
|
||||||
|
+#include <pthread.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+#include "sync.h"
|
||||||
|
+
|
||||||
|
+static void *sync_thread(void *p) {
|
||||||
|
+ sync();
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int asynchronous_sync(void) {
|
||||||
|
+ pthread_attr_t a;
|
||||||
|
+ pthread_t t;
|
||||||
|
+ int r;
|
||||||
|
+
|
||||||
|
+ /* It kinda sucks that we have to resort to threads to
|
||||||
|
+ * implement an asynchronous sync(), but well, such is
|
||||||
|
+ * life.
|
||||||
|
+ *
|
||||||
|
+ * Note that issuing this command right before exiting a
|
||||||
|
+ * process will cause the process to wait for the sync() to
|
||||||
|
+ * complete. This function hence is nicely asynchronous really
|
||||||
|
+ * only in long running processes. */
|
||||||
|
+
|
||||||
|
+ r = pthread_attr_init(&a);
|
||||||
|
+ if (r != 0)
|
||||||
|
+ return -r;
|
||||||
|
+
|
||||||
|
+ r = pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
|
||||||
|
+ if (r != 0) {
|
||||||
|
+ r = -r;
|
||||||
|
+ goto finish;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ r = pthread_create(&t, &a, sync_thread, NULL);
|
||||||
|
+ if (r != 0) {
|
||||||
|
+ r = -r;
|
||||||
|
+ goto finish;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+finish:
|
||||||
|
+ pthread_attr_destroy(&a);
|
||||||
|
+ return r;
|
||||||
|
+}
|
||||||
|
Index: systemd-195/src/core/sync.h
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ systemd-195/src/core/sync.h
|
||||||
|
@@ -0,0 +1,24 @@
|
||||||
|
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||||
|
+
|
||||||
|
+#pragma once
|
||||||
|
+
|
||||||
|
+/***
|
||||||
|
+ This file is part of systemd.
|
||||||
|
+
|
||||||
|
+ Copyright 2013 Lennart Poettering
|
||||||
|
+
|
||||||
|
+ systemd is free software; you can redistribute it and/or modify it
|
||||||
|
+ under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
+ (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ systemd is distributed in the hope that it will be useful, but
|
||||||
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+***/
|
||||||
|
+
|
||||||
|
+int asynchronous_sync(void);
|
||||||
|
Index: systemd-195/src/core/transaction.c
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/core/transaction.c
|
||||||
|
+++ systemd-195/src/core/transaction.c
|
||||||
|
@@ -592,6 +592,7 @@ static int transaction_apply(Transaction
|
||||||
|
job_add_to_run_queue(j);
|
||||||
|
job_add_to_dbus_queue(j);
|
||||||
|
job_start_timer(j);
|
||||||
|
+ job_shutdown_magic(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
36
handle-HOSTNAME.patch
Normal file
36
handle-HOSTNAME.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Index: systemd-195/src/hostname/hostnamed.c
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/hostname/hostnamed.c
|
||||||
|
+++ systemd-195/src/hostname/hostnamed.c
|
||||||
|
@@ -118,6 +118,10 @@ static int read_data(void) {
|
||||||
|
if (r < 0 && r != -ENOENT)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
|
||||||
|
+ if (r < 0 && r != -ENOENT)
|
||||||
|
+ return r;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -203,6 +207,7 @@ static int write_data_hostname(void) {
|
||||||
|
|
||||||
|
static int write_data_static_hostname(void) {
|
||||||
|
|
||||||
|
+ int r;
|
||||||
|
if (isempty(data[PROP_STATIC_HOSTNAME])) {
|
||||||
|
|
||||||
|
if (unlink("/etc/hostname") < 0)
|
||||||
|
@@ -211,7 +216,11 @@ static int write_data_static_hostname(vo
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
|
||||||
|
+ r = write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
|
||||||
|
+ if (!r) {
|
||||||
|
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
|
||||||
|
+ }
|
||||||
|
+ return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int write_data_other(void) {
|
173
improve-bash-completion.patch
Normal file
173
improve-bash-completion.patch
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
Index: systemd-195/bash-completion/systemd-bash-completion.sh
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/bash-completion/systemd-bash-completion.sh
|
||||||
|
+++ systemd-195/bash-completion/systemd-bash-completion.sh
|
||||||
|
@@ -114,15 +114,15 @@ _systemctl () {
|
||||||
|
[SNAPSHOTS]='delete'
|
||||||
|
[ENVS]='set-environment unset-environment'
|
||||||
|
[STANDALONE]='daemon-reexec daemon-reload default dot dump
|
||||||
|
- emergency exit halt kexec list-jobs list-units
|
||||||
|
- list-unit-files poweroff reboot rescue show-environment'
|
||||||
|
+ emergency exit halt hibernate kexec list-jobs list-units
|
||||||
|
+ list-unit-files poweroff reboot rescue show-environment suspend'
|
||||||
|
[NAME]='snapshot load'
|
||||||
|
[FILE]='link'
|
||||||
|
)
|
||||||
|
|
||||||
|
for ((i=0; $i <= $COMP_CWORD; i++)); do
|
||||||
|
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||||
|
- ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
|
||||||
|
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||||
|
verb=${COMP_WORDS[i]}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
@@ -245,7 +245,7 @@ _loginctl () {
|
||||||
|
|
||||||
|
for ((i=0; $i <= $COMP_CWORD; i++)); do
|
||||||
|
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||||
|
- ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
|
||||||
|
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||||
|
verb=${COMP_WORDS[i]}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
@@ -280,10 +280,21 @@ _loginctl () {
|
||||||
|
}
|
||||||
|
complete -F _loginctl loginctl
|
||||||
|
|
||||||
|
+__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
|
||||||
|
+ ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
|
||||||
|
+ _{P,U,G}ID _COMM _EXE _CMDLINE
|
||||||
|
+ _AUDIT_{SESSION,LOGINUID}
|
||||||
|
+ _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
|
||||||
|
+ _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
|
||||||
|
+ _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
|
||||||
|
+ _KERNEL_{DEVICE,SUBSYSTEM}
|
||||||
|
+ _UDEV_{SYSNAME,DEVNODE,DEVLINK}
|
||||||
|
+ __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
|
||||||
|
+
|
||||||
|
_journalctl() {
|
||||||
|
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
local -A OPTS=(
|
||||||
|
- [STANDALONE]='-a --all -b --this-boot -f --follow --header
|
||||||
|
+ [STANDALONE]='-a --all -b --this-boot --disk-usage -f --follow --header
|
||||||
|
-h --help -l --local --new-id128 -m --merge --no-pager
|
||||||
|
--no-tail -q --quiet --setup-keys --this-boot --verify
|
||||||
|
--version'
|
||||||
|
@@ -291,17 +302,6 @@ _journalctl() {
|
||||||
|
[ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
|
||||||
|
--verify-key'
|
||||||
|
)
|
||||||
|
- local journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
|
||||||
|
- ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
|
||||||
|
- _{P,U,G}ID _COMM _EXE _CMDLINE
|
||||||
|
- _AUDIT_{SESSION,LOGINUID}
|
||||||
|
- _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
|
||||||
|
- _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
|
||||||
|
- _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
|
||||||
|
- _KERNEL_{DEVICE,SUBSYSTEM}
|
||||||
|
- _UDEV_{SYSNAME,DEVNODE,DEVLINK}
|
||||||
|
- __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
|
||||||
|
-
|
||||||
|
|
||||||
|
if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
|
||||||
|
case $prev in
|
||||||
|
@@ -313,7 +313,7 @@ _journalctl() {
|
||||||
|
comps='short short-monotonic verbose export json cat'
|
||||||
|
;;
|
||||||
|
--field|-F)
|
||||||
|
- comps=${journal_fields[*]}
|
||||||
|
+ comps=${__journal_fields[*]}
|
||||||
|
;;
|
||||||
|
--unit|-u)
|
||||||
|
comps=$(journalctl -F '_SYSTEMD_UNIT')
|
||||||
|
@@ -337,7 +337,7 @@ _journalctl() {
|
||||||
|
COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") )
|
||||||
|
else
|
||||||
|
compopt -o nospace
|
||||||
|
- COMPREPLY=( $(compgen -W '${journal_fields[*]}' -S= -- "$cur") )
|
||||||
|
+ COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") )
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
complete -F _journalctl journalctl
|
||||||
|
@@ -476,3 +476,81 @@ _hostnamectl() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _hostnamectl hostnamectl
|
||||||
|
+
|
||||||
|
+__get_all_sysdevs() {
|
||||||
|
+ local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/)
|
||||||
|
+ printf '%s\n' "${devs[@]%/}"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+_udevadm() {
|
||||||
|
+ local i verb comps
|
||||||
|
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
+ local OPTS='-h --help --version --debug'
|
||||||
|
+
|
||||||
|
+ local -A VERBS=(
|
||||||
|
+ [INFO]='info'
|
||||||
|
+ [TRIGGER]='trigger'
|
||||||
|
+ [SETTLE]='settle'
|
||||||
|
+ [CONTROL]='control'
|
||||||
|
+ [MONITOR]='monitor'
|
||||||
|
+ [HWDB]='hwdb'
|
||||||
|
+ [TESTBUILTIN]='test-builtin'
|
||||||
|
+ [TEST]='test'
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ for ((i=0; $i <= $COMP_CWORD; i++)); do
|
||||||
|
+ if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||||
|
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||||
|
+ verb=${COMP_WORDS[i]}
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ if [[ -z $verb && $cur = -* ]]; then
|
||||||
|
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
|
||||||
|
+ return 0
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [[ -z $verb ]]; then
|
||||||
|
+ comps=${VERBS[*]}
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[INFO]}; then
|
||||||
|
+ if [[ $cur = -* ]]; then
|
||||||
|
+ comps='--help --query= --path= --name= --root --attribute-walk --export-db --cleanup-db'
|
||||||
|
+ else
|
||||||
|
+ comps=$( __get_all_sysdevs )
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[TRIGGER]}; then
|
||||||
|
+ comps='--help --verbose --dry-run --type= --action= --subsystem-match=
|
||||||
|
+ --subsystem-nomatch= --attr-match= --attr-nomatch= --property-match=
|
||||||
|
+ --tag-match= --sysname-match= --parent-match='
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[SETTLE]}; then
|
||||||
|
+ comps='--help --timeout= --seq-start= --seq-end= --exit-if-exists= --quiet'
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[CONTROL]}; then
|
||||||
|
+ comps='--help --exit --log-priority= --stop-exec-queue --start-exec-queue
|
||||||
|
+ --reload --property= --children-max= --timeout='
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[MONITOR]}; then
|
||||||
|
+ comps='--help --kernel --udev --property --subsystem-match= --tag-match='
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[HWDB]}; then
|
||||||
|
+ comps='--help --update --test='
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[TEST]}; then
|
||||||
|
+ if [[ $cur = -* ]]; then
|
||||||
|
+ comps='--help --action='
|
||||||
|
+ else
|
||||||
|
+ comps=$( __get_all_sysdevs )
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ elif __contains_word "$verb" ${VERBS[TESTBUILTIN]}; then
|
||||||
|
+ comps='blkid btrfs firmware hwdb input_id kmod net_id path_id usb_id uaccess'
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+complete -F _udevadm udevadm
|
@ -41,7 +41,7 @@ Index: systemd-195/src/shared/util.c
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- systemd-195.orig/src/shared/util.c
|
--- systemd-195.orig/src/shared/util.c
|
||||||
+++ systemd-195/src/shared/util.c
|
+++ systemd-195/src/shared/util.c
|
||||||
@@ -876,69 +876,89 @@ fail:
|
@@ -876,69 +876,88 @@ fail:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,99 +52,103 @@ Index: systemd-195/src/shared/util.c
|
|||||||
- FILE *f;
|
- FILE *f;
|
||||||
- char **m = NULL;
|
- char **m = NULL;
|
||||||
- int r;
|
- int r;
|
||||||
+int load_env_file(const char *fname,
|
+int load_env_file(const char *fname, char ***rl) {
|
||||||
+ char ***rl) {
|
|
||||||
+
|
+
|
||||||
+ FILE _cleanup_fclose_ *f;
|
+ _cleanup_fclose_ FILE *f;
|
||||||
+ char *b;
|
+ _cleanup_strv_free_ char **m = NULL;
|
||||||
+ char _cleanup_free_ *c = NULL;
|
+ _cleanup_free_ char *c = NULL;
|
||||||
+ char _cleanup_strv_free_ **m = NULL;
|
|
||||||
|
|
||||||
assert(fname);
|
assert(fname);
|
||||||
assert(rl);
|
assert(rl);
|
||||||
|
|
||||||
- if (!(f = fopen(fname, "re")))
|
- if (!(f = fopen(fname, "re")))
|
||||||
|
+ /* This reads an environment file, but will not complain about
|
||||||
|
+ * any invalid assignments, that needs to be done by the
|
||||||
|
+ * caller */
|
||||||
|
+
|
||||||
+ f = fopen(fname, "re");
|
+ f = fopen(fname, "re");
|
||||||
+ if (!f)
|
+ if (!f)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
while (!feof(f)) {
|
while (!feof(f)) {
|
||||||
- char l[LINE_MAX], *p, *u;
|
- char l[LINE_MAX], *p, *u;
|
||||||
+ char l[LINE_MAX], *p, *u, *cs;
|
- char **t;
|
||||||
char **t;
|
+ char l[LINE_MAX], *p, *cs, *b;
|
||||||
|
|
||||||
if (!fgets(l, sizeof(l), f)) {
|
if (!fgets(l, sizeof(l), f)) {
|
||||||
- if (feof(f))
|
- if (feof(f))
|
||||||
+ if (!feof(f))
|
- break;
|
||||||
|
+ if (ferror(f))
|
||||||
+ return -errno;
|
+ return -errno;
|
||||||
+ else if (!c)
|
+
|
||||||
break;
|
+ /* The previous line was a continuation line?
|
||||||
+ }
|
+ * Let's process it now, before we leave the
|
||||||
|
+ * loop */
|
||||||
|
+ if (c)
|
||||||
|
+ goto process;
|
||||||
|
|
||||||
- r = -errno;
|
- r = -errno;
|
||||||
- goto finish;
|
- goto finish;
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
|
||||||
|
- p = strstrip(l);
|
||||||
|
+ /* Is this a continuation line? If so, just append
|
||||||
|
+ * this to c, and go to next line right-away */
|
||||||
+ cs = endswith(l, "\\\n");
|
+ cs = endswith(l, "\\\n");
|
||||||
+ if (cs) {
|
+ if (cs) {
|
||||||
+ *cs = '\0';
|
+ *cs = '\0';
|
||||||
+ b = strappend(c, l);
|
+ b = strappend(c, l);
|
||||||
+ if (!b)
|
+ if (!b)
|
||||||
+ return log_oom();
|
+ return -ENOMEM;
|
||||||
+
|
|
||||||
|
- if (!*p)
|
||||||
+ free(c);
|
+ free(c);
|
||||||
+ c = b;
|
+ c = b;
|
||||||
+ *l = '\0';
|
continue;
|
||||||
+ continue;
|
+ }
|
||||||
}
|
|
||||||
|
|
||||||
- p = strstrip(l);
|
- if (strchr(COMMENTS, *p))
|
||||||
|
- continue;
|
||||||
|
+ /* If the previous line was a continuation line,
|
||||||
|
+ * append the current line to it */
|
||||||
+ if (c) {
|
+ if (c) {
|
||||||
+ b = strappend(c, l);
|
+ b = strappend(c, l);
|
||||||
+ if (!b)
|
+ if (!b)
|
||||||
+ return log_oom();
|
+ return -ENOMEM;
|
||||||
|
|
||||||
- if (!*p)
|
|
||||||
- continue;
|
|
||||||
+ free(c);
|
|
||||||
+ c = b;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ p = strstrip(c ? c : l);
|
|
||||||
|
|
||||||
- if (strchr(COMMENTS, *p))
|
|
||||||
+ if (!*p) {
|
|
||||||
+ free(c);
|
|
||||||
+ c = NULL;
|
|
||||||
continue;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (!(u = normalize_env_assignment(p))) {
|
- if (!(u = normalize_env_assignment(p))) {
|
||||||
- r = log_oom();
|
- r = log_oom();
|
||||||
- goto finish;
|
- goto finish;
|
||||||
+ if (strchr(COMMENTS, *p)) {
|
|
||||||
+ free(c);
|
+ free(c);
|
||||||
+ c = NULL;
|
+ c = b;
|
||||||
+ continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ u = normalize_env_assignment(p);
|
- t = strv_append(m, u);
|
||||||
+ if (!u)
|
- free(u);
|
||||||
+ return log_oom();
|
+ process:
|
||||||
+
|
+ p = strstrip(c ? c : l);
|
||||||
+ free(c);
|
|
||||||
+ c = NULL;
|
|
||||||
+
|
|
||||||
t = strv_append(m, u);
|
|
||||||
free(u);
|
|
||||||
|
|
||||||
- if (!t) {
|
- if (!t) {
|
||||||
- r = log_oom();
|
- r = log_oom();
|
||||||
- goto finish;
|
- goto finish;
|
||||||
- }
|
+ if (*p && !strchr(COMMENTS, *p)) {
|
||||||
+ if (!t)
|
+ _cleanup_free_ char *u;
|
||||||
+ return log_oom();
|
+ int k;
|
||||||
|
+
|
||||||
|
+ u = normalize_env_assignment(p);
|
||||||
|
+ if (!u)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ k = strv_extend(&m, u);
|
||||||
|
+ if (k < 0)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
strv_free(m);
|
- strv_free(m);
|
||||||
m = t;
|
- m = t;
|
||||||
|
+ free(c);
|
||||||
|
+ c = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- r = 0;
|
- r = 0;
|
||||||
@ -163,3 +167,52 @@ Index: systemd-195/src/shared/util.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
int write_env_file(const char *fname, char **l) {
|
int write_env_file(const char *fname, char **l) {
|
||||||
|
Index: systemd-195/src/shared/strv.c
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/shared/strv.c
|
||||||
|
+++ systemd-195/src/shared/strv.c
|
||||||
|
@@ -370,6 +370,32 @@ fail:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int strv_extend(char ***l, const char *value) {
|
||||||
|
+ char **c;
|
||||||
|
+ char *v;
|
||||||
|
+ unsigned n;
|
||||||
|
+
|
||||||
|
+ if (!value)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ v = strdup(value);
|
||||||
|
+ if (!v)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ n = strv_length(*l);
|
||||||
|
+ c = realloc(*l, sizeof(char*) * (n + 2));
|
||||||
|
+ if (!c) {
|
||||||
|
+ free(v);
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ c[n] = v;
|
||||||
|
+ c[n+1] = NULL;
|
||||||
|
+
|
||||||
|
+ *l = c;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
char **strv_uniq(char **l) {
|
||||||
|
char **i;
|
||||||
|
|
||||||
|
Index: systemd-195/src/shared/strv.h
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/shared/strv.h
|
||||||
|
+++ systemd-195/src/shared/strv.h
|
||||||
|
@@ -37,6 +37,7 @@ unsigned strv_length(char **l);
|
||||||
|
char **strv_merge(char **a, char **b);
|
||||||
|
char **strv_merge_concat(char **a, char **b, const char *suffix);
|
||||||
|
char **strv_append(char **l, const char *s);
|
||||||
|
+int strv_extend(char ***l, const char *value);
|
||||||
|
|
||||||
|
char **strv_remove(char **l, const char *s);
|
||||||
|
char **strv_remove_prefix(char **l, const char *s);
|
||||||
|
25
systemctl-print-wall-on-if-successful.patch
Normal file
25
systemctl-print-wall-on-if-successful.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From f6bb13ab8db51aaedc825fec2f0458b60309b27a Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Thu, 14 Feb 2013 14:08:09 -0500
|
||||||
|
Subject: [PATCH] systemctl: print wall message only if successful
|
||||||
|
|
||||||
|
systemctl would write to the wall even if unsuccessful.
|
||||||
|
|
||||||
|
https://bugs.freedesktop.org/show_bug.cgi?id=60393
|
||||||
|
---
|
||||||
|
src/systemctl/systemctl.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Index: systemd-195/src/systemctl/systemctl.c
|
||||||
|
===================================================================
|
||||||
|
--- systemd-195.orig/src/systemctl/systemctl.c
|
||||||
|
+++ systemd-195/src/systemctl/systemctl.c
|
||||||
|
@@ -1825,7 +1825,7 @@ static int start_special(DBusConnection
|
||||||
|
}
|
||||||
|
|
||||||
|
r = start_unit(bus, args);
|
||||||
|
- if (r >= 0)
|
||||||
|
+ if (r == EXIT_SUCCESS)
|
||||||
|
warn_wall(a);
|
||||||
|
|
||||||
|
return r;
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Feb 15 16:04:39 UTC 2013 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Add early-sync-shutdown.patch: start sync just when
|
||||||
|
shutdown.target is beginning
|
||||||
|
- Update parse-multiline-env-file.patch to better handle continuing
|
||||||
|
lines.
|
||||||
|
- Add handle-HOSTNAME.patch: handle /etc/HOSTNAME (bnc#803653).
|
||||||
|
- Add systemctl-print-wall-on-if-successful.patch: only print on
|
||||||
|
wall if successful.
|
||||||
|
- Add improve-bash-completion.patch: improve bash completion.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 15 13:05:19 UTC 2013 - lnussel@suse.de
|
Fri Feb 15 13:05:19 UTC 2013 - lnussel@suse.de
|
||||||
|
|
||||||
|
@ -266,6 +266,14 @@ Patch125: journalctl-require-argument-for-priority
|
|||||||
Patch126: cryptsetup-accept-read-only.patch
|
Patch126: cryptsetup-accept-read-only.patch
|
||||||
# PATCH-FIX-OPENSUSE disable-nss-myhostname-warning-bnc-783841.diff lnussel@suse.de -- disable nss-myhostname warning (bnc#783841)
|
# PATCH-FIX-OPENSUSE disable-nss-myhostname-warning-bnc-783841.diff lnussel@suse.de -- disable nss-myhostname warning (bnc#783841)
|
||||||
Patch127: disable-nss-myhostname-warning-bnc-783841.diff
|
Patch127: disable-nss-myhostname-warning-bnc-783841.diff
|
||||||
|
# PATCH-FIX-UPSTREAM early-sync-shutdown.patch fcrozat@suse.com -- Start sync on shutdown early
|
||||||
|
Patch128: early-sync-shutdown.patch
|
||||||
|
# PATCH-FIX-OPENSUSE handle-HOSTNAME.patch fcrozat@suse.com -- handle /etc/HOSTNAME (bnc#803653)
|
||||||
|
Patch129: handle-HOSTNAME.patch
|
||||||
|
# PATCH-FIX-UPSTREAM systemctl-print-wall-on-if-successful.patch fcrozat@suse.com -- Only print on wall if successful
|
||||||
|
Patch130: systemctl-print-wall-on-if-successful.patch
|
||||||
|
# PATCH-FIX-UPSTREAM improve-bash-completion.patch fcrozat@suse.com -- improve bash completion
|
||||||
|
Patch131: improve-bash-completion.patch
|
||||||
|
|
||||||
# udev patches
|
# udev patches
|
||||||
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
||||||
@ -497,7 +505,6 @@ cp %{SOURCE7} m4/
|
|||||||
%patch1021 -p1
|
%patch1021 -p1
|
||||||
%patch1022 -p1
|
%patch1022 -p1
|
||||||
%patch1023 -p1
|
%patch1023 -p1
|
||||||
%patch1024 -p1
|
|
||||||
|
|
||||||
#systemd
|
#systemd
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
@ -589,6 +596,10 @@ cp %{SOURCE7} m4/
|
|||||||
%patch125 -p1
|
%patch125 -p1
|
||||||
%patch126 -p1
|
%patch126 -p1
|
||||||
%patch127 -p1
|
%patch127 -p1
|
||||||
|
%patch128 -p1
|
||||||
|
%patch129 -p1
|
||||||
|
%patch130 -p1
|
||||||
|
%patch131 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Feb 15 16:04:39 UTC 2013 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Add early-sync-shutdown.patch: start sync just when
|
||||||
|
shutdown.target is beginning
|
||||||
|
- Update parse-multiline-env-file.patch to better handle continuing
|
||||||
|
lines.
|
||||||
|
- Add handle-HOSTNAME.patch: handle /etc/HOSTNAME (bnc#803653).
|
||||||
|
- Add systemctl-print-wall-on-if-successful.patch: only print on
|
||||||
|
wall if successful.
|
||||||
|
- Add improve-bash-completion.patch: improve bash completion.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 15 13:05:19 UTC 2013 - lnussel@suse.de
|
Fri Feb 15 13:05:19 UTC 2013 - lnussel@suse.de
|
||||||
|
|
||||||
|
12
systemd.spec
12
systemd.spec
@ -261,6 +261,14 @@ Patch125: journalctl-require-argument-for-priority
|
|||||||
Patch126: cryptsetup-accept-read-only.patch
|
Patch126: cryptsetup-accept-read-only.patch
|
||||||
# PATCH-FIX-OPENSUSE disable-nss-myhostname-warning-bnc-783841.diff lnussel@suse.de -- disable nss-myhostname warning (bnc#783841)
|
# PATCH-FIX-OPENSUSE disable-nss-myhostname-warning-bnc-783841.diff lnussel@suse.de -- disable nss-myhostname warning (bnc#783841)
|
||||||
Patch127: disable-nss-myhostname-warning-bnc-783841.diff
|
Patch127: disable-nss-myhostname-warning-bnc-783841.diff
|
||||||
|
# PATCH-FIX-UPSTREAM early-sync-shutdown.patch fcrozat@suse.com -- Start sync on shutdown early
|
||||||
|
Patch128: early-sync-shutdown.patch
|
||||||
|
# PATCH-FIX-OPENSUSE handle-HOSTNAME.patch fcrozat@suse.com -- handle /etc/HOSTNAME (bnc#803653)
|
||||||
|
Patch129: handle-HOSTNAME.patch
|
||||||
|
# PATCH-FIX-UPSTREAM systemctl-print-wall-on-if-successful.patch fcrozat@suse.com -- Only print on wall if successful
|
||||||
|
Patch130: systemctl-print-wall-on-if-successful.patch
|
||||||
|
# PATCH-FIX-UPSTREAM improve-bash-completion.patch fcrozat@suse.com -- improve bash completion
|
||||||
|
Patch131: improve-bash-completion.patch
|
||||||
|
|
||||||
# udev patches
|
# udev patches
|
||||||
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
# PATCH-FIX-OPENSUSE 1001-Reinstate-TIMEOUT-handling.patch
|
||||||
@ -583,6 +591,10 @@ cp %{SOURCE7} m4/
|
|||||||
%patch125 -p1
|
%patch125 -p1
|
||||||
%patch126 -p1
|
%patch126 -p1
|
||||||
%patch127 -p1
|
%patch127 -p1
|
||||||
|
%patch128 -p1
|
||||||
|
%patch129 -p1
|
||||||
|
%patch130 -p1
|
||||||
|
%patch131 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
|
Loading…
Reference in New Issue
Block a user