From: Alex Kiernan <alex.kiernan@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v5 5/6] systemd-systemctl-native: simplify and support preset-all
Date: Mon, 29 Apr 2019 15:43:24 +0100 [thread overview]
Message-ID: <20190429144325.63744-6-alex.kiernan@gmail.com> (raw)
In-Reply-To: <20190429144325.63744-1-alex.kiernan@gmail.com>
From: Jonas Bonn <jonas@norrbonn.se>
Now that the systemd class sets up service presets instead of actively
enabling services, the 'enable' and 'disable' subcommands for systemctl
are not actually used anywhere. As such, we can remove these to make
sure that nobody inadvertently introduces new uses of them.
We do, however, one case where the enable/disable machinery is still
required; that is for the read-only-rootfs case where the 'preset-all'
command can not be called at runtime but needs to be called when creatng
the image. For this case, we implement 'preset-all' here.
There was also a previous implement of 'preset'... not sure that this
ever worked as the implementation looks bogus and there aren't any users
anyway. This patch removes the 'preset' subcommand, as well.
Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
.../systemd/systemd-systemctl/systemctl | 36 ++++---------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index 2bc648961761..ce50352018c0 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -9,22 +9,6 @@ while [ $# != 0 ]; do
opt="$1"
case "$opt" in
- enable)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
- disable)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
mask)
shift
@@ -33,13 +17,11 @@ while [ $# != 0 ]; do
cmd_args="1"
shift
;;
- preset)
+ preset-all)
shift
action="$opt"
- services="$1"
- cmd_args="1"
- shift
+ cmd_args="0"
;;
--root=*)
ROOT=${opt##--root=}
@@ -57,16 +39,12 @@ while [ $# != 0 ]; do
;;
esac
done
-if [ "$action" = "preset" -a "$service_file" = "" ]; then
+
+if [ "$action" = "preset-all" ]; then
services=$(for f in `find $ROOT/etc/systemd/system $ROOT/lib/systemd/system $ROOT/usr/lib/systemd/system -type f 2>1`; do basename $f; done)
- services="$services $opt"
- presetall=1
fi
for service in $services; do
- if [ "$presetall" = "1" ]; then
- action="preset"
- fi
if [ "$action" = "mask" ]; then
if [ ! -d $ROOT/etc/systemd/system/ ]; then
mkdir -p $ROOT/etc/systemd/system/
@@ -105,10 +83,10 @@ for service in $services; do
# If any new unit types are added to systemd they should be added
# to this regular expression.
unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|target\.wants\|path\|timer\|snapshot\)\s*$'
- if [ "$action" = "preset" ]; then
- action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
+ if [ "$action" = "preset-all" ]; then
+ action=`egrep -sh $service $ROOT/usr/lib/systemd/system-preset/*.preset | cut -f1 -d' '`
if [ -z "$action" ]; then
- globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
+ globalpreset=`egrep -sh '\*' $ROOT/usr/lib/systemd/system-preset/*.preset | cut -f1 -d' '`
if [ -n "$globalpreset" ]; then
action="$globalpreset"
else
--
2.17.1
next prev parent reply other threads:[~2019-04-29 14:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 14:43 [PATCH v5 0/6] Fix systemd service enables/move towards "stateless" configuration Alex Kiernan
2019-04-29 14:43 ` [PATCH v5 1/6] systemd: don't build firstboot by default Alex Kiernan
2019-04-29 14:43 ` [PATCH v5 2/6] systemd: do not create machine-id Alex Kiernan
2019-04-29 14:43 ` [PATCH v5 3/6] systemd-conf: simplify creation of machine-specific configuration Alex Kiernan
2019-04-29 14:43 ` [PATCH v5 4/6] systemd: create preset files instead of installing in image Alex Kiernan
2019-04-29 14:43 ` Alex Kiernan [this message]
2019-04-30 10:31 ` [PATCH v5 5/6] systemd-systemctl-native: simplify and support preset-all Alex Kiernan
2019-04-29 14:43 ` [PATCH v5 6/6] rootfs-postcommands: call preset-all for read-only-rootfs Alex Kiernan
2019-04-30 10:59 ` [PATCH v5 0/6] Fix systemd service enables/move towards "stateless" configuration richard.purdie
2019-04-30 11:45 ` Alex Kiernan
2019-04-30 11:52 ` Alex Kiernan
2019-04-30 12:02 ` Paul Barker
2019-04-30 12:13 ` Alex Kiernan
2019-04-30 12:24 ` Paul Barker
2019-04-30 12:33 ` Alex Kiernan
2019-04-30 12:37 ` Paul Barker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190429144325.63744-6-alex.kiernan@gmail.com \
--to=alex.kiernan@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox