Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
commit
b22d12ef62
|
@ -0,0 +1,144 @@
|
|||
From 6f202edb2c2e340523c6c0f2c0a93690eaab7a68 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Tue, 18 Feb 2020 08:44:34 -0800
|
||||
Subject: [PATCH] Revert "job: Don't mark as redundant if deps are relevant"
|
||||
|
||||
This reverts commit 097537f07a2fab3cb73aef7bc59f2a66aa93f533. It
|
||||
causes https://bugzilla.redhat.com/show_bug.cgi?id=1803293 .
|
||||
---
|
||||
src/core/job.c | 51 ++++++------------------------------------
|
||||
src/core/job.h | 3 +--
|
||||
src/core/transaction.c | 8 +++----
|
||||
3 files changed, 12 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/src/core/job.c b/src/core/job.c
|
||||
index 5982404cf0..5048a5093e 100644
|
||||
--- a/src/core/job.c
|
||||
+++ b/src/core/job.c
|
||||
@@ -383,62 +383,25 @@ JobType job_type_lookup_merge(JobType a, JobType b) {
|
||||
return job_merging_table[(a - 1) * a / 2 + b];
|
||||
}
|
||||
|
||||
-bool job_later_link_matters(Job *j, JobType type, unsigned generation) {
|
||||
- JobDependency *l;
|
||||
-
|
||||
- assert(j);
|
||||
-
|
||||
- j->generation = generation;
|
||||
-
|
||||
- LIST_FOREACH(subject, l, j->subject_list) {
|
||||
- UnitActiveState state = _UNIT_ACTIVE_STATE_INVALID;
|
||||
-
|
||||
- /* Have we seen this before? */
|
||||
- if (l->object->generation == generation)
|
||||
- continue;
|
||||
-
|
||||
- state = unit_active_state(l->object->unit);
|
||||
- switch (type) {
|
||||
-
|
||||
- case JOB_START:
|
||||
- return IN_SET(state, UNIT_INACTIVE, UNIT_FAILED) ||
|
||||
- job_later_link_matters(l->object, type, generation);
|
||||
-
|
||||
- case JOB_STOP:
|
||||
- return IN_SET(state, UNIT_ACTIVE, UNIT_RELOADING) ||
|
||||
- job_later_link_matters(l->object, type, generation);
|
||||
-
|
||||
- default:
|
||||
- assert_not_reached("Invalid job type");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
-bool job_is_redundant(Job *j, unsigned generation) {
|
||||
-
|
||||
- assert(j);
|
||||
-
|
||||
- UnitActiveState state = unit_active_state(j->unit);
|
||||
- switch (j->type) {
|
||||
+bool job_type_is_redundant(JobType a, UnitActiveState b) {
|
||||
+ switch (a) {
|
||||
|
||||
case JOB_START:
|
||||
- return IN_SET(state, UNIT_ACTIVE, UNIT_RELOADING) && !job_later_link_matters(j, JOB_START, generation);
|
||||
+ return IN_SET(b, UNIT_ACTIVE, UNIT_RELOADING);
|
||||
|
||||
case JOB_STOP:
|
||||
- return IN_SET(state, UNIT_INACTIVE, UNIT_FAILED) && !job_later_link_matters(j, JOB_STOP, generation);
|
||||
+ return IN_SET(b, UNIT_INACTIVE, UNIT_FAILED);
|
||||
|
||||
case JOB_VERIFY_ACTIVE:
|
||||
- return IN_SET(state, UNIT_ACTIVE, UNIT_RELOADING);
|
||||
+ return IN_SET(b, UNIT_ACTIVE, UNIT_RELOADING);
|
||||
|
||||
case JOB_RELOAD:
|
||||
return
|
||||
- state == UNIT_RELOADING;
|
||||
+ b == UNIT_RELOADING;
|
||||
|
||||
case JOB_RESTART:
|
||||
return
|
||||
- state == UNIT_ACTIVATING;
|
||||
+ b == UNIT_ACTIVATING;
|
||||
|
||||
case JOB_NOP:
|
||||
return true;
|
||||
diff --git a/src/core/job.h b/src/core/job.h
|
||||
index 02b057ee06..03ad640618 100644
|
||||
--- a/src/core/job.h
|
||||
+++ b/src/core/job.h
|
||||
@@ -196,8 +196,7 @@ _pure_ static inline bool job_type_is_superset(JobType a, JobType b) {
|
||||
return a == job_type_lookup_merge(a, b);
|
||||
}
|
||||
|
||||
-bool job_later_link_matters(Job *j, JobType type, unsigned generation);
|
||||
-bool job_is_redundant(Job *j, unsigned generation);
|
||||
+bool job_type_is_redundant(JobType a, UnitActiveState b) _pure_;
|
||||
|
||||
/* Collapses a state-dependent job type into a simpler type by observing
|
||||
* the state of the unit which it is going to be applied to. */
|
||||
diff --git a/src/core/transaction.c b/src/core/transaction.c
|
||||
index 8d67f9ce1a..a0ea0f0489 100644
|
||||
--- a/src/core/transaction.c
|
||||
+++ b/src/core/transaction.c
|
||||
@@ -279,7 +279,7 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void transaction_drop_redundant(Transaction *tr, unsigned generation) {
|
||||
+static void transaction_drop_redundant(Transaction *tr) {
|
||||
bool again;
|
||||
|
||||
/* Goes through the transaction and removes all jobs of the units whose jobs are all noops. If not
|
||||
@@ -299,7 +299,7 @@ static void transaction_drop_redundant(Transaction *tr, unsigned generation) {
|
||||
|
||||
LIST_FOREACH(transaction, k, j)
|
||||
if (tr->anchor_job == k ||
|
||||
- !job_is_redundant(k, generation) ||
|
||||
+ !job_type_is_redundant(k->type, unit_active_state(k->unit)) ||
|
||||
(k->unit->job && job_type_is_conflicting(k->type, k->unit->job->type))) {
|
||||
keep = true;
|
||||
break;
|
||||
@@ -730,7 +730,7 @@ int transaction_activate(
|
||||
transaction_minimize_impact(tr);
|
||||
|
||||
/* Third step: Drop redundant jobs */
|
||||
- transaction_drop_redundant(tr, generation++);
|
||||
+ transaction_drop_redundant(tr);
|
||||
|
||||
for (;;) {
|
||||
/* Fourth step: Let's remove unneeded jobs that might
|
||||
@@ -772,7 +772,7 @@ int transaction_activate(
|
||||
}
|
||||
|
||||
/* Eights step: Drop redundant jobs again, if the merging now allows us to drop more. */
|
||||
- transaction_drop_redundant(tr, generation++);
|
||||
+ transaction_drop_redundant(tr);
|
||||
|
||||
/* Ninth step: check whether we can actually apply this */
|
||||
r = transaction_is_destructive(tr, mode, e);
|
||||
--
|
||||
2.25.0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# RPM macros for packages creating system accounts
|
||||
#
|
||||
# Turn a sysusers.d file into macros specified by
|
||||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation
|
||||
|
||||
%sysusers_requires_compat Requires(pre): shadow-utils
|
||||
|
||||
%sysusers_create_compat() \
|
||||
%(%{_rpmconfigdir}/sysusers.generate-pre.sh %{?*}) \
|
||||
%{nil}
|
2
sources
2
sources
|
@ -1 +1 @@
|
|||
SHA512 (systemd-244.1.tar.gz) = 7a604d2dcf29b51eeac609813eb8dfca2900fc1d6b5ae6a211704fc695f4fb909644d86e87c790c53dec8fac3cb6f1e628266d44234d2b35d12e06bbf4fbaf8e
|
||||
SHA512 (systemd-245.2.tar.gz) = 05e40d0b93ebd7b709d16b5f6d75f3da84417e9a401d7726fe7876328e1408c9c29818b5bcc3f5889f17f8e6af889f87dc2f78f348f2aa023e0d6bfed41b0554
|
||||
|
|
|
@ -48,7 +48,7 @@ for file in files(buildroot):
|
|||
continue
|
||||
if '/security/pam_' in n:
|
||||
o = o_pam
|
||||
elif 'rpm/macros' in n:
|
||||
elif '/rpm/' in n:
|
||||
o = o_rpm_macros
|
||||
elif re.search(r'/lib.*\.pc|/man3/|/usr/include|(?<!/libsystemd-shared-...).so$', n):
|
||||
o = o_devel
|
||||
|
@ -77,6 +77,9 @@ for file in files(buildroot):
|
|||
elif re.search(r'''udev(?!\.pc)|
|
||||
hwdb|
|
||||
bootctl|
|
||||
sd-boot|systemd-boot\.|loader.conf|
|
||||
bless-boot|
|
||||
boot-system-token|
|
||||
kernel-install|
|
||||
vconsole|
|
||||
backlight|
|
||||
|
@ -87,14 +90,19 @@ for file in files(buildroot):
|
|||
cryptsetup|
|
||||
kmod|
|
||||
quota|
|
||||
pstore|
|
||||
sleep|suspend|hibernate|
|
||||
systemd-tmpfiles-setup-dev|
|
||||
network/99-default.link|
|
||||
growfs|makefs|makeswap|
|
||||
growfs|makefs|makeswap|mkswap|
|
||||
fsck|
|
||||
repart|
|
||||
gpt-auto|
|
||||
volatile-root|
|
||||
verity-setup|
|
||||
remount-fs|
|
||||
/boot$|
|
||||
/boot/efi|
|
||||
remount-fs|
|
||||
/kernel/|
|
||||
/kernel$|
|
||||
/modprobe.d
|
||||
|
|
124
systemd.spec
124
systemd.spec
|
@ -12,10 +12,12 @@
|
|||
%global system_unit_dir %{pkgdir}/system
|
||||
%global user_unit_dir %{pkgdir}/user
|
||||
|
||||
%bcond_without tests
|
||||
|
||||
Name: systemd
|
||||
Url: https://www.freedesktop.org/wiki/Software/systemd
|
||||
Version: 244.1
|
||||
Release: 2%{?commit:.git%{shortcommit}}.0.riscv64%{?dist}
|
||||
Version: 245.2
|
||||
Release: 1%{?commit:.git%{shortcommit}}.0.riscv64%{?dist}
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: System and Service Manager
|
||||
|
@ -50,6 +52,11 @@ Source10: systemd-udev-trigger-no-reload.conf
|
|||
Source11: 20-grubby.install
|
||||
Source12: systemd-user
|
||||
|
||||
Source21: macros.sysusers
|
||||
Source22: sysusers.attr
|
||||
Source23: sysusers.prov
|
||||
Source24: sysusers.generate-pre.sh
|
||||
|
||||
%if 0
|
||||
GIT_DIR=../../src/systemd/.git git format-patch-ab --no-signature -M -N v235..v235-stable
|
||||
i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done|xclip
|
||||
|
@ -57,10 +64,13 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[
|
|||
%endif
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1738828
|
||||
Patch0001: https://github.com/keszybz/systemd/commit/464a73411c13596a130a7a8f0ac00ca728e5f69e.patch
|
||||
Patch0001: use-bfq-scheduler.patch
|
||||
|
||||
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1803293
|
||||
Patch1000: 0001-Revert-job-Don-t-mark-as-redundant-if-deps-are-relev.patch
|
||||
|
||||
#Patch0040: systemd-seccomp-riscv64.patch
|
||||
|
||||
%ifarch %{ix86} x86_64 aarch64
|
||||
|
@ -71,6 +81,8 @@ BuildRequires: gcc
|
|||
BuildRequires: gcc-c++
|
||||
BuildRequires: libcap-devel
|
||||
BuildRequires: libmount-devel
|
||||
BuildRequires: libfdisk-devel
|
||||
BuildRequires: libpwquality-devel
|
||||
BuildRequires: pam-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: audit-libs-devel
|
||||
|
@ -88,6 +100,7 @@ BuildRequires: libidn2-devel
|
|||
BuildRequires: libcurl-devel
|
||||
BuildRequires: kmod-devel
|
||||
BuildRequires: elfutils-devel
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: libgcrypt-devel
|
||||
BuildRequires: libgpg-error-devel
|
||||
BuildRequires: gnutls-devel
|
||||
|
@ -116,6 +129,7 @@ BuildRequires: gettext
|
|||
%ifarch %{valgrind_arches}
|
||||
BuildRequires: valgrind-devel
|
||||
%endif
|
||||
BuildRequires: pkgconfig(bash-completion)
|
||||
|
||||
Requires(post): coreutils
|
||||
Requires(post): sed
|
||||
|
@ -148,7 +162,7 @@ Conflicts: initscripts < 9.56.1
|
|||
%if 0%{?fedora}
|
||||
Conflicts: fedora-release < 23-0.12
|
||||
%endif
|
||||
Obsoletes: timedatex < 0.6-3
|
||||
Obsoletes: timedatex < 0.6-3
|
||||
Provides: timedatex = 0.6-3
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1753381
|
||||
|
@ -238,9 +252,9 @@ Provides: udev = %{version}
|
|||
Provides: udev%{_isa} = %{version}
|
||||
Obsoletes: udev < 183
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1377733#c9
|
||||
Recommends: systemd-bootchart
|
||||
Suggests: systemd-bootchart
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1408878
|
||||
Recommends: kbd
|
||||
Requires: kbd
|
||||
License: LGPLv2+
|
||||
|
||||
%description udev
|
||||
|
@ -312,6 +326,7 @@ CONFIGURE_OPTS=(
|
|||
-Dkmod=true
|
||||
-Dxkbcommon=true
|
||||
-Dblkid=true
|
||||
-Dfdisk=true
|
||||
%ifnarch riscv64
|
||||
-Dseccomp=true
|
||||
%else
|
||||
|
@ -328,11 +343,14 @@ CONFIGURE_OPTS=(
|
|||
-Dpam=true
|
||||
-Dacl=true
|
||||
-Dsmack=true
|
||||
-Dopenssl=true
|
||||
-Dp11kit=true
|
||||
-Dgcrypt=true
|
||||
-Daudit=true
|
||||
-Delfutils=true
|
||||
-Dlibcryptsetup=true
|
||||
-Delfutils=true
|
||||
-Dpwquality=true
|
||||
-Dqrencode=true
|
||||
-Dgnutls=true
|
||||
-Dmicrohttpd=true
|
||||
|
@ -455,6 +473,11 @@ install -D -t %{buildroot}/usr/lib/systemd/ %{SOURCE3}
|
|||
|
||||
sed -i 's|#!/usr/bin/env python3|#!%{__python3}|' %{buildroot}/usr/lib/systemd/tests/run-unit-tests.py
|
||||
|
||||
install -m 0644 -D -t %{buildroot}%{_rpmconfigdir}/macros.d/ %{SOURCE21}
|
||||
install -m 0644 -D -t %{buildroot}%{_rpmconfigdir}/fileattrs/ %{SOURCE22}
|
||||
install -m 0755 -D -t %{buildroot}%{_rpmconfigdir}/ %{SOURCE23}
|
||||
install -m 0755 -D -t %{buildroot}%{_rpmconfigdir}/ %{SOURCE24}
|
||||
|
||||
%find_lang %{name}
|
||||
|
||||
# Split files in build root into rpms. See split-files.py for the
|
||||
|
@ -495,7 +518,9 @@ python3 %{SOURCE2} %buildroot <<EOF
|
|||
EOF
|
||||
|
||||
%check
|
||||
%ninja_test -C %{_vpath_builddir}
|
||||
%if %{with tests}
|
||||
meson test -C %{_vpath_builddir} -t 6
|
||||
%endif
|
||||
|
||||
#############################################################################################
|
||||
|
||||
|
@ -522,7 +547,27 @@ getent passwd systemd-resolve &>/dev/null || useradd -r -u 193 -l -g systemd-res
|
|||
|
||||
%post
|
||||
systemd-machine-id-setup &>/dev/null || :
|
||||
systemctl daemon-reexec &>/dev/null || :
|
||||
|
||||
systemctl daemon-reexec &>/dev/null || {
|
||||
# systemd v239 had bug #9553 in D-Bus authentication of the private socket,
|
||||
# which was later fixed in v240 by #9625.
|
||||
#
|
||||
# The end result is that a `systemctl daemon-reexec` call as root will fail
|
||||
# when upgrading from systemd v239, which means the system will not start
|
||||
# running the new version of systemd after this post install script runs.
|
||||
#
|
||||
# To work around this issue, let's fall back to using a `kill -TERM 1` to
|
||||
# re-execute the daemon when the `systemctl daemon-reexec` call fails.
|
||||
#
|
||||
# In order to prevent issues when the reason why the daemon-reexec failed is
|
||||
# not the aforementioned bug, let's only use this fallback when:
|
||||
# - we're upgrading this RPM package; and
|
||||
# - we confirm that systemd is running as PID1 on this system.
|
||||
if [ $1 -gt 1 ] && [ -d /run/systemd/system ] ; then
|
||||
kill -TERM 1 &>/dev/null || :
|
||||
fi
|
||||
}
|
||||
|
||||
journalctl --update-catalog &>/dev/null || :
|
||||
systemd-tmpfiles --create &>/dev/null || :
|
||||
|
||||
|
@ -544,9 +589,12 @@ setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/ &>/de
|
|||
# https://bugzilla.redhat.com/show_bug.cgi?id=1118740#c23
|
||||
# This will fix up enablement of any preset services that got installed
|
||||
# before systemd due to rpm ordering problems:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1647172
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1647172.
|
||||
# We also do this for user units, see
|
||||
# https://fedoraproject.org/wiki/Changes/Systemd_presets_for_user_units.
|
||||
if [ $1 -eq 1 ] ; then
|
||||
systemctl preset-all &>/dev/null || :
|
||||
systemctl --global preset-all &>/dev/null || :
|
||||
fi
|
||||
|
||||
%preun
|
||||
|
@ -718,10 +766,66 @@ fi
|
|||
%files tests -f .file-list-tests
|
||||
|
||||
%changelog
|
||||
* Sun Dec 22 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> - 244.1-2.0.riscv64
|
||||
* Sun Mar 22 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> - 245.2-1.0.riscv64
|
||||
- Disable SECCOMP until the test can pass
|
||||
- Add SECCOMP support for RISC-V 64-bit (riscv64)
|
||||
|
||||
* Wed Mar 18 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 245.2-1
|
||||
- Update to latest stable version (a few bug fixes for random things) (#1798776)
|
||||
|
||||
* Fri Mar 6 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 245-1
|
||||
- Update to latest version (#1807485)
|
||||
|
||||
* Wed Feb 26 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 245~rc2-1
|
||||
- Modify the downstream udev rule to use bfq to only apply to disks (#1803500)
|
||||
- "Upgrade" dependency on kbd package from Recommends to Requires (#1408878)
|
||||
- Move systemd-bless-boot.service and systemd-boot-system-token.service to
|
||||
systemd-udev subpackage (#1807462)
|
||||
- Move a bunch of other services to systemd-udev:
|
||||
systemd-pstore.service, all fsck-related functionality,
|
||||
systemd-volatile-root.service, systemd-verity-setup.service, and a few
|
||||
other related files.
|
||||
- Fix daemon-reload rule to not kill non-systemd pid1 (#1803240)
|
||||
- Fix namespace-related failure when starting systemd-homed (#1807465) and
|
||||
group lookup failure in nss_systemd (#1809147)
|
||||
- Drop autogenerated BOOT_IMAGE= parameter from stored kernel command lines
|
||||
(#1716164)
|
||||
- Don't require /proc to be mounted for systemd-sysusers to work (#1807768)
|
||||
|
||||
* Fri Feb 21 2020 Filipe Brandenburger <filbranden@gmail.com> - 245~rc1-4
|
||||
- Update daemon-reexec fallback to check whether the system is booted with
|
||||
systemd as PID 1 and check whether we're upgrading before using kill -TERM
|
||||
on PID 1 (#1803240)
|
||||
|
||||
* Tue Feb 18 2020 Adam Williamson <awilliam@redhat.com> - 245~rc1-3
|
||||
- Revert 097537f0 to fix plymouth etc. running when they shouldn't (#1803293)
|
||||
|
||||
* Fri Feb 7 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 245~rc1-2
|
||||
- Add default 'disable *' preset for user units (#1792474, #1468501),
|
||||
see https://fedoraproject.org/wiki/Changes/Systemd_presets_for_user_units.
|
||||
- Add macro to generate "compat" scriptlets based off sysusers.d format
|
||||
and autogenerate user() and group() virtual provides (#1792462),
|
||||
see https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format.
|
||||
- Revert patch to udev rules causing regression with usb hubs (#1800820).
|
||||
|
||||
* Wed Feb 5 2020 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 245~rc1-1
|
||||
- New upstream release, see
|
||||
https://raw.githubusercontent.com/systemd/systemd/v245-rc1/NEWS.
|
||||
|
||||
This release includes completely new functionality: systemd-repart,
|
||||
systemd-homed, user reconds in json, and multi-instantiable
|
||||
journald, and a partial rework of internal communcation to use
|
||||
varlink, and bunch of more incremental changes.
|
||||
|
||||
The "predictable" interface name naming scheme is changed,
|
||||
net.naming-scheme= can be used to undo the change. The change applies
|
||||
to container interface names on the host.
|
||||
|
||||
- Fixes #1774242, #1787089, #1798414/CVE-2020-1712.
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org>
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Dec 21 2019 <zbyszek@nano-f31> - 244.1-2
|
||||
- Disable service watchdogs (for systemd units)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
%__sysusers_provides %{_rpmconfigdir}/sysusers.prov
|
||||
%__sysusers_path ^%{_sysusersdir}/.*\\.conf$
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script turns sysuser.d files into scriptlets mandated by Fedora
|
||||
# packaging guidelines. The general idea is to define users using the
|
||||
# declarative syntax but to turn this into traditional scriptlets.
|
||||
|
||||
user() {
|
||||
user="$1"
|
||||
uid="$2"
|
||||
desc="$3"
|
||||
group="$4"
|
||||
home="$5"
|
||||
shell="$6"
|
||||
|
||||
[ "$desc" = '-' ] && desc=
|
||||
[ "$home" = '-' -o "$home" = '' ] && home=/
|
||||
[ "$shell" = '-' -o "$shell" = '' ] && shell=/sbin/nologin
|
||||
|
||||
if [ "$uid" = '-' -o "$uid" = '' ]; then
|
||||
cat <<EOF
|
||||
getent passwd '$user' >/dev/null || \\
|
||||
useradd -r -g '$group' -d '$home' -s '$shell' -c '$desc' '$user'
|
||||
EOF
|
||||
else
|
||||
cat <<EOF
|
||||
if ! getent passwd '$user' >/dev/null ; then
|
||||
if ! getent passwd '$uid' >/dev/null ; then
|
||||
useradd -r -u '$uid' -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user'
|
||||
else
|
||||
useradd -r -g '$group' -d '$home' -s /sbin/nologin -c '$desc' '$user'
|
||||
fi
|
||||
fi
|
||||
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
group() {
|
||||
group="$1"
|
||||
gid="$2"
|
||||
if [ "$gid" = '-' ]; then
|
||||
cat <<EOF
|
||||
getent group '$group' >/dev/null || groupadd -r '$group'
|
||||
EOF
|
||||
else
|
||||
cat <<EOF
|
||||
getent group '$group' >/dev/null || groupadd -f -g '$gid' -r '$group'
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
parse() {
|
||||
while read line; do
|
||||
[ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
|
||||
line="${line## *}"
|
||||
[ -z "$line" ] && continue
|
||||
eval arr=( $line )
|
||||
case "${arr[0]}" in
|
||||
('u')
|
||||
group "${arr[1]}" "${arr[2]}"
|
||||
user "${arr[1]}" "${arr[2]}" "${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
|
||||
# TODO: user:group support
|
||||
;;
|
||||
('g')
|
||||
group "${arr[1]}" "${arr[2]}"
|
||||
;;
|
||||
('m')
|
||||
group "${arr[2]}" "-"
|
||||
user "${arr[1]}" "-" "" "${arr[2]}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
for fn in "$@"; do
|
||||
[ -e "$fn" ] || continue
|
||||
echo "# generated from $(basename $fn)"
|
||||
parse < "$fn"
|
||||
done
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
parse() {
|
||||
while read line; do
|
||||
[ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
|
||||
line="${line## *}"
|
||||
[ -z "$line" ] && continue
|
||||
set -- $line
|
||||
case "$1" in
|
||||
('u')
|
||||
echo "user($2)"
|
||||
echo "group($2)"
|
||||
# TODO: user:group support
|
||||
;;
|
||||
('g')
|
||||
echo "group($2)"
|
||||
;;
|
||||
('m')
|
||||
echo "user($2)"
|
||||
echo "group($3)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
while read fn; do
|
||||
parse < "$fn"
|
||||
done
|
|
@ -20,11 +20,12 @@ new file mode 100644
|
|||
index 00000000000..480b941761f
|
||||
--- /dev/null
|
||||
+++ b/rules.d/60-block-scheduler.rules
|
||||
@@ -0,0 +1,5 @@
|
||||
@@ -0,0 +1,6 @@
|
||||
+# do not edit this file, it will be overwritten on update
|
||||
+
|
||||
+ACTION=="add", SUBSYSTEM=="block", \
|
||||
+ KERNEL=="mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|sd*[!0-9]|sr*", \
|
||||
+ ENV{DEVTYPE}=="disk", \
|
||||
+ ATTR{queue/scheduler}="bfq"
|
||||
diff --git a/rules.d/meson.build b/rules.d/meson.build
|
||||
index b6a32ba77e2..1da958b4d46 100644
|
Loading…
Reference in New Issue