[systemd-commits] 4 commits - Makefile.am man/systemctl.xml man/systemd.device.xml man/systemd.snapshot.xml man/systemd.target.xml man/systemd.unit.xml src/systemctl.c

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jul 1 18:51:41 PDT 2010


 Makefile.am              |    3 +
 man/systemctl.xml        |    7 ++
 man/systemd.device.xml   |  141 +++++++++++++++++++++++++++++++++++++++++++++++
 man/systemd.snapshot.xml |   87 +++++++++++++++++++++++++++++
 man/systemd.target.xml   |   97 ++++++++++++++++++++++++++++++++
 man/systemd.unit.xml     |   11 ++-
 src/systemctl.c          |   85 ++++++++++++++++++++++++++++
 7 files changed, 427 insertions(+), 4 deletions(-)

New commits:
commit b2c20dd9583eb50e03dfb684ef15e018becc887b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 03:51:29 2010 +0200

    man: document snapshot units

diff --git a/Makefile.am b/Makefile.am
index c5568e2..6334b56 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -325,6 +325,7 @@ MANPAGES = \
 	man/systemd.path.5 \
 	man/systemd.target.5 \
 	man/systemd.device.5 \
+	man/systemd.snapshot.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.snapshot.xml b/man/systemd.snapshot.xml
new file mode 100644
index 0000000..5e73cc6
--- /dev/null
+++ b/man/systemd.snapshot.xml
@@ -0,0 +1,87 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 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
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.snapshot">
+        <refentryinfo>
+                <title>systemd.snapshot</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.snapshot</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.snapshot</refname>
+                <refpurpose>systemd snapshot units</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.snapshot</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>Snapshot units are not configured via unit
+                configuration files. Nonetheless they are named
+                similar to filenames. A unit name whose name ends in
+                <filename>.snapshot</filename> refers to a dynamic
+                snapshot of the systemd runtime state.</para>
+
+                <para>Snapshots are not configured on disk but created
+                dynamically via <command>systemctl snapshot</command>
+                (see
+                <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                for details) or an equivalent command. When created
+                they will automatically get dependencies on the
+                currently activated units. They hence act as saved
+                runtime state of the systemd manager. Later on the
+                user may choose to return to the saved state via
+                <command>systemctl isolate</command>. They are hence
+                useful to roll back to a defined state after
+                temporarily starting/stopping services or
+                similar.</para>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index da077e2..df87613 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -151,10 +151,13 @@
                 with the device node <filename>/dev/sda</filename> in
                 the file system namespace. If this applies a special
                 way to escape the path name is used, so that it is
-                usable as part of a file name. Basically, given a path,
-                "/" is replaced by "-", and all unprintable characters
-                and the "-" are replaced by C-style "\x20"
-                escapes. This escaping is reversible.</para>
+                usable as part of a file name. Basically, given a
+                path, "/" is replaced by "-", and all unprintable
+                characters and the "-" are replaced by C-style "\x20"
+                escapes. The root directory "/" is encoded as single
+                dash, while otherwise the initial and ending "/" is
+                removed from all paths during transformation. This
+                escaping is reversible.</para>
 
                 <para>Optionally, units may be instantiated from a
                 template file at runtime. This allows creation of
commit 6759e7a7638fc98877f98a7d45b265461ea78674
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 03:51:05 2010 +0200

    systemctl: implement delete command

diff --git a/man/systemctl.xml b/man/systemctl.xml
index 80f3554..ad5ca46 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -332,6 +332,13 @@
                                 on reboot.</para>
                         </varlistentry>
                         <varlistentry>
+                                <term><command>delete [NAME...]</command></term>
+
+                                <listitem><para>Remove a snapshot
+                                previously created with
+                                <command>snapshot</command>.</para></listitem>
+                        </varlistentry>
+                        <varlistentry>
                                 <term><command>daemon-reload</command></term>
 
                                 <listitem><para>Reload systemd manager
diff --git a/src/systemctl.c b/src/systemctl.c
index 390cec9..8445430 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1363,6 +1363,89 @@ finish:
         return r;
 }
 
+static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
+        DBusMessage *m = NULL, *reply = NULL;
+        int r;
+        DBusError error;
+        unsigned i;
+
+        assert(bus);
+        assert(args);
+
+        dbus_error_init(&error);
+
+        for (i = 1; i < n; i++) {
+                const char *path = NULL;
+
+                if (!(m = dbus_message_new_method_call(
+                                      "org.freedesktop.systemd1",
+                                      "/org/freedesktop/systemd1",
+                                      "org.freedesktop.systemd1.Manager",
+                                      "GetUnit"))) {
+                        log_error("Could not allocate message.");
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                if (!dbus_message_append_args(m,
+                                              DBUS_TYPE_STRING, &args[i],
+                                              DBUS_TYPE_INVALID)) {
+                        log_error("Could not append arguments to message.");
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
+                        log_error("Failed to issue method call: %s", error.message);
+                        r = -EIO;
+                        goto finish;
+                }
+
+                if (!dbus_message_get_args(reply, &error,
+                                           DBUS_TYPE_OBJECT_PATH, &path,
+                                           DBUS_TYPE_INVALID)) {
+                        log_error("Failed to parse reply: %s", error.message);
+                        r = -EIO;
+                        goto finish;
+                }
+
+                dbus_message_unref(m);
+                if (!(m = dbus_message_new_method_call(
+                                      "org.freedesktop.systemd1",
+                                      path,
+                                      "org.freedesktop.systemd1.Snapshot",
+                                      "Remove"))) {
+                        log_error("Could not allocate message.");
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                dbus_message_unref(reply);
+                if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
+                        log_error("Failed to issue method call: %s", error.message);
+                        r = -EIO;
+                        goto finish;
+                }
+
+                dbus_message_unref(m);
+                dbus_message_unref(reply);
+                m = reply = NULL;
+        }
+
+        r = 0;
+
+finish:
+        if (m)
+                dbus_message_unref(m);
+
+        if (reply)
+                dbus_message_unref(reply);
+
+        dbus_error_free(&error);
+
+        return r;
+}
+
 static int clear_jobs(DBusConnection *bus, char **args, unsigned n) {
         DBusMessage *m = NULL, *reply = NULL;
         DBusError error;
@@ -1597,6 +1680,7 @@ static int systemctl_help(void) {
                "  monitor                         Monitor unit/job changes\n"
                "  dump                            Dump server status\n"
                "  snapshot [NAME]                 Create a snapshot\n"
+               "  delete [NAME...]                Remove one or more snapshots\n"
                "  daemon-reload                   Reload systemd manager configuration\n"
                "  daemon-reexec                   Reexecute systemd manager\n"
                "  daemon-exit                     Ask the systemd manager to quit\n"
@@ -2262,6 +2346,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[]) {
                 { "monitor",           EQUAL, 1, monitor         },
                 { "dump",              EQUAL, 1, dump            },
                 { "snapshot",          LESS,  2, snapshot        },
+                { "delete",            MORE,  2, delete_snapshot },
                 { "daemon-reload",     EQUAL, 1, clear_jobs      },
                 { "daemon-reexec",     EQUAL, 1, clear_jobs      },
                 { "daemon-exit",       EQUAL, 1, clear_jobs      },
commit eec575d8eb739b9146c49084097d4eed889b66c7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 03:28:33 2010 +0200

    man: document device units

diff --git a/Makefile.am b/Makefile.am
index 766ea92..c5568e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -324,6 +324,7 @@ MANPAGES = \
 	man/systemd.timer.5 \
 	man/systemd.path.5 \
 	man/systemd.target.5 \
+	man/systemd.device.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.device.xml b/man/systemd.device.xml
new file mode 100644
index 0000000..7b9cc22
--- /dev/null
+++ b/man/systemd.device.xml
@@ -0,0 +1,141 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 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
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.device">
+        <refentryinfo>
+                <title>systemd.device</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.device</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.device</refname>
+                <refpurpose>systemd device configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.device</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.device</filename> encodes information about
+                a device unit as exposed in the
+                sysfs/<citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                device tree.</para>
+
+                <para>This unit type has no specific options. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. A
+                seperate [Device] section does not exist, since no
+                device-specific options may be configured.</para>
+
+                <para>systemd will automatically create dynamic device
+                units for all kernel devices that are marked with the
+                "systemd" udev tag (by default all block and network
+                devices, and a few others). This may be used to define
+                dependencies between devices and other
+                units.</para>
+
+                <para>Device units are named after the
+                <filename>/sys</filename> and
+                <filename>/dev</filename> paths they control. Example:
+                the device <filename>/dev/sda5</filename> is exposed
+                in systemd as <filename>dev-sda5.device</filename>. For
+                details about the escaping logic used to convert a
+                file system path to a unit name see
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+        </refsect1>
+
+        <refsect1>
+                <title>The udev Database</title>
+
+                <para>The settings of device units may either be
+                configured via unit files, or directly from the udev
+                database (which is recommended). The following udev
+                properties are understood by systemd:</para>
+
+                <variablelist>
+                        <varlistentry>
+                                <term><varname>SYSTEMD_WANTS=</varname></term>
+                                <listitem><para>Adds dependencies of
+                                type <varname>Wants</varname> from
+                                this unit to all listed units. This
+                                may be used to activate aritrary units
+                                if a specific device becomes
+                                available.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>SYSTEMD_ALIAS=</varname></term>
+                                <listitem><para>Adds an additional
+                                alias name to the device unit. This
+                                must be an absolute path that is
+                                automatically transformed into a unit
+                                name. (See above.)</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>ID_MODEL_FROM_DATABASE=</varname></term>
+                                <term><varname>ID_MODEL=</varname></term>
+
+                                <listitem><para>If set, this property is
+                                used as description string for the
+                                device unit.</para></listitem>
+                        </varlistentry>
+
+                </variablelist>
+
+
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
commit da49e9ab4c3cf53de3e41a532877727c6c9e5804
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 02:55:34 2010 +0200

    man: document target units

diff --git a/Makefile.am b/Makefile.am
index aa60784..766ea92 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -323,6 +323,7 @@ MANPAGES = \
 	man/systemd.swap.5 \
 	man/systemd.timer.5 \
 	man/systemd.path.5 \
+	man/systemd.target.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.target.xml b/man/systemd.target.xml
new file mode 100644
index 0000000..f057188
--- /dev/null
+++ b/man/systemd.target.xml
@@ -0,0 +1,97 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 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
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.target">
+        <refentryinfo>
+                <title>systemd.target</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.target</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.target</refname>
+                <refpurpose>systemd target configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.target</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.target</filename> encodes information about
+                a target unit of systemd, which is used for grouping
+                units and as well-known synchronization points during
+                start-up.</para>
+
+                <para>This unit type has no specific options. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. A
+                seperate [Target] section does not exist, since no
+                target-specific options may be configured.</para>
+
+                <para>Target units do not offer any additional
+                functionality on top of the generic functionality
+                provided by units. They exist merely to group units via dependencies
+                (useful as boot targets), and to establish
+                standardized names for synchronization points used in
+                dependencies between units. Among other things target
+                units are a more flexible replacement for SysV
+                runlevels in the classic SysV init system. (And in
+                fact for compatibility reasons there exist special
+                target units such as
+                <filename>runlevel3.target</filename> that are used by
+                the SysV runlevel compatibility code in systemd. See
+                <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                for details).</para>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>


More information about the systemd-commits mailing list