diffstat for systemd-240 systemd-240 changelog | 39 + control | 7 extra/locale-gen-helper | 21 gbp.conf | 2 patches/pureos/01_core-Allow-to-configure-execute_directories-executio.patch | 341 ++++++++++ patches/pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch | 99 ++ patches/pureos/03_hwdb-librem13v4-keyboards.patch | 24 patches/series | 3 systemd.install | 1 tests/storage | 10 tests/upstream | 1 watch | 2 12 files changed, 545 insertions(+), 5 deletions(-) diff -Nru systemd-240/debian/changelog systemd-240/debian/changelog --- systemd-240/debian/changelog 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/changelog 2019-02-09 16:03:20.000000000 +0000 @@ -1,3 +1,36 @@ +systemd (240-5pureos1) green; urgency=medium + + [ Matthias Klumpp ] + * Merge with Debian unstable/master, remaining change: + - Add functionality to configure & run locale-gen when a locale is changed. + * Update localed locale-gen patches to latest version + * Modify locale-gen-helper to work with current localed patches + + [ Chris Lamb ] + * Add hwdb-librem13v4-keyboards.patch (PB: #683) + - Add support for Purism Librem 13v4 keyboards. This patch was applied + upstream at . + + [ Felipe Sateler ] + * Reenable pristine-tar in gbp.conf. + The pristine-tar bug has been fixed, so we can use it again. + This reverts commit 9fcfbbf6fea15eacfa3fad74240431c5f2c3300e. + * d/watch: add version mangle to transform -rc to ~rc. + Upstream has started releasing rcs, so let's account for that + + [ Dimitri John Ledkov ] + * debian/tests/storage: improve cleanups. + On fast ppc64el machines, cryptsetup start job may not complete by the time + tearDown is executed. In that case stop, causes to simply cancel the start + job without actually cleaning up the dmsetup node. This leads to failing + subsequent test as it no longer starts with a clean device. Thus ensure the + systemd-cryptsetup unit is started, before stopping it. + Also rmmod scsi_debug module at the end, to allow re-running the test in a + loop. + * debian/tests/upstream: Mark TEST-13-NSPAWN-SMOKE as flakey. + + -- Matthias Klumpp Sat, 09 Feb 2019 17:03:20 +0100 + systemd (240-5) unstable; urgency=medium [ Felipe Sateler ] @@ -299,6 +332,12 @@ -- Michael Biebl Fri, 07 Sep 2018 08:41:12 +0200 +systemd (239-7pureos1) green; urgency=medium + + * Add functionality to configure & run locale-gen when a locale is changed. + + -- Matthias Klumpp Fri, 10 Aug 2018 12:48:11 +0200 + systemd (239-7) unstable; urgency=medium * autopkgtest: Add iputils-ping dependency to root-unittests. diff -Nru systemd-240/debian/control systemd-240/debian/control --- systemd-240/debian/control 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/control 2019-02-09 16:01:01.000000000 +0000 @@ -1,7 +1,8 @@ Source: systemd Section: admin Priority: optional -Maintainer: Debian systemd Maintainers +Maintainer: PureOS Maintainers +XSBC-Original-Maintainer: Debian systemd Maintainers Uploaders: Michael Biebl , Marco d'Itri , Sjoerd Simons , @@ -9,8 +10,8 @@ Felipe Sateler Standards-Version: 4.2.1 Rules-Requires-Root: no -Vcs-Git: https://salsa.debian.org/systemd-team/systemd.git -Vcs-Browser: https://salsa.debian.org/systemd-team/systemd +Vcs-Git: https://source.puri.sm/pureos/core/systemd.git +Vcs-Browser: https://source.puri.sm/pureos/core/systemd Homepage: https://www.freedesktop.org/wiki/Software/systemd Build-Depends: debhelper (>= 10.4~), pkg-config, diff -Nru systemd-240/debian/extra/locale-gen-helper systemd-240/debian/extra/locale-gen-helper --- systemd-240/debian/extra/locale-gen-helper 1970-01-01 00:00:00.000000000 +0000 +++ systemd-240/debian/extra/locale-gen-helper 2019-02-09 15:53:22.000000000 +0000 @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +locale_gen=/usr/sbin/locale-gen +if ! [ -x "$(command -v $locale_gen)" ]; then + echo 'The locale-gen binary was not found.' + + # no locale-gen binary is not an error, because the locales + # package might be missing in (very) minimal installations + exit 0 +fi + +if [ -z "$LANG" ]; then + echo "No locale specified for locale-gen helper." + exit 1 +fi + +# enable the new locale for compilation. Always prefer UTF-8 +sed -i "s/^# $LANG UTF-8$/$LANG UTF-8/" /etc/locale.gen + +$locale_gen diff -Nru systemd-240/debian/gbp.conf systemd-240/debian/gbp.conf --- systemd-240/debian/gbp.conf 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/gbp.conf 2019-01-30 21:19:31.000000000 +0000 @@ -1,5 +1,5 @@ [DEFAULT] -pristine-tar = False +pristine-tar = True patch-numbers = False debian-branch = master diff -Nru systemd-240/debian/patches/pureos/01_core-Allow-to-configure-execute_directories-executio.patch systemd-240/debian/patches/pureos/01_core-Allow-to-configure-execute_directories-executio.patch --- systemd-240/debian/patches/pureos/01_core-Allow-to-configure-execute_directories-executio.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-240/debian/patches/pureos/01_core-Allow-to-configure-execute_directories-executio.patch 2019-02-09 15:49:06.000000000 +0000 @@ -0,0 +1,341 @@ +From 6d4ddefe17d2ddc25f310dd9fb8d1d65f46532c3 Mon Sep 17 00:00:00 2001 +From: Matthias Klumpp +Date: Sun, 9 Sep 2018 03:18:45 +0200 +Subject: [PATCH 1/2] core: Allow to configure execute_directories execution + behavior + +This adds a new bitfield to `execute_directories()` which allows to +configure whether to ignore non-zero exit statuses of binaries run and +whether to allow parallel execution of commands. +In case of a failing script, its exit status will now be returned. +--- + src/core/manager.c | 8 ++--- + src/core/shutdown.c | 2 +- + src/shared/exec-util.c | 61 +++++++++++++++++++++++++++------------ + src/shared/exec-util.h | 9 +++++- + src/sleep/sleep.c | 4 +-- + src/test/test-exec-util.c | 48 ++++++++++++++++++++++++++---- + 6 files changed, 99 insertions(+), 33 deletions(-) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 6086531bab..7518d66899 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -3810,8 +3810,8 @@ static int manager_run_environment_generators(Manager *m) { + return 0; + + RUN_WITH_UMASK(0022) +- r = execute_directories(paths, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, m->transient_environment); +- ++ r = execute_directories(paths, DEFAULT_TIMEOUT_USEC, gather_environment, ++ args, NULL, m->transient_environment, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + return r; + } + +@@ -3845,8 +3845,8 @@ static int manager_run_generators(Manager *m) { + argv[4] = NULL; + + RUN_WITH_UMASK(0022) +- (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, +- NULL, NULL, (char**) argv, m->transient_environment); ++ (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, NULL, NULL, ++ (char**) argv, m->transient_environment, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + r = 0; + +diff --git a/src/core/shutdown.c b/src/core/shutdown.c +index cb47ee8984..ae6f96c263 100644 +--- a/src/core/shutdown.c ++++ b/src/core/shutdown.c +@@ -442,7 +442,7 @@ int main(int argc, char *argv[]) { + arguments[0] = NULL; + arguments[1] = arg_verb; + arguments[2] = NULL; +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + (void) rlimit_nofile_safe(); + +diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c +index 17a278a00f..925477e15c 100644 +--- a/src/shared/exec-util.c ++++ b/src/shared/exec-util.c +@@ -78,24 +78,30 @@ static int do_execute( + void* const callback_args[_STDOUT_CONSUME_MAX], + int output_fd, + char *argv[], +- char *envp[]) { ++ char *envp[], ++ ExecDirFlags flags) { + + _cleanup_hashmap_free_free_ Hashmap *pids = NULL; + _cleanup_strv_free_ char **paths = NULL; + char **path, **e; + int r; ++ bool parallel_execution; + + /* We fork this all off from a child process so that we can somewhat cleanly make + * use of SIGALRM to set a time limit. + * +- * If callbacks is nonnull, execution is serial. Otherwise, we default to parallel. ++ * We attempt to perform parallel execution if configured by the user, however ++ * if `callbacks` is nonnull, execution must be serial. + */ ++ parallel_execution = (flags & EXECDIR_PARALLEL) > 0; ++ if (callbacks) ++ parallel_execution = false; + + r = conf_files_list_strv(&paths, NULL, NULL, CONF_FILES_EXECUTABLE|CONF_FILES_REGULAR|CONF_FILES_FILTER_MASKED, (const char* const*) directories); + if (r < 0) + return log_error_errno(r, "Failed to enumerate executables: %m"); + +- if (!callbacks) { ++ if (parallel_execution) { + pids = hashmap_new(NULL); + if (!pids) + return log_oom(); +@@ -130,23 +136,29 @@ static int do_execute( + if (r <= 0) + continue; + +- if (pids) { ++ if (parallel_execution) { + r = hashmap_put(pids, PID_TO_PTR(pid), t); + if (r < 0) + return log_oom(); + t = NULL; + } else { + r = wait_for_terminate_and_check(t, pid, WAIT_LOG); +- if (r < 0) +- continue; +- +- if (lseek(fd, 0, SEEK_SET) < 0) +- return log_error_errno(errno, "Failed to seek on serialization fd: %m"); +- +- r = callbacks[STDOUT_GENERATE](fd, callback_args[STDOUT_GENERATE]); +- fd = -1; +- if (r < 0) +- return log_error_errno(r, "Failed to process output from %s: %m", *path); ++ if (flags & EXECDIR_IGNORE_ERRORS) { ++ if (r < 0) ++ continue; ++ } else if (r > 0) { ++ return r; ++ } ++ ++ if (callbacks) { ++ if (lseek(fd, 0, SEEK_SET) < 0) ++ return log_error_errno(errno, "Failed to seek on serialization fd: %m"); ++ ++ r = callbacks[STDOUT_GENERATE](fd, callback_args[STDOUT_GENERATE]); ++ fd = -1; ++ if (r < 0) ++ return log_error_errno(r, "Failed to process output from %s: %m", *path); ++ } + } + } + +@@ -166,7 +178,9 @@ static int do_execute( + t = hashmap_remove(pids, PID_TO_PTR(pid)); + assert(t); + +- (void) wait_for_terminate_and_check(t, pid, WAIT_LOG); ++ r = wait_for_terminate_and_check(t, pid, WAIT_LOG); ++ if ((flags & EXECDIR_IGNORE_ERRORS) == 0 && r > 0) ++ return r; + } + + return 0; +@@ -178,12 +192,14 @@ int execute_directories( + gather_stdout_callback_t const callbacks[_STDOUT_CONSUME_MAX], + void* const callback_args[_STDOUT_CONSUME_MAX], + char *argv[], +- char *envp[]) { ++ char *envp[], ++ ExecDirFlags flags) { + + char **dirs = (char**) directories; + _cleanup_close_ int fd = -1; + char *name; + int r; ++ pid_t executor_pid; + + assert(!strv_isempty(dirs)); + +@@ -205,14 +221,21 @@ int execute_directories( + * them to finish. Optionally a timeout is applied. If a file with the same name + * exists in more than one directory, the earliest one wins. */ + +- r = safe_fork("(sd-executor)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_WAIT, NULL); ++ r = safe_fork("(sd-executor)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &executor_pid); + if (r < 0) + return r; + if (r == 0) { +- r = do_execute(dirs, timeout, callbacks, callback_args, fd, argv, envp); +- _exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS); ++ r = do_execute(dirs, timeout, callbacks, callback_args, fd, argv, envp, flags); ++ r = r < 0 ? EXIT_FAILURE : r; ++ _exit(r); + } + ++ r = wait_for_terminate_and_check("(sd-executor)", executor_pid, 0); ++ if (r < 0) ++ return r; ++ if ((flags & EXECDIR_IGNORE_ERRORS) == 0 && r > 0) ++ return r; ++ + if (!callbacks) + return 0; + +diff --git a/src/shared/exec-util.h b/src/shared/exec-util.h +index 6ac3c9000a..1c36cc629c 100644 +--- a/src/shared/exec-util.h ++++ b/src/shared/exec-util.h +@@ -14,12 +14,19 @@ enum { + _STDOUT_CONSUME_MAX, + }; + ++typedef enum { ++ EXECDIR_NONE = 0, /* No execdir flags */ ++ EXECDIR_PARALLEL = 1 << 0, /* Execute scripts in parallel, if possible */ ++ EXECDIR_IGNORE_ERRORS = 1 << 1, /* Ignore non-zero exit status of scripts */ ++} ExecDirFlags; ++ + int execute_directories( + const char* const* directories, + usec_t timeout, + gather_stdout_callback_t const callbacks[_STDOUT_CONSUME_MAX], + void* const callback_args[_STDOUT_CONSUME_MAX], + char *argv[], +- char *envp[]); ++ char *envp[], ++ ExecDirFlags flags); + + extern const gather_stdout_callback_t gather_environment[_STDOUT_CONSUME_MAX]; +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index 5b7984a6f2..31235aa83d 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -166,7 +166,7 @@ static int execute(char **modes, char **states) { + return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");; + } + +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + log_struct(LOG_INFO, + "MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR, +@@ -186,7 +186,7 @@ static int execute(char **modes, char **states) { + "SLEEP=%s", arg_verb); + + arguments[1] = (char*) "post"; +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + return r; + } +diff --git a/src/test/test-exec-util.c b/src/test/test-exec-util.c +index 21a4538d74..75a8c14030 100644 +--- a/src/test/test-exec-util.c ++++ b/src/test/test-exec-util.c +@@ -117,9 +117,9 @@ static void test_execute_directory(bool gather_stdout) { + assert_se(chmod(mask2e, 0755) == 0); + + if (gather_stdout) +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, ignore_stdout, ignore_stdout_args, NULL, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, ignore_stdout, ignore_stdout_args, NULL, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + else +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, NULL, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, NULL, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + assert_se(chdir(template_lo) == 0); + assert_se(access("it_works", F_OK) >= 0); +@@ -184,7 +184,7 @@ static void test_execution_order(void) { + assert_se(chmod(override, 0755) == 0); + assert_se(chmod(masked, 0755) == 0); + +- execute_directories(dirs, DEFAULT_TIMEOUT_USEC, ignore_stdout, ignore_stdout_args, NULL, NULL); ++ execute_directories(dirs, DEFAULT_TIMEOUT_USEC, ignore_stdout, ignore_stdout_args, NULL, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + + assert_se(read_full_file(output, &contents, NULL) >= 0); + assert_se(streq(contents, "30-override\n80-foo\n90-bar\nlast\n")); +@@ -266,7 +266,7 @@ static void test_stdout_gathering(void) { + assert_se(chmod(name2, 0755) == 0); + assert_se(chmod(name3, 0755) == 0); + +- r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_stdout, args, NULL, NULL); ++ r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_stdout, args, NULL, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + assert_se(r >= 0); + + log_info("got: %s", output); +@@ -332,7 +332,7 @@ static void test_environment_gathering(void) { + r = setenv("PATH", "no-sh-built-in-path", 1); + assert_se(r >= 0); + +- r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, NULL); ++ r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, NULL, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + assert_se(r >= 0); + + STRV_FOREACH(p, env) +@@ -349,7 +349,7 @@ static void test_environment_gathering(void) { + env = strv_new("PATH=" DEFAULT_PATH); + assert_se(env); + +- r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, env); ++ r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, env, EXECDIR_PARALLEL | EXECDIR_IGNORE_ERRORS); + assert_se(r >= 0); + + STRV_FOREACH(p, env) +@@ -364,6 +364,41 @@ static void test_environment_gathering(void) { + (void) setenv("PATH", old, 1); + } + ++static void test_error_catching(void) { ++ char template[] = "/tmp/test-exec-util.XXXXXXX"; ++ const char *dirs[] = {template, NULL}; ++ const char *name, *name2, *name3; ++ int r; ++ ++ assert_se(mkdtemp(template)); ++ ++ log_info("/* %s */", __func__); ++ ++ /* write files */ ++ name = strjoina(template, "/10-foo"); ++ name2 = strjoina(template, "/20-bar"); ++ name3 = strjoina(template, "/30-last"); ++ ++ assert_se(write_string_file(name, ++ "#!/bin/sh\necho a\necho b\necho c\n", ++ WRITE_STRING_FILE_CREATE) == 0); ++ assert_se(write_string_file(name2, ++ "#!/bin/sh\nexit 42\n", ++ WRITE_STRING_FILE_CREATE) == 0); ++ assert_se(write_string_file(name3, ++ "#!/bin/sh\nexit 12", ++ WRITE_STRING_FILE_CREATE) == 0); ++ ++ assert_se(chmod(name, 0755) == 0); ++ assert_se(chmod(name2, 0755) == 0); ++ assert_se(chmod(name3, 0755) == 0); ++ ++ r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, NULL, NULL, EXECDIR_NONE); ++ ++ /* we should exit with the error code of the first script that failed */ ++ assert_se(r == 42); ++} ++ + int main(int argc, char *argv[]) { + test_setup_logging(LOG_DEBUG); + +@@ -372,6 +407,7 @@ int main(int argc, char *argv[]) { + test_execution_order(); + test_stdout_gathering(); + test_environment_gathering(); ++ test_error_catching(); + + return 0; + } +-- +2.20.1 + diff -Nru systemd-240/debian/patches/pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch systemd-240/debian/patches/pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch --- systemd-240/debian/patches/pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-240/debian/patches/pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch 2019-02-09 15:49:06.000000000 +0000 @@ -0,0 +1,99 @@ +From 29100524549baeb8e5f6d4dc8936de687d90b35a Mon Sep 17 00:00:00 2001 +From: Matthias Klumpp +Date: Sat, 9 Feb 2019 16:43:20 +0100 +Subject: [PATCH 2/2] localed: Allow running script hooks on locale change + +This improves integration with distributions using a system to generate +locale on-demand (e.g. via locale-gen), like Debian-based distributions +(Debian/Ubuntu/PureOS/Tanglu/...) by giving them a way to run hook +scripts managing the generation of locale from templates when a change +occurs. +It also is useful for other things, e.g. telling the package manager to +install missing language packs when convenient, or regenerating the +initramfs. +--- + meson.build | 3 +++ + src/locale/localed.c | 23 ++++++++++++++++++++++- + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 56c98b9c1b..9cdfe2bf18 100644 +--- a/meson.build ++++ b/meson.build +@@ -132,6 +132,7 @@ systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-ge + userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators') + systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown') + systemsleepdir = join_paths(rootlibexecdir, 'system-sleep') ++localechangedir = join_paths(rootlibexecdir, 'locale-change') + systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system') + systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset') + udevlibexecdir = join_paths(rootprefixdir, 'lib/udev') +@@ -214,6 +215,7 @@ conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgenerator + conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir) + conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) + conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) ++conf.set_quoted('LOCALE_CHANGE_PATH', localechangedir) + conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) + conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) + conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) +@@ -264,6 +266,7 @@ substs.set('systemenvgeneratordir', systemenvgenerator + substs.set('userenvgeneratordir', userenvgeneratordir) + substs.set('systemshutdowndir', systemshutdowndir) + substs.set('systemsleepdir', systemsleepdir) ++substs.set('localechangedir', localechangedir) + substs.set('VARLOGDIR', varlogdir) + substs.set('CERTIFICATEROOT', get_option('certificate-root')) + substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl')) +diff --git a/src/locale/localed.c b/src/locale/localed.c +index f851d35a08..8e33fc370b 100644 +--- a/src/locale/localed.c ++++ b/src/locale/localed.c +@@ -27,6 +27,7 @@ + #include "string-util.h" + #include "strv.h" + #include "user-util.h" ++#include "exec-util.h" + + static int locale_update_system_manager(Context *c, sd_bus *bus) { + _cleanup_free_ char **l_unset = NULL; +@@ -262,6 +263,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er + bool modified = false; + int interactive, p, r; + char **i; ++ static const char* const hook_dirs[] = {LOCALE_CHANGE_PATH, NULL}; ++ _cleanup_strv_free_ char **hook_envp = NULL; ++ char *x; + + assert(m); + assert(c); +@@ -369,9 +373,26 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- for (p = 0; p < _VARIABLE_LC_MAX; p++) ++ /* prepare environment variables for hook scripts. */ ++ hook_envp = new0(char*, _VARIABLE_LC_MAX); ++ if (!hook_envp) ++ return -ENOMEM; ++ ++ for (p = 0; p < _VARIABLE_LC_MAX; p++) { + free_and_replace(c->locale[p], new_locale[p]); + ++ if (asprintf(&x, "%s=%s", locale_variable_to_string (p), strempty(c->locale[p])) < 0) ++ return -ENOMEM; ++ hook_envp[p] = x; ++ } ++ hook_envp[_VARIABLE_LC_MAX] = NULL; ++ ++ r = execute_directories(hook_dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, NULL, hook_envp, EXECDIR_NONE); ++ if (r != 0) { ++ log_error("Failed to set locale: Script hooks failed with non-zero exit status."); ++ return sd_bus_error_setf(error, SD_BUS_ERROR_FAILED, "Failed to set locale: Script hooks failed with non-zero exit status."); ++ } ++ + r = locale_write_data(c, &settings); + if (r < 0) { + log_error_errno(r, "Failed to set locale: %m"); +-- +2.20.1 + diff -Nru systemd-240/debian/patches/pureos/03_hwdb-librem13v4-keyboards.patch systemd-240/debian/patches/pureos/03_hwdb-librem13v4-keyboards.patch --- systemd-240/debian/patches/pureos/03_hwdb-librem13v4-keyboards.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-240/debian/patches/pureos/03_hwdb-librem13v4-keyboards.patch 2019-02-09 16:01:52.000000000 +0000 @@ -0,0 +1,24 @@ +From 5e7a792453645069501c545f7c47c1eb9e67a021 Mon Sep 17 00:00:00 2001 +From: Chris Lamb +Date: Mon, 21 Jan 2019 23:43:22 +0000 +Subject: [PATCH] hwdb: Add support for Purism Librem 13 V4 keyboards + +--- + hwdb/60-keyboard.hwdb | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb +index 7cf073583d9..0d847ae882f 100644 +--- a/hwdb/60-keyboard.hwdb ++++ b/hwdb/60-keyboard.hwdb +@@ -1117,6 +1117,10 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v2*:pvr* + evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v3*:pvr* + KEYBOARD_KEY_56=backslash + ++# Purism Librem 13 V4 ++evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v4*:pvr* ++ KEYBOARD_KEY_56=backslash ++ + ########################################################### + # Quanta + ########################################################### diff -Nru systemd-240/debian/patches/series systemd-240/debian/patches/series --- systemd-240/debian/patches/series 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/patches/series 2019-02-09 16:02:22.000000000 +0000 @@ -58,3 +58,6 @@ debian/Add-env-variable-for-machine-ID-path.patch debian/Revert-udev-rules-Permission-changes-for-dev-dri-renderD.patch debian/Drop-seccomp-system-call-filter-for-udev.patch +pureos/01_core-Allow-to-configure-execute_directories-executio.patch +pureos/02_localed-Allow-running-script-hooks-on-locale-change.patch +pureos/03_hwdb-librem13v4-keyboards.patch diff -Nru systemd-240/debian/systemd.install systemd-240/debian/systemd.install --- systemd-240/debian/systemd.install 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/systemd.install 2019-02-09 15:52:19.000000000 +0000 @@ -70,3 +70,4 @@ ../../extra/dhclient-exit-hooks.d/ etc/dhcp/ ../../extra/kernel-install.d/* usr/lib/kernel/install.d ../../extra/pam.d etc/ +../../extra/locale-gen-helper lib/systemd/locale-change diff -Nru systemd-240/debian/tests/storage systemd-240/debian/tests/storage --- systemd-240/debian/tests/storage 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/tests/storage 2019-01-30 21:19:31.000000000 +0000 @@ -29,6 +29,11 @@ assert len(devs) == 1 klass.device = '/dev/' + devs[0] + @classmethod + def tearDownClass(klass): + # create a fake SCSI hard drive + subprocess.check_call(['rmmod', 'scsi_debug']) + def tearDown(self): # clear drive with open(self.device, 'wb') as f: @@ -62,12 +67,17 @@ os.waitpid(self.password_agent, 0) self.password_agent = None subprocess.call(['umount', self.plaintext_dev], stderr=subprocess.DEVNULL) + subprocess.call(['systemctl', 'start', 'systemd-cryptsetup@%s.service' % self.plaintext_name], + stderr=subprocess.STDOUT) subprocess.call(['systemctl', 'stop', 'systemd-cryptsetup@%s.service' % self.plaintext_name], stderr=subprocess.STDOUT) if os.path.exists('/etc/crypttab'): os.unlink('/etc/crypttab') if os.path.exists('/etc/crypttab.systemdtest'): os.rename('/etc/crypttab.systemdtest', '/etc/crypttab') + if os.path.exists(self.plaintext_dev): + subprocess.call(['dmsetup', 'remove', self.plaintext_dev], + stderr=subprocess.STDOUT) super().tearDown() diff -Nru systemd-240/debian/tests/upstream systemd-240/debian/tests/upstream --- systemd-240/debian/tests/upstream 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/tests/upstream 2019-01-30 21:19:31.000000000 +0000 @@ -10,6 +10,7 @@ # some tests are flaky BLACKLIST="$BLACKLIST TEST-02-CRYPTSETUP +TEST-13-NSPAWN-SMOKE TEST-16-EXTEND-TIMEOUT TEST-17-UDEV-WANTS " diff -Nru systemd-240/debian/watch systemd-240/debian/watch --- systemd-240/debian/watch 2019-01-27 21:33:07.000000000 +0000 +++ systemd-240/debian/watch 2019-01-30 21:19:31.000000000 +0000 @@ -1,3 +1,3 @@ version=3 -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/systemd-$1\.tar\.gz/ \ +opts=uversionmangle=s/-rc/~rc/,filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/systemd-$1\.tar\.gz/ \ https://github.com/systemd/systemd/tags .*/v?(\d\S*)\.tar\.gz