[systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Christian Hesse
Hello everybody,

for me this test fails and I think it is correct to skip it in case
permission is denied. Patch attached.
-- 
main(a){char*c=/*Schoene Gruesse */B?IJj;MEH
CX:;,b;for(a/*Chris   get my mail address:*/=0;b=c[a++];)
putchar(b-1/(/*   gcc -o sig sig.c  ./sig*/b/42*2-3)*42);}
From 50ff13f7cf44f9e7e93c82f67ac777456b7e8364 Mon Sep 17 00:00:00 2001
From: Christian Hesse m...@eworm.de
Date: Tue, 30 Jul 2013 11:35:25 +0200
Subject: [PATCH 1/1] tests: skip test for test-unit-file when executed without
 privileges

---
 src/test/test-unit-file.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index a7fe77a..e7924b5 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -36,7 +36,7 @@
 #include strv.h
 #include fileio.h
 
-static void test_unit_file_get_set(void) {
+static int test_unit_file_get_set(void) {
 int r;
 Hashmap *h;
 Iterator i;
@@ -46,6 +46,10 @@ static void test_unit_file_get_set(void) {
 assert(h);
 
 r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h);
+	if (r == -EPERM || r == -EACCES) {
+		puts(unit_file_get_list: Permission denied. Skipping test.);
+		return EXIT_TEST_SKIP;
+	}
 log_info(unit_file_get_list: %s, strerror(-r));
 assert(r = 0);
 
@@ -53,6 +57,8 @@ static void test_unit_file_get_set(void) {
 printf(%s = %s\n, p-path, unit_file_state_to_string(p-state));
 
 unit_file_list_free(h);
+
+	return 0;
 }
 
 static void check_execcommand(ExecCommand *c,
@@ -351,11 +357,13 @@ static void test_install_printf(void) {
 #pragma GCC diagnostic pop
 
 int main(int argc, char *argv[]) {
+	int r;
 
 log_parse_environment();
 log_open();
 
-test_unit_file_get_set();
+if ((r = test_unit_file_get_set()) != 0)
+		return r;
 test_config_parse_exec();
 test_load_env_file_1();
 test_load_env_file_2();
-- 
1.8.3.4



signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 30, 2013 at 11:50:54AM +0200, Christian Hesse wrote:
 Hello everybody,
 
 for me this test fails and I think it is correct to skip it in case
 permission is denied. Patch attached.
It *is* an error in the installation or environment if
unit files cannot be read. In almost all circumstances,
reducing permissions on unit files doesn't introduce any
extra security because later on they are all accessible
from PID 1 over dbus. I agree that failing an assertion
is not nice from the view of the user, what about 
exit(EXIT_FAILURE)?

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread WANG Chao
If specified kernel command line rd.weak_sysroot, fstab-generate will
generate a weaker version of sysroot.mount:
 - It's not required by initrd-root-fs.target.
 - It's not before initrd-root-fs.target.

So that failure in the weaker sysroot.mount will not fail
initrd-root-fs.target. And systemd will try continue rather than
entering isolated emergency mode.

Signed-off-by: WANG Chao chaow...@redhat.com
---
 man/kernel-command-line.xml   | 10 ++
 man/systemd-fstab-generator.xml   | 10 ++
 src/fstab-generator/fstab-generator.c |  5 -
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index a4b7d13..0c2e97d 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -274,6 +274,16 @@
 /varlistentry
 
 varlistentry
+termvarnamerd.weak_sysroot/varname/term
+
+listitem
+paraConfigures the sysroot.mount
+logic in initrd. For details, see
+
citerefentryrefentrytitlesystemd-fstab-generator/refentrytitlemanvolnum8/manvolnum/citerefentry./para
+/listitem
+/varlistentry
+
+varlistentry
 termvarnamemodules-load=/varname/term
 
termvarnamerd.modules-load=/varname/term
 
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
index 4bd25bf..de0ed2f 100644
--- a/man/systemd-fstab-generator.xml
+++ b/man/systemd-fstab-generator.xml
@@ -101,6 +101,16 @@
 the initrd.  /para/listitem
 /varlistentry
 
+varlistentry
+termvarnamerd.weak_sysroot/varname/term
+
+listitemparaIf specified, systemd will
+ingore failures in sysroot.mount and try to
+continue rather than enter emergency mode.
+It is honored only by initial RAM disk
+(initrd). /para/listitem
+/varlistentry
+
 /variablelist
 /refsect1
 
diff --git a/src/fstab-generator/fstab-generator.c 
b/src/fstab-generator/fstab-generator.c
index c17299f..449e725 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -492,6 +492,7 @@ static int parse_new_root_from_proc_cmdline(void) {
 char *w, *state;
 int r;
 size_t l;
+bool weak = false;
 
 r = read_one_line_file(/proc/cmdline, line);
 if (r  0) {
@@ -544,6 +545,8 @@ static int parse_new_root_from_proc_cmdline(void) {
 
 free(opts);
 opts = o;
+} else if (streq(word, rd.weak_sysroot)) {
+weak=true;
 }
 }
 
@@ -558,7 +561,7 @@ static int parse_new_root_from_proc_cmdline(void) {
 }
 
 log_debug(Found entry what=%s where=/sysroot type=%s, what, type);
-r = add_mount(what, /sysroot, type, opts, 0, false, false, false,
+r = add_mount(what, /sysroot, type, opts, 0, false, weak, false,
   false, NULL, NULL, NULL, SPECIAL_INITRD_ROOT_FS_TARGET, 
/proc/cmdline);
 
 return (r  0) ? r : 0;
-- 
1.8.3.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Tom Gundersen
On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
 If specified kernel command line rd.weak_sysroot, fstab-generate will
 generate a weaker version of sysroot.mount:
  - It's not required by initrd-root-fs.target.
  - It's not before initrd-root-fs.target.

 So that failure in the weaker sysroot.mount will not fail
 initrd-root-fs.target. And systemd will try continue rather than
 entering isolated emergency mode.

Can you give an example case where this is useful? I.e., what is the
setup and how is boot supposed to succeed with a failing sysroot?

-t
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Kay Sievers
On Tue, Jul 30, 2013 at 1:52 PM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:
 On Tue, Jul 30, 2013 at 11:50:54AM +0200, Christian Hesse wrote:
 Hello everybody,

 for me this test fails and I think it is correct to skip it in case
 permission is denied. Patch attached.
 It *is* an error in the installation or environment if
 unit files cannot be read. In almost all circumstances,
 reducing permissions on unit files doesn't introduce any
 extra security because later on they are all accessible
 from PID 1 over dbus. I agree that failing an assertion
 is not nice from the view of the user, what about
 exit(EXIT_FAILURE)?

Hmm, we assert() most of the test failures to see where things went wrong.

Would exit() make much of a difference in that case? Is it worth to
distinguish different types of failures in the test?

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Christian Hesse
Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl on Tue, 2013/07/30 13:52:
 On Tue, Jul 30, 2013 at 11:50:54AM +0200, Christian Hesse wrote:
  Hello everybody,
  
  for me this test fails and I think it is correct to skip it in case
  permission is denied. Patch attached.
 It *is* an error in the installation or environment if
 unit files cannot be read.

Stupid me... Please ignore this request. ;)

I had a service file installed to /usr/lib/systemd/system/ with permissions
just set to 0600, thus making the test fail for unprivileged users.
Sorry for the noise.
-- 
main(a){char*c=/*Schoene Gruesse */B?IJj;MEH
CX:;,b;for(a/*Chris   get my mail address:*/=0;b=c[a++];)
putchar(b-1/(/*   gcc -o sig sig.c  ./sig*/b/42*2-3)*42);}


signature.asc
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread WANG Chao
On 07/30/13 at 02:05pm, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
  If specified kernel command line rd.weak_sysroot, fstab-generate will
  generate a weaker version of sysroot.mount:
   - It's not required by initrd-root-fs.target.
   - It's not before initrd-root-fs.target.
 
  So that failure in the weaker sysroot.mount will not fail
  initrd-root-fs.target. And systemd will try continue rather than
  entering isolated emergency mode.
 
 Can you give an example case where this is useful? I.e., what is the
 setup and how is boot supposed to succeed with a failing sysroot?

Some initrd that using systemd, isn't serverd as a general purpose boot
initrd.

In case of kdump, 2nd kernel initrd is used to mount non-root local/remote
filesystem and dump vmcore there. The kdump script is running right
before switch-root and will reboot after saving vmcore.

So mounting sysroot isn't quite justified in this case.  But it's still
acceptable (since it's readonly mount), as long as it's not keeping
systemd from reaching initrd.target (so kdump script can run later).

Thanks
WANG Chao
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 30, 2013 at 02:19:55PM +0200, Christian Hesse wrote:
 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl on Tue, 2013/07/30 13:52:
  On Tue, Jul 30, 2013 at 11:50:54AM +0200, Christian Hesse wrote:
   Hello everybody,
   
   for me this test fails and I think it is correct to skip it in case
   permission is denied. Patch attached.
  It *is* an error in the installation or environment if
  unit files cannot be read.
 
 Stupid me... Please ignore this request. ;)
Well, I disagree :). I pushed a modified version of your patch which
returns failure on permission error, but does not dump core. The coredump
doesn't contain any useful information anyway.

Zbyszek
-- 
they are not broken. they are refucktored
   -- alxchk
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Vivek Goyal
[CC harald]

Not sure if this is right way to do or not but I will give more
background about the issue.

This assumption seems to be built into initramfs and systemd that root
should always be mountable. If one can't mount root, it is a fatal
failure.

But in case of kdump initramfs, this assumption is no more valid. Core
might be being saved to a target which is not root (say over ssh). And
even if mounting root fails, it is ok.

So we kind of need a mode (possibly driven by command line option) where
if mouting root failed, it is ok and continue with mouting other targets
and kdump module will then handle errors.

Thanks
Vivek

On Tue, Jul 30, 2013 at 07:53:11PM +0800, WANG Chao wrote:
 If specified kernel command line rd.weak_sysroot, fstab-generate will
 generate a weaker version of sysroot.mount:
  - It's not required by initrd-root-fs.target.
  - It's not before initrd-root-fs.target.
 
 So that failure in the weaker sysroot.mount will not fail
 initrd-root-fs.target. And systemd will try continue rather than
 entering isolated emergency mode.
 
 Signed-off-by: WANG Chao chaow...@redhat.com
 ---
  man/kernel-command-line.xml   | 10 ++
  man/systemd-fstab-generator.xml   | 10 ++
  src/fstab-generator/fstab-generator.c |  5 -
  3 files changed, 24 insertions(+), 1 deletion(-)
 
 diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
 index a4b7d13..0c2e97d 100644
 --- a/man/kernel-command-line.xml
 +++ b/man/kernel-command-line.xml
 @@ -274,6 +274,16 @@
  /varlistentry
  
  varlistentry
 +
 termvarnamerd.weak_sysroot/varname/term
 +
 +listitem
 +paraConfigures the sysroot.mount
 +logic in initrd. For details, see
 +
 citerefentryrefentrytitlesystemd-fstab-generator/refentrytitlemanvolnum8/manvolnum/citerefentry./para
 +/listitem
 +/varlistentry
 +
 +varlistentry
  termvarnamemodules-load=/varname/term
  
 termvarnamerd.modules-load=/varname/term
  
 diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
 index 4bd25bf..de0ed2f 100644
 --- a/man/systemd-fstab-generator.xml
 +++ b/man/systemd-fstab-generator.xml
 @@ -101,6 +101,16 @@
  the initrd.  /para/listitem
  /varlistentry
  
 +varlistentry
 +
 termvarnamerd.weak_sysroot/varname/term
 +
 +listitemparaIf specified, systemd will
 +ingore failures in sysroot.mount and try to
 +continue rather than enter emergency mode.
 +It is honored only by initial RAM disk
 +(initrd). /para/listitem
 +/varlistentry
 +
  /variablelist
  /refsect1
  
 diff --git a/src/fstab-generator/fstab-generator.c 
 b/src/fstab-generator/fstab-generator.c
 index c17299f..449e725 100644
 --- a/src/fstab-generator/fstab-generator.c
 +++ b/src/fstab-generator/fstab-generator.c
 @@ -492,6 +492,7 @@ static int parse_new_root_from_proc_cmdline(void) {
  char *w, *state;
  int r;
  size_t l;
 +bool weak = false;
  
  r = read_one_line_file(/proc/cmdline, line);
  if (r  0) {
 @@ -544,6 +545,8 @@ static int parse_new_root_from_proc_cmdline(void) {
  
  free(opts);
  opts = o;
 +} else if (streq(word, rd.weak_sysroot)) {
 +weak=true;
  }
  }
  
 @@ -558,7 +561,7 @@ static int parse_new_root_from_proc_cmdline(void) {
  }
  
  log_debug(Found entry what=%s where=/sysroot type=%s, what, type);
 -r = add_mount(what, /sysroot, type, opts, 0, false, false, false,
 +r = add_mount(what, /sysroot, type, opts, 0, false, weak, false,
false, NULL, NULL, NULL, 
 SPECIAL_INITRD_ROOT_FS_TARGET, /proc/cmdline);
  
  return (r  0) ? r : 0;
 -- 
 1.8.3.1
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
 [CC harald]
 
 Not sure if this is right way to do or not but I will give more
 background about the issue.
 
 This assumption seems to be built into initramfs and systemd that root
 should always be mountable. If one can't mount root, it is a fatal
 failure.
 
 But in case of kdump initramfs, this assumption is no more valid. Core
 might be being saved to a target which is not root (say over ssh). And
 even if mounting root fails, it is ok.
 
 So we kind of need a mode (possibly driven by command line option) where
 if mouting root failed, it is ok and continue with mouting other targets
 and kdump module will then handle errors.
Maybe rootfsflags=nofail could do be used as this flag?

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Tom Gundersen
On Tue, Jul 30, 2013 at 2:27 PM, WANG Chao chaow...@redhat.com wrote:
 On 07/30/13 at 02:05pm, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
   - It's not before initrd-root-fs.target.
 In case of kdump, 2nd kernel initrd is used to mount non-root local/remote
 filesystem and dump vmcore there. The kdump script is running right
 before switch-root and will reboot after saving vmcore.

 So mounting sysroot isn't quite justified in this case.  But it's still
 acceptable (since it's readonly mount), as long as it's not keeping
 systemd from reaching initrd.target (so kdump script can run later).

If you don't have the Before=initrd-root-fs.target it means that
you'll have a race: sometimes the rootfs will be mounted  before kdump
does whatever it does, and sometimes it won't. Would an option be to
not specify a root= at all in your case?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Harald Hoyer
On 07/30/2013 03:46 PM, Zbigniew Jędrzejewski-Szmek wrote:
 On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
 [CC harald]

 Not sure if this is right way to do or not but I will give more
 background about the issue.

 This assumption seems to be built into initramfs and systemd that root
 should always be mountable. If one can't mount root, it is a fatal
 failure.

 But in case of kdump initramfs, this assumption is no more valid. Core
 might be being saved to a target which is not root (say over ssh). And
 even if mounting root fails, it is ok.

 So we kind of need a mode (possibly driven by command line option) where
 if mouting root failed, it is ok and continue with mouting other targets
 and kdump module will then handle errors.
 Maybe rootfsflags=nofail could do be used as this flag?
 
 Zbyszek
 

rootfsflags=nofail sounds ok, if it is not used for booting the initial system.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Kay Sievers
On Tue, Jul 30, 2013 at 4:02 PM, Tom Gundersen t...@jklm.no wrote:
 On Tue, Jul 30, 2013 at 2:27 PM, WANG Chao chaow...@redhat.com wrote:
 On 07/30/13 at 02:05pm, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
   - It's not before initrd-root-fs.target.
 In case of kdump, 2nd kernel initrd is used to mount non-root local/remote
 filesystem and dump vmcore there. The kdump script is running right
 before switch-root and will reboot after saving vmcore.

 So mounting sysroot isn't quite justified in this case.  But it's still
 acceptable (since it's readonly mount), as long as it's not keeping
 systemd from reaching initrd.target (so kdump script can run later).

 If you don't have the Before=initrd-root-fs.target it means that
 you'll have a race: sometimes the rootfs will be mounted  before kdump
 does whatever it does, and sometimes it won't. Would an option be to
 not specify a root= at all in your case?

Nothing should make assumptions about root= not specified at the
kernel command line. It is reserved to make auto-discovery by
partition type UUID work.

It needs an explicit value to trigger non-common, non-default behavior;
otherwise things would likely break in the future.

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Vivek Goyal
On Tue, Jul 30, 2013 at 02:05:08PM +0200, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
  If specified kernel command line rd.weak_sysroot, fstab-generate will
  generate a weaker version of sysroot.mount:
   - It's not required by initrd-root-fs.target.
   - It's not before initrd-root-fs.target.
 
  So that failure in the weaker sysroot.mount will not fail
  initrd-root-fs.target. And systemd will try continue rather than
  entering isolated emergency mode.
 
 Can you give an example case where this is useful? I.e., what is the
 setup and how is boot supposed to succeed with a failing sysroot?

Hi,

Can you please not drop people listed in CC in original thread from
conversation.

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Vivek Goyal
On Tue, Jul 30, 2013 at 04:02:17PM +0200, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 2:27 PM, WANG Chao chaow...@redhat.com wrote:
  On 07/30/13 at 02:05pm, Tom Gundersen wrote:
  On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
- It's not before initrd-root-fs.target.
  In case of kdump, 2nd kernel initrd is used to mount non-root local/remote
  filesystem and dump vmcore there. The kdump script is running right
  before switch-root and will reboot after saving vmcore.
 
  So mounting sysroot isn't quite justified in this case.  But it's still
  acceptable (since it's readonly mount), as long as it's not keeping
  systemd from reaching initrd.target (so kdump script can run later).
 
 If you don't have the Before=initrd-root-fs.target it means that
 you'll have a race: sometimes the rootfs will be mounted  before kdump
 does whatever it does, and sometimes it won't. Would an option be to
 not specify a root= at all in your case?

Not specifying root= is not an option as it serves as backup dump target
for us. So our primary target might be send dump over network but for
some reason it fails, based on user config option, we will dump core
to root in /var/crash.

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Tom Gundersen
On Tue, Jul 30, 2013 at 4:13 PM, Harald Hoyer har...@redhat.com wrote:
 On 07/30/2013 03:46 PM, Zbigniew Jędrzejewski-Szmek wrote:
 Maybe rootfsflags=nofail could do be used as this flag?

 rootfsflags=nofail sounds ok, if it is not used for booting the initial 
 system.

Yeah, you are right, this looks like it should just work.

Though the behavior of initrd-parse-etc.service and
initrd-switch-root.service will be non-deterministic if this flag is
specified (unless I'm missing something). Maybe they should be
explicitly ordered After/Wants=sysroot.mount ? That may cause a long
timeout, but at least there will be no emergency mode.

-t
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread WANG Chao
On 07/30/13 at 09:51am, Vivek Goyal wrote:
 On Tue, Jul 30, 2013 at 07:53:11PM +0800, WANG Chao wrote:
  If specified kernel command line rd.weak_sysroot, fstab-generate will
  generate a weaker version of sysroot.mount:
   - It's not required by initrd-root-fs.target.
   - It's not before initrd-root-fs.target.
  
  So that failure in the weaker sysroot.mount will not fail
  initrd-root-fs.target. And systemd will try continue rather than
  entering isolated emergency mode.
  
  Signed-off-by: WANG Chao chaow...@redhat.com
 
 Chao, so why rd.action_on_fail=continue is not sufficient here? So if
 mounting root fails, and if rd.action_on_fail=continue, then systemd
 should just continue.

rd.action_on_fail is a check condition switch for
dracut-emergency.service. It only controls whether the emergency service
can be started or not.

If sysroot.mount fails, initrd-root-fs.target won't be reached. Our
kdump script running under dracut-pre-pivot.service, which has a
dependency list:

dracut-pre-pivot.service
 - initrd.target
  - initrd-root-fs.target
   - sysroot.mount

If rd.action_on_fail=continue isn't set, a failing sysroot.mount will
trigger emergency service and emergency service is started. Kdump fails.

If rd.action_on_fail=continue is set, a failing sysroot.mount will also
trigger emergency service, but emergency service wouldn't be started.
Because that service is switched off and can't be started. Then systemd
will hang (we haven't reached initrd-root-fs.target yet) because the
left services will only run after initrd-root-fs.target.

 
 Or it will be considered an initramfs parameter and we need to come
 up with a new one for systemd?

dracut can't do it. systemd is hard-coded to mount root (sysroot.mount).

 
 Or may be if rd.action_on_fail is set, it automtically does some
 action which conveys to systemd to continue after failures.

rd.action_on_fail is just simply mask emergency.service. It can't let
systemd continue against failures.

Thanks,
WANG Chao

 
 Thanks
 Vivek
 
  ---
   man/kernel-command-line.xml   | 10 ++
   man/systemd-fstab-generator.xml   | 10 ++
   src/fstab-generator/fstab-generator.c |  5 -
   3 files changed, 24 insertions(+), 1 deletion(-)
  
  diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
  index a4b7d13..0c2e97d 100644
  --- a/man/kernel-command-line.xml
  +++ b/man/kernel-command-line.xml
  @@ -274,6 +274,16 @@
   /varlistentry
   
   varlistentry
  +
  termvarnamerd.weak_sysroot/varname/term
  +
  +listitem
  +paraConfigures the sysroot.mount
  +logic in initrd. For details, see
  +
  citerefentryrefentrytitlesystemd-fstab-generator/refentrytitlemanvolnum8/manvolnum/citerefentry./para
  +/listitem
  +/varlistentry
  +
  +varlistentry
   
  termvarnamemodules-load=/varname/term
   
  termvarnamerd.modules-load=/varname/term
   
  diff --git a/man/systemd-fstab-generator.xml 
  b/man/systemd-fstab-generator.xml
  index 4bd25bf..de0ed2f 100644
  --- a/man/systemd-fstab-generator.xml
  +++ b/man/systemd-fstab-generator.xml
  @@ -101,6 +101,16 @@
   the initrd.  /para/listitem
   /varlistentry
   
  +varlistentry
  +
  termvarnamerd.weak_sysroot/varname/term
  +
  +listitemparaIf specified, systemd will
  +ingore failures in sysroot.mount and try to
  +continue rather than enter emergency mode.
  +It is honored only by initial RAM disk
  +(initrd). /para/listitem
  +/varlistentry
  +
   /variablelist
   /refsect1
   
  diff --git a/src/fstab-generator/fstab-generator.c 
  b/src/fstab-generator/fstab-generator.c
  index c17299f..449e725 100644
  --- a/src/fstab-generator/fstab-generator.c
  +++ b/src/fstab-generator/fstab-generator.c
  @@ -492,6 +492,7 @@ static int parse_new_root_from_proc_cmdline(void) {
   char *w, *state;
   int r;
   size_t l;
  +bool weak = false;
   
   r = read_one_line_file(/proc/cmdline, line);
   if (r  0) {
  @@ -544,6 +545,8 @@ static int parse_new_root_from_proc_cmdline(void) {
   
   free(opts);
   opts = o;
  +} else if (streq(word, rd.weak_sysroot)) {
  +weak=true;
   }
   }
   
  @@ -558,7 +561,7 @@ static int 

Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread WANG Chao
On 07/30/13 at 04:02pm, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 2:27 PM, WANG Chao chaow...@redhat.com wrote:
  On 07/30/13 at 02:05pm, Tom Gundersen wrote:
  On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
- It's not before initrd-root-fs.target.
  In case of kdump, 2nd kernel initrd is used to mount non-root local/remote
  filesystem and dump vmcore there. The kdump script is running right
  before switch-root and will reboot after saving vmcore.
 
  So mounting sysroot isn't quite justified in this case.  But it's still
  acceptable (since it's readonly mount), as long as it's not keeping
  systemd from reaching initrd.target (so kdump script can run later).
 
 If you don't have the Before=initrd-root-fs.target it means that
 you'll have a race: sometimes the rootfs will be mounted  before kdump
 does whatever it does, and sometimes it won't. Would an option be to
 not specify a root= at all in your case?

We share the same concern. A simple way is the script check if root is
mounted and determine the next step.

But strip root= doesn't sound good to me :(
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread WANG Chao
On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
 On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
  [CC harald]
  
  Not sure if this is right way to do or not but I will give more
  background about the issue.
  
  This assumption seems to be built into initramfs and systemd that root
  should always be mountable. If one can't mount root, it is a fatal
  failure.
  
  But in case of kdump initramfs, this assumption is no more valid. Core
  might be being saved to a target which is not root (say over ssh). And
  even if mounting root fails, it is ok.
  
  So we kind of need a mode (possibly driven by command line option) where
  if mouting root failed, it is ok and continue with mouting other targets
  and kdump module will then handle errors.
 Maybe rootfsflags=nofail could do be used as this flag?

rootflags=nofail works. Thanks.

Although it results in a little difference between my approach, I prefer
use this one than adding another cmdline param.

Thanks again.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] tests: skip test for test-unit-file when executed without privileges

2013-07-30 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 30, 2013 at 02:17:30PM +0200, Kay Sievers wrote:
 On Tue, Jul 30, 2013 at 1:52 PM, Zbigniew Jędrzejewski-Szmek
 zbys...@in.waw.pl wrote:
  On Tue, Jul 30, 2013 at 11:50:54AM +0200, Christian Hesse wrote:
  Hello everybody,
 
  for me this test fails and I think it is correct to skip it in case
  permission is denied. Patch attached.
  It *is* an error in the installation or environment if
  unit files cannot be read. In almost all circumstances,
  reducing permissions on unit files doesn't introduce any
  extra security because later on they are all accessible
  from PID 1 over dbus. I agree that failing an assertion
  is not nice from the view of the user, what about
  exit(EXIT_FAILURE)?
 
 Hmm, we assert() most of the test failures to see where things went wrong.
 
 Would exit() make much of a difference in that case? Is it worth to
 distinguish different types of failures in the test?
assert dumps core, which means that it get processed by abrt
or journald or dumped to disk, and looks like a big error, but
the core is totally useless for determining the cause, since
once the error has been detected, all interesting state is gone.

I think we should maybe add an assert_exit(), which does exit(EXIT_FAILURE),
and use that instead of normal assert in many places.

Zbyszek
-- 
they are not broken. they are refucktored
   -- alxchk
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
 On 07/31/13 at 12:32am, WANG Chao wrote:
  On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
   On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
[CC harald]

Not sure if this is right way to do or not but I will give more
background about the issue.

This assumption seems to be built into initramfs and systemd that root
should always be mountable. If one can't mount root, it is a fatal
failure.

But in case of kdump initramfs, this assumption is no more valid. Core
might be being saved to a target which is not root (say over ssh). And
even if mounting root fails, it is ok.

So we kind of need a mode (possibly driven by command line option) where
if mouting root failed, it is ok and continue with mouting other targets
and kdump module will then handle errors.
   Maybe rootfsflags=nofail could do be used as this flag?
  
  rootflags=nofail works. Thanks.
  
  Although it results in a little difference between my approach, I prefer
  use this one than adding another cmdline param.
 
 I just find nofail option only works when mnt device doesn't exists.
I think we treat nofail slightly differently, and don't make the
.mount unit a requirement for local-fs.target or initrd-fs.target.

Zbyszek

 What if the filesytem is corrupted? sysroot.mount will and
 initrd-root-fs.target will never reach.
-- 
they are not broken. they are refucktored
   -- alxchk
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Colin Guthrie
'Twas brillig, and Vivek Goyal at 30/07/13 15:26 did gyre and gimble:
 On Tue, Jul 30, 2013 at 02:05:08PM +0200, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
 If specified kernel command line rd.weak_sysroot, fstab-generate will
 generate a weaker version of sysroot.mount:
  - It's not required by initrd-root-fs.target.
  - It's not before initrd-root-fs.target.

 So that failure in the weaker sysroot.mount will not fail
 initrd-root-fs.target. And systemd will try continue rather than
 entering isolated emergency mode.

 Can you give an example case where this is useful? I.e., what is the
 setup and how is boot supposed to succeed with a failing sysroot?
 
 Hi,
 
 Can you please not drop people listed in CC in original thread from
 conversation.

FYI, I don't see any CC's on the original mail as displayed on GMane via
NNTP...

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Vivek Goyal
On Tue, Jul 30, 2013 at 07:34:01PM +0100, Colin Guthrie wrote:
 'Twas brillig, and Vivek Goyal at 30/07/13 15:26 did gyre and gimble:
  On Tue, Jul 30, 2013 at 02:05:08PM +0200, Tom Gundersen wrote:
  On Tue, Jul 30, 2013 at 1:53 PM, WANG Chao chaow...@redhat.com wrote:
  If specified kernel command line rd.weak_sysroot, fstab-generate will
  generate a weaker version of sysroot.mount:
   - It's not required by initrd-root-fs.target.
   - It's not before initrd-root-fs.target.
 
  So that failure in the weaker sysroot.mount will not fail
  initrd-root-fs.target. And systemd will try continue rather than
  entering isolated emergency mode.
 
  Can you give an example case where this is useful? I.e., what is the
  setup and how is boot supposed to succeed with a failing sysroot?
  
  Hi,
  
  Can you please not drop people listed in CC in original thread from
  conversation.
 
 FYI, I don't see any CC's on the original mail as displayed on GMane via
 NNTP...

I am CCed in original mail and that's why I got a copy of it in my Inbox.
I am not sure how did Tom receive that mail. If my email id somehow
automatically got stripped, I have no idea how that can happen.

I am trying to look into systemd-devel archives but there does not seem
to be any info who is CCed on the mail.

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Tom Gundersen
On Tue, Jul 30, 2013 at 8:41 PM, Vivek Goyal vgo...@redhat.com wrote:
 On Tue, Jul 30, 2013 at 07:34:01PM +0100, Colin Guthrie wrote:
 'Twas brillig, and Vivek Goyal at 30/07/13 15:26 did gyre and gimble:
 FYI, I don't see any CC's on the original mail as displayed on GMane via
 NNTP...

 I am CCed in original mail and that's why I got a copy of it in my Inbox.
 I am not sure how did Tom receive that mail. If my email id somehow
 automatically got stripped, I have no idea how that can happen.

 I am trying to look into systemd-devel archives but there does not seem
 to be any info who is CCed on the mail.

I don't know how that happened (I always use Reply to All). I
received the email via systemd-devel (using GMail) and I see no cc's
in the original mail. I see cc's in the follow-up emails just fine
though...

Cheers,

Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-30 Thread Vivek Goyal
On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
 On 07/31/13 at 12:32am, WANG Chao wrote:
  On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
   On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
[CC harald]

Not sure if this is right way to do or not but I will give more
background about the issue.

This assumption seems to be built into initramfs and systemd that root
should always be mountable. If one can't mount root, it is a fatal
failure.

But in case of kdump initramfs, this assumption is no more valid. Core
might be being saved to a target which is not root (say over ssh). And
even if mounting root fails, it is ok.

So we kind of need a mode (possibly driven by command line option) where
if mouting root failed, it is ok and continue with mouting other targets
and kdump module will then handle errors.
   Maybe rootfsflags=nofail could do be used as this flag?
  
  rootflags=nofail works. Thanks.
  
  Although it results in a little difference between my approach, I prefer
  use this one than adding another cmdline param.
 
 I just find nofail option only works when mnt device doesn't exists.
 
 What if the filesytem is corrupted? sysroot.mount will and
 initrd-root-fs.target will never reach.

Right.

In kdump environment, for most of the users default of dropping into a
shell does not make sense. If some server crashes some where and we are
not able to take dump due to some failure, most of the users will like that
system reboots automatically and services are back up online.

I see that right now rd.action_on_fail is parsed by emergency.service and
service does not start if this parameter is specified.

Can't we interpret this parameter little differently. That is this
parameter modifies the OnFailure= behavior.

So by default OnFailure= is emergency.service which is equivalent to
a shell.

A user can force change of behavior by specifying command line.

rd.action_on_failure=shell (OnFailure=emergency.service)
rd.action_on_failure=reboot (OnFailure=reboot)
rd.action_on_failure=continue (OnFailure=continue)

Now action_on_failure=continue will effectively pretend that unit start
was successful and go ahead with starting next unit. This might be little
contentious though as other dependent units will fail in unknown ways.

Now by default kdump can use rd.acton_on_failure=continue and try to
save dump. If it can't due to previous failures, then it will anyway
reboot the system.

Also if emergency.service stops parsing rd.action_on_failure, then kdump
module will be able to start emergency.service too when it sees there
is a problem. Right now when kdump module tries to start emergency.service
it fails because it looks at acton_on_fail parameter (Another issue Bao is
trying to solve).

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Create a new logind session from a systemd --user unit

2013-07-30 Thread Simon McVittie
On 30/07/13 00:02, Lennart Poettering wrote:
 Also, D-Bus needs to look for the bus socket in $XDG_RUNTIME_DIR too.

If you want this to happen (you in general, but especially Lennart who
is a D-Bus reviewer), please review, test and/or adopt
https://bugs.freedesktop.org/show_bug.cgi?id=61303. I am unlikely to
have time to write further code for that bug any time soon, but if you
suggested additional patches I'd review them.

S

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] .automount from user?

2013-07-30 Thread David Strauss
On Mon, Jul 29, 2013 at 10:02 PM,  rekt...@voodoowarez.com wrote:
 Hello.  I'm curious, and perhaps maybe lazy: is there any way to do automount 
 units from a user
 systemd instance?

I don't think this is possible given the security model around
automount. Specifically, the automount needs to associate with a mount
unit to invoke the mount command as root.

It would seem possible to use it with a new UID namespace, but such
capability is very new and disabled in kernels like Fedora's. You
could also just treat FUSE mounts as normal services in the user
account.

-- 
David Strauss
   | da...@davidstrauss.net
   | +1 512 577 5827 [mobile]
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Using busybox-udhcpc

2013-07-30 Thread Paul D. DeRocco
I have a Yocto-based embedded system (poky-dylan on a Cedartrail Atom),
which has been modified to use systemd. I've also added Samba 3.6.8 from
OpenEmbedded. The system has available busybox-udhcpc for a DHCP client, but
nothing is starting it. If I start it manually, then Samba works fine.

I suppose I could create a simple systemd unit that starts udhcpc with the
ethernet port's name, but I'd also like to support an external WiFi dongle.
I've googled and googled, but I can't find out the right way to start
udhcpc, so that it is invoked whenever some new device is detected. Can
anyone point me to an example, or some document on the web that explains how
this is normally done?

I also have a Gumstix system with a Yocto-based distro, and it somehow
starts up its DHCP client, but I can't figure out how. It uses dhclient,
instead of busybox-udhcpc, but if I knew how dhclient is invoked by the
networking system, perhaps that would apply to busybox-udhcpc as well.

Any pointers would be greatly appreciated. It's the last thing I need to fix
(famous last words) before I have fully functioning networking.

-- 

Ciao,   Paul D. DeRocco
Paulmailto:pdero...@ix.netcom.com 
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Using busybox-udhcpc

2013-07-30 Thread Kay Sievers
On Wed, Jul 31, 2013 at 1:16 AM, Paul D. DeRocco pdero...@ix.netcom.com wrote:
 I have a Yocto-based embedded system (poky-dylan on a Cedartrail Atom),
 which has been modified to use systemd. I've also added Samba 3.6.8 from
 OpenEmbedded. The system has available busybox-udhcpc for a DHCP client, but
 nothing is starting it. If I start it manually, then Samba works fine.

 I suppose I could create a simple systemd unit that starts udhcpc with the
 ethernet port's name, but I'd also like to support an external WiFi dongle.
 I've googled and googled, but I can't find out the right way to start
 udhcpc, so that it is invoked whenever some new device is detected. Can
 anyone point me to an example, or some document on the web that explains how
 this is normally done?

 I also have a Gumstix system with a Yocto-based distro, and it somehow
 starts up its DHCP client, but I can't figure out how. It uses dhclient,
 instead of busybox-udhcpc, but if I knew how dhclient is invoked by the
 networking system, perhaps that would apply to busybox-udhcpc as well.

 Any pointers would be greatly appreciated. It's the last thing I need to fix
 (famous last words) before I have fully functioning networking.

Systemd itself has no clue about networking. We might get there some
day, but not any time soon.

People use networkmanager, connman, old sysvinit-like distro cruft,
custom unit files triggered by udev rules, or just run scripts to do
the job.

From an operating system point of view, general purpose basic network
setup is one of the weakest and badly integrated parts of the entire
stack. There is nothing simple and generally useful available. It's
just a mess, sorry ... :)

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [GIT PULL v3] Split out zsh completion into multiple files

2013-07-30 Thread William Giokas
On Mon, Jul 29, 2013 at 05:10:34PM -0500, William Giokas wrote:
 On Tue, Jul 30, 2013 at 12:05:00AM +0200, Michael Biebl wrote:
  One of the main reasons why the bash completion was split into
  separate files named after the individual binary, is that
  bash-completion will load the completions on demand this way.
  
  What's the benefit of splitting the zsh completion?
 
 The bash completion was also split so that not all of the completions
 were installed if they weren't needed. If you configure systemd without
 xyz binary, the _xyz completion will not install, for the most part.

Completing even more of the split for all of the ./configure-able parts
of systemd, _systemd-tmpfiles is now only installed if the binary
systemd-tmpfiles is as well.

You can review the changes in cgit here:

  http://git.kaictl.net/wgiokas/systemd.git/?h=zshcomp3



The following changes since commit b5b7ea750388919eee6087eb63f08903b57447cf:

  bash-completion: simplify udevadm completion (2013-07-30 13:04:46 -0400)

are available in the git repository at:

  git://git.kaictl.net/pub/wgiokas/systemd.git zshcomp3

for you to fetch changes up to 2024edb417201f7b3b2adcfd12de5e4680dd2e09:

  shell-comp: Split out zsh _systemd-tmpfiles (2013-07-30 19:12:35 -0500)


William Giokas (16):
  shell-completion: fix zsh completion installation
  shell-comp: Split out zsh _systemctl
  shell-comp: Split out zsh _loginctl
  shell-comp: Split out zsh _hostnamectl
  shell-comp: Split out zsh _journalctl
  shell-comp: Split out zsh _localectl
  shell-comp: Split out zsh _coredumpctl
  shell-comp: Split out zsh _timedatectl
  shell-comp: Split out zsh _udevadm
  shell-comp: Split out zsh _systemd-nspawn
  shell-comp: Split out zsh _systemd-inhibit
  shell-comp: Split out zsh _systemd-analyze
  shell-comp: Split out zsh _machinectl
  shell-comp: Remove unused functions
  shell-comp: Fix journalctl's --boot
  shell-comp: Split out zsh _systemd-tmpfiles

 Makefile.am |   35 +-
 configure.ac|6 +
 shell-completion/systemd-zsh-completion.zsh | 1102 ---
 shell-completion/zsh/_hostnamectl   |   38 +
 shell-completion/zsh/_journalctl|   92 +++
 shell-completion/zsh/_localectl |   89 +++
 shell-completion/zsh/_loginctl  |  112 +++
 shell-completion/zsh/_machinectl|   47 ++
 shell-completion/zsh/_systemctl |  340 +
 shell-completion/zsh/_systemd   |   97 +++
 shell-completion/zsh/_systemd-analyze   |   26 +
 shell-completion/zsh/_systemd-coredumpctl   |   34 +
 shell-completion/zsh/_systemd-inhibit   |   27 +
 shell-completion/zsh/_systemd-nspawn|   24 +
 shell-completion/zsh/_systemd-tmpfiles  |   10 +
 shell-completion/zsh/_timedatectl   |   71 ++
 shell-completion/zsh/_udevadm   |  141 
 17 files changed, 1186 insertions(+), 1105 deletions(-)
 delete mode 100644 shell-completion/systemd-zsh-completion.zsh
 create mode 100644 shell-completion/zsh/_hostnamectl
 create mode 100644 shell-completion/zsh/_journalctl
 create mode 100644 shell-completion/zsh/_localectl
 create mode 100644 shell-completion/zsh/_loginctl
 create mode 100644 shell-completion/zsh/_machinectl
 create mode 100644 shell-completion/zsh/_systemctl
 create mode 100644 shell-completion/zsh/_systemd
 create mode 100644 shell-completion/zsh/_systemd-analyze
 create mode 100644 shell-completion/zsh/_systemd-coredumpctl
 create mode 100644 shell-completion/zsh/_systemd-inhibit
 create mode 100644 shell-completion/zsh/_systemd-nspawn
 create mode 100644 shell-completion/zsh/_systemd-tmpfiles
 create mode 100644 shell-completion/zsh/_timedatectl
 create mode 100644 shell-completion/zsh/_udevadm

-- 
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF


pgpT9Z5k4mAOT.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 11/16] shell-comp: Split out zsh _systemd-inhibit

2013-07-30 Thread William Giokas
---
 Makefile.am   |  3 ++-
 shell-completion/zsh/_systemd | 30 +-
 shell-completion/zsh/_systemd-inhibit | 27 +++
 3 files changed, 30 insertions(+), 30 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-inhibit

diff --git a/Makefile.am b/Makefile.am
index 24e4fa4..a4443fb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3730,7 +3730,8 @@ dist_bashcompletion_DATA += \
shell-completion/bash/loginctl
 
 dist_zshcompletion_DATA += \
-   shell-completion/zsh/_loginctl
+   shell-completion/zsh/_loginctl \
+   shell-completion/zsh/_systemd-inhibit
 
 systemd_inhibit_SOURCES = \
src/login/inhibit.c
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index bacf179..6908725 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,4 +1,4 @@
-#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-machine-id-setup 
systemd-notify systemd-tmpfiles systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
@@ -70,17 +70,6 @@ _ctls()
 {-v,--vm}'[Only detect whether we are run in a VM]' \
 {-q,--quiet}[Don't output anything, just set return value]
 ;;
-systemd-inhibit)
-_arguments \
-{-h,--help}'[Show this help]' \
-'--version[Show package version]' \
-'--what=[Operations to inhibit]:options:(shutdown sleep idle 
handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)' \
-'--who=[A descriptive string who is inhibiting]' \
-'--why=[A descriptive string why is being inhibited]' \
-'--mode=[One of block or delay]' \
-'--list[List active inhibitors]' \
-'*:commands:_systemd_inhibit_command'
-;;
 systemd-machine-id-setup)
 _arguments \
 {-h,--help}'[Show this help]' \
@@ -136,23 +125,6 @@ _ctls()
 esac
 }
 
-_systemd_inhibit_command(){
-if (( CURRENT == 1 )); then
-compset -q
-_normal
-else
-local n=${words[(b:2:i)[^-]*]}
-if (( n = CURRENT )); then
-compset -n $n
-_alternative \
-'files:file:_files' \
-'commands:command:_normal'  return 0
-fi
-_default
-fi
-
-}
-
 _systemd_analyze_command(){
 local -a _systemd_analyze_cmds
 # Descriptions taken from systemd-analyze --help.
diff --git a/shell-completion/zsh/_systemd-inhibit 
b/shell-completion/zsh/_systemd-inhibit
new file mode 100644
index 000..7953455
--- /dev/null
+++ b/shell-completion/zsh/_systemd-inhibit
@@ -0,0 +1,27 @@
+#compdef systemd-inhibit
+
+_systemd_inhibit_command(){
+if (( CURRENT == 1 )); then
+compset -q
+_normal
+else
+local n=${words[(b:2:i)[^-]*]}
+if (( n = CURRENT )); then
+compset -n $n
+_alternative \
+'files:file:_files' \
+'commands:command:_normal'  return 0
+fi
+_default
+fi
+}
+
+_arguments \
+{-h,--help}'[Show this help]' \
+'--version[Show package version]' \
+'--what=[Operations to inhibit]:options:(shutdown sleep idle 
handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)' \
+'--who=[A descriptive string who is inhibiting]' \
+'--why=[A descriptive string why is being inhibited]' \
+'--mode=[One of block or delay]' \
+'--list[List active inhibitors]' \
+'*:commands:_systemd_inhibit_command'
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 12/16] shell-comp: Split out zsh _systemd-analyze

2013-07-30 Thread William Giokas
---
 Makefile.am   |  1 +
 shell-completion/zsh/_systemd | 28 +---
 shell-completion/zsh/_systemd-analyze | 26 ++
 3 files changed, 28 insertions(+), 27 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-analyze

diff --git a/Makefile.am b/Makefile.am
index a4443fb..4ac09cf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -348,6 +348,7 @@ dist_zshcompletion_DATA = \
shell-completion/zsh/_journalctl \
shell-completion/zsh/_udevadm \
shell-completion/zsh/_systemd-nspawn \
+   shell-completion/zsh/_systemd-analyze \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 6908725..d0e1f3d 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,17 +1,9 @@
-#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-machine-id-setup 
systemd-notify systemd-tmpfiles systemd-tty-ask-password-agent machinectl
+#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify 
systemd-tmpfiles systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-systemd-analyze)
-_arguments \
-{-h,--help}'[Show help text.]' \
-'--user[Shows performance data of user sessions instead of the 
system manager.]' \
-'--order[When generating graph for dot, show only order]' \
-'--require[When generating graph for dot, show only 
requirement]' \
-'*::systemd-analyze commands:_systemd_analyze_command'
-;;
 systemd-ask-password)
 _arguments \
 {-h,--help}'[Show this help]' \
@@ -125,24 +117,6 @@ _ctls()
 esac
 }
 
-_systemd_analyze_command(){
-local -a _systemd_analyze_cmds
-# Descriptions taken from systemd-analyze --help.
-_systemd_analyze_cmds=(
-'time:Print time spent in the kernel before reaching userspace'
-'blame:Print list of running units ordered by time to init'
-'critical-chain:Print a tree of the time critical chain of units'
-'plot:Output SVG graphic showing service initialization'
-'dot:Dump dependency graph (in dot(1) format)'
-)
-
-if (( CURRENT == 1 )); then
-_describe options _systemd_analyze_cmds
-else
-_message no more options
-fi
-}
-
 _hosts_or_user_at_host()
 {
   _alternative \
diff --git a/shell-completion/zsh/_systemd-analyze 
b/shell-completion/zsh/_systemd-analyze
new file mode 100644
index 000..13e96c0
--- /dev/null
+++ b/shell-completion/zsh/_systemd-analyze
@@ -0,0 +1,26 @@
+#compdef systemd-analyze
+
+_systemd_analyze_command(){
+local -a _systemd_analyze_cmds
+# Descriptions taken from systemd-analyze --help.
+_systemd_analyze_cmds=(
+'time:Print time spent in the kernel before reaching userspace'
+'blame:Print list of running units ordered by time to init'
+'critical-chain:Print a tree of the time critical chain of units'
+'plot:Output SVG graphic showing service initialization'
+'dot:Dump dependency graph (in dot(1) format)'
+)
+
+if (( CURRENT == 1 )); then
+_describe options _systemd_analyze_cmds
+else
+_message no more options
+fi
+}
+
+_arguments \
+{-h,--help}'[Show help text.]' \
+'--user[Shows performance data of user sessions instead of the system 
manager.]' \
+'--order[When generating graph for dot, show only order]' \
+'--require[When generating graph for dot, show only requirement]' \
+'*::systemd-analyze commands:_systemd_analyze_command'
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 14/16] shell-comp: Remove unused functions

2013-07-30 Thread William Giokas
---
 shell-completion/zsh/_systemd | 13 -
 1 file changed, 13 deletions(-)

diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 8eced09..1addfa5 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -102,19 +102,6 @@ _ctls()
 esac
 }
 
-_hosts_or_user_at_host()
-{
-  _alternative \
-'users-hosts:: _user_at_host' \
-'hosts:: _hosts'
-}
-
-_outputmodes() {
-local -a _output_opts
-_output_opts=(short short-monotonic verbose export json json-pretty 
json-see cat)
-_describe -t output 'output mode' _output_opts || compadd $@
-}
-
 _ctls $@
 
 #vim: set ft=zsh sw=4 ts=4 et
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 13/16] shell-comp: Split out zsh _machinectl

2013-07-30 Thread William Giokas
---
 Makefile.am  |  3 +++
 shell-completion/zsh/_machinectl | 47 ++
 shell-completion/zsh/_systemd| 49 +---
 3 files changed, 51 insertions(+), 48 deletions(-)
 create mode 100644 shell-completion/zsh/_machinectl

diff --git a/Makefile.am b/Makefile.am
index 4ac09cf..3713d0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3632,6 +3632,9 @@ dist_dbussystemservice_DATA += \
 dist_dbuspolicy_DATA += \
src/machine/org.freedesktop.machine1.conf
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_machinectl
+
 SYSTEM_UNIT_ALIASES += \
systemd-machined.service dbus-org.freedesktop.machine1.service
 
diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl
new file mode 100644
index 000..89196a5
--- /dev/null
+++ b/shell-completion/zsh/_machinectl
@@ -0,0 +1,47 @@
+#compdef machinectl
+
+(( $+functions[_machinectl_command] )) || _machinectl_command()
+{
+  local -a _machinectl_cmds
+  _machinectl_cmds=(
+list:List currently running VMs/containers
+status:Show VM/container status
+show:Show properties of one or more VMs/containers
+terminate:Terminate one or more VMs/containers
+kill:Send signal to process or a VM/container
+  )
+  if (( CURRENT == 1 )); then
+_describe -t commands 'machinectl command' _machinectl_cmds || compadd $@
+  else
+local curcontext=$curcontext
+cmd=${${_machinectl_cmds[(r)$words[1]:*]%%:*}}
+if (( $#cmd )); then
+  case $cmd in
+list) msg=no options ;;
+*)
+  _machines=( ${(foa)$(machinectl list | awk '{print $1}')} )
+  if [[ -n $_machines ]]; then
+_describe 'machines' _machines
+  else
+_message 'no machines'
+  fi
+  esac
+else
+  _message no more options
+fi
+  fi
+}
+
+_arguments \
+  {-h,--help}'[Prints a short help text and exits.]' \
+  '--version[Prints a short version string and exits.]' \
+  {-p,--property=}'[Limit output to specified property.]:property:(Name Id 
Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
+  {-a,--all}'[Show all proerties]' \
+  (-l,--full)'[Do not ellipsize cgroup members]' \
+  '--no-pager[Do not pipe output into a pager]' \
+  '--no-ask-password[Do not ask for system passwords]' \
+  '--kill-who=[Who to send signal to]:killwho:(leader all)' \
+  {-s,--signal=}'[Which signal to send]:signal:_signals' \
+  {-H,--host=}'[Show information for remote 
host]:userathost:_hosts_or_user_at_host' \
+  {-P,--privileged}'[Acquire privileges before execution]' \
+  '*::machinectl command:_machinectl_command'
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index d0e1f3d..8eced09 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,4 +1,4 @@
-#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify 
systemd-tmpfiles systemd-tty-ask-password-agent machinectl
+#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify 
systemd-tmpfiles systemd-tty-ask-password-agent
 
 _ctls()
 {
@@ -98,21 +98,6 @@ _ctls()
 '--plymouth[Ask question with plymouth(8).]' \
 '--console[Ask question on /dev/console.]'
 ;;
-machinectl)
-_arguments \
-{-h,--help}'[Prints a short help text and exits.]' \
-'--version[Prints a short version string and exits.]' \
-{-p,--property=}'[Limit output to specified 
property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader 
Class State RootDirectory)' \
-{-a,--all}'[Show all proerties]' \
-(-l,--full)'[Do not ellipsize cgroup members]' \
-'--no-pager[Do not pipe output into a pager]' \
-'--no-ask-password[Do not ask for system passwords]' \
-'--kill-who=[Who to send signal to]:killwho:(leader all)' \
-{-s,--signal=}'[Which signal to send]:signal:_signals' \
-{-H,--host=}'[Show information for remote 
host]:userathost:_hosts_or_user_at_host' \
-{-P,--privileged}'[Acquire privileges before execution]' \
-'*::machinectl command:_machinectl_command'
-;;
 *) _message 'eh?' ;;
 esac
 }
@@ -130,38 +115,6 @@ _outputmodes() {
 _describe -t output 'output mode' _output_opts || compadd $@
 }
 
-(( $+functions[_machinectl_command] )) || _machinectl_command()
-{
-  local -a _machinectl_cmds
-  _machinectl_cmds=(
-list:List currently running VMs/containers
-status:Show VM/container status
-show:Show properties of one or more VMs/containers
-terminate:Terminate one or more VMs/containers
-kill:Send signal to process or a 

[systemd-devel] [PATCH 15/16] shell-comp: Fix journalctl's --boot

2013-07-30 Thread William Giokas
Actually displays a list of boot ID's and offsets to the user
---
 shell-completion/zsh/_journalctl | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 440e35d..4409fd7 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -39,6 +39,15 @@ _journal_fields() {
 _describe 'possible values' _fields
 }
 
+_journal_boots() {
+  local -a _bootid _previousboots
+  _bootid=( ${(fao)$(_call_program bootid $service -F _BOOT_ID)}  )
+  _previousboots=( -{1..${#_bootid}} )
+  _alternative : \
+offsets:boot offsets:(${_previousboots[1,-2]}) \
+bootid:boot ids:(${_bootid[@]})
+}
+
 _arguments -s \
 {-h,--help}'[Show this help]' \
 '--version[Show package version]' \
@@ -54,7 +63,7 @@ _arguments -s \
 {-x,--catalog}'[Show explanatory texts with each log line]' \
 {-q,--quiet}[Don't show privilege warning] \
 {-m,--merge}'[Show entries from all available journals]' \
-{-b,--boot}'[Show entries from the specified boot only]' \
+{-b,--boot=}'[Show data only from the specified boot or offset]:boot id or 
offset:_journal_boots' \
 {-k,--dmesg}'[Show only kernel messages, Implies -b]' \
 {-u,--unit=}'[Show data only from the specified 
unit]:units:_journal_fields _SYSTEMD_UNIT' \
 '--user-unit[Show data only from the specified user session 
unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 16/16] shell-comp: Split out zsh _systemd-tmpfiles

2013-07-30 Thread William Giokas
You can choose to have systemd-tmpfiles at configuration time, so only
install the completion for this if configured to do so.
---
 Makefile.am|  3 +++
 shell-completion/zsh/_systemd  | 12 +---
 shell-completion/zsh/_systemd-tmpfiles | 10 ++
 3 files changed, 14 insertions(+), 11 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-tmpfiles

diff --git a/Makefile.am b/Makefile.am
index 3713d0d..e35eaeb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1565,6 +1565,9 @@ SYSINIT_TARGET_WANTS += \
systemd-tmpfiles-setup-dev.service \
systemd-tmpfiles-setup.service
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_systemd-tmpfiles
+
 TIMERS_TARGET_WANTS += \
systemd-tmpfiles-clean.timer
 
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 1addfa5..7aab52d 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,4 +1,4 @@
-#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify 
systemd-tmpfiles systemd-tty-ask-password-agent
+#compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify 
systemd-tty-ask-password-agent
 
 _ctls()
 {
@@ -77,16 +77,6 @@ _ctls()
 '--booted[Returns 0 if the system was booted up with systemd]' 
\
 '--readahead=[Controls disk read-ahead 
operations]:arguments:(cancel done noreply)'
 ;;
-systemd-tmpfiles)
-_arguments \
-'--create[Create, set ownership/permissions based on the 
config files.]' \
-'--clean[Clean up all files and directories with an age 
parameter configured.]' \
-'--remove[All files and directories marked with r, R in the 
configuration files are removed.]' \
-'--prefix=[Only apply rules that apply to paths with the 
specified prefix.]' \
-'--exclude-prefix=[Ignore rules that apply to paths with the 
specified prefix.]' \
-'--help[Prints a short help text and exits.]' \
-'*::files:_files'
-;;
 systemd-tty-ask-password-agent)
 _arguments \
 {-h,--help}'[Prints a short help text and exits.]' \
diff --git a/shell-completion/zsh/_systemd-tmpfiles 
b/shell-completion/zsh/_systemd-tmpfiles
new file mode 100644
index 000..4913ded
--- /dev/null
+++ b/shell-completion/zsh/_systemd-tmpfiles
@@ -0,0 +1,10 @@
+#compdef systemd-tmpfiles
+
+_arguments \
+'--create[Create, set ownership/permissions based on the config files.]' \
+'--clean[Clean up all files and directories with an age parameter 
configured.]' \
+'--remove[All files and directories marked with r, R in the configuration 
files are removed.]' \
+'--prefix=[Only apply rules that apply to paths with the specified 
prefix.]' \
+'--exclude-prefix=[Ignore rules that apply to paths with the specified 
prefix.]' \
+'--help[Prints a short help text and exits.]' \
+'*::files:_files'
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 02/16] shell-comp: Split out zsh _systemctl

2013-07-30 Thread William Giokas
---
 Makefile.am |   1 +
 shell-completion/zsh/_systemctl | 340 
 shell-completion/zsh/_systemd   | 327 +-
 3 files changed, 342 insertions(+), 326 deletions(-)
 create mode 100644 shell-completion/zsh/_systemctl

diff --git a/Makefile.am b/Makefile.am
index 27e03ce..bfb70b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -344,6 +344,7 @@ dist_bashcompletion_DATA = \
shell-completion/bash/kernel-install
 
 dist_zshcompletion_DATA = \
+   shell-completion/zsh/_systemctl \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_systemctl b/shell-completion/zsh/_systemctl
new file mode 100644
index 000..70d6f33
--- /dev/null
+++ b/shell-completion/zsh/_systemctl
@@ -0,0 +1,340 @@
+#compdef systemctl
+
+(( $+functions[_systemctl_command] )) || _systemctl_command()
+{
+  local -a _systemctl_cmds
+  _systemctl_cmds=(
+list-units:List units
+start:Start (activate) one or more units
+stop:Stop (deactivate) one or more units
+reload:Reload one or more units
+restart:Start or restart one or more units
+condrestart:Restart one or more units if active
+try-restart:Restart one or more units if active
+reload-or-restart:Reload one or more units if possible, otherwise start 
or restart
+force-reload:Reload one or more units if possible, otherwise restart if 
active
+hibernate:Hibernate the system
+hybrid-sleep:Hibernate and suspend the system
+reload-or-try-restart:Reload one or more units if possible, otherwise 
restart if active
+isolate:Start one unit and stop all others
+kill:Send signal to processes of a unit
+is-active:Check whether units are active
+is-failed:Check whether units are failed
+status:Show runtime status of one or more units
+show:Show properties of one or more units/jobs or the manager
+reset-failed:Reset failed state for all, one, or more units
+load:Load one or more units
+list-unit-files:List installed unit files
+enable:Enable one or more unit files
+disable:Disable one or more unit files
+reenable:Reenable one or more unit files
+preset:Enable/disable one or more unit files based on preset 
configuration
+help:Show documentation for specified units
+list-dependencies:Show unit dependency tree
+mask:Mask one or more units
+unmask:Unmask one or more units
+link:Link one or more units files into the search path
+is-enabled:Check whether unit files are enabled
+list-jobs:List jobs
+cancel:Cancel all, one, or more jobs
+dump:Dump server status
+snapshot:Create a snapshot
+delete:Remove one or more snapshots
+show-environment:Dump environment
+set-environment:Set one or more environment variables
+unset-environment:Unset one or more environment variables
+daemon-reload:Reload systemd manager configuration
+daemon-reexec:Reexecute systemd manager
+default:Enter system default mode
+rescue:Enter system rescue mode
+emergency:Enter system emergency mode
+halt:Shut down and halt the system
+suspend:Suspend the system
+poweroff:Shut down and power-off the system
+reboot:Shut down and reboot the system
+kexec:Shut down and reboot the system with kexec
+exit:Ask for user instance termination
+  )
+
+  if (( CURRENT == 1 )); then
+_describe -t commands 'systemctl command' _systemctl_cmds || compadd $@
+  else
+local curcontext=$curcontext
+
+cmd=${${_systemctl_cmds[(r)$words[1]:*]%%:*}}
+# Deal with any aliases
+case $cmd in
+  condrestart) cmd=try-restart;;
+  force-reload) cmd=reload-or-try-restart;;
+esac
+
+if (( $#cmd )); then
+  curcontext=${curcontext%:*:*}:systemctl-${cmd}:
+
+  local update_policy
+  zstyle -s :completion:${curcontext}: cache-policy update_policy
+  if [[ -z $update_policy ]]; then
+zstyle :completion:${curcontext}: cache-policy 
_systemctl_caching_policy
+  fi
+
+  _call_function ret _systemctl_$cmd || _message 'no more arguments'
+else
+  _message unknown systemctl command: $words[1]
+fi
+return ret
+  fi
+}
+
+__systemctl()
+{
+  local -a _modes
+  _modes=(--user --system)
+  systemctl ${words:*_modes} --full --no-legend --no-pager $@
+}
+
+
+# Fills the unit list
+_systemctl_all_units()
+{
+  if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) 
+! _retrieve_cache SYS_ALL_UNITS;
+  then
+_sys_all_units=( $(__systemctl list-units --all | { while read a b; do 
echo  $a; done; }) )
+_store_cache SYS_ALL_UNITS _sys_all_units
+  fi
+}
+
+# Fills the unit list including all file units
+_systemctl_really_all_units()
+{
+  local -a all_unit_files;
+  local -a really_all_units;
+  if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid 
SYS_REALLY_ALL_UNITS ) 
+! _retrieve_cache SYS_REALLY_ALL_UNITS;
+  then
+

[systemd-devel] [PATCH 03/16] shell-comp: Split out zsh _loginctl

2013-07-30 Thread William Giokas
---
 Makefile.am|   3 ++
 shell-completion/zsh/_loginctl | 112 +
 shell-completion/zsh/_systemd  | 109 +--
 3 files changed, 116 insertions(+), 108 deletions(-)
 create mode 100644 shell-completion/zsh/_loginctl

diff --git a/Makefile.am b/Makefile.am
index bfb70b1..9fa7944 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3714,6 +3714,9 @@ rootbin_PROGRAMS += \
 dist_bashcompletion_DATA += \
shell-completion/bash/loginctl
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_loginctl
+
 systemd_inhibit_SOURCES = \
src/login/inhibit.c
 
diff --git a/shell-completion/zsh/_loginctl b/shell-completion/zsh/_loginctl
new file mode 100644
index 000..d121a25
--- /dev/null
+++ b/shell-completion/zsh/_loginctl
@@ -0,0 +1,112 @@
+#compdef loginctl
+
+_hosts_or_user_at_host() {
+  _alternative \
+'users-hosts:: _user_at_host' \
+'hosts:: _hosts'
+}
+
+_loginctl_all_sessions(){_sys_all_sessions=($(loginctl list-sessions | { while 
read a b; do echo  $a; done; }) )}
+_loginctl_all_users()   {_sys_all_users=(   $(loginctl list-users| { while 
read a b; do echo  $a; done; }) )}
+_loginctl_all_seats()   {_sys_all_seats=(   $(loginctl list-seats| { while 
read a b; do echo  $a; done; }) )}
+
+# Completion functions for SESSIONS
+for fun in session-status show-session activate lock-session unlock-session 
terminate-session kill-session ; do
+  (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
+  {
+_loginctl_all_sessions
+compadd $@ -a - _sys_all_sessions
+  }
+done
+
+# Completion functions for USERS
+for fun in user-status show-user enable-linger disable-linger terminate-user 
kill-user ; do
+  (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
+  {
+_loginctl_all_users
+compadd $@ -a - _sys_all_users
+  }
+done
+
+# Completion functions for SEATS
+(( $+functions[_loginctl_seats] )) || _loginctl_seats()
+{
+  _loginctl_all_seats
+  compadd $@ -a - _sys_all_seats
+}
+for fun in seat-status show-seat terminate-seat ; do
+  (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
+  { _loginctl_seats }
+done
+
+# Completion functions for ATTACH
+(( $+functions[_loginctl_attach] )) || _loginctl_attach()
+{
+  _loginctl_all_seats
+
+  _arguments -w -C -S -s \
+':seat:_loginctl_seats' \
+'*:device:_files'
+}
+
+# no loginctl completion for:
+# [STANDALONE]='list-sessions list-users list-seats flush-devices'
+
+(( $+functions[_loginctl_command] )) || _loginctl_command()
+{
+  local -a _loginctl_cmds
+  _loginctl_cmds=(
+list-sessions:List sessions
+session-status:Show session status
+show-session:Show properties of one or more sessions
+activate:Activate a session
+lock-session:Screen lock one or more sessions
+unlock-session:Screen unlock one or more sessions
+terminate-session:Terminate one or more sessions
+kill-session:Send signal to processes of a session
+list-users:List users
+user-status:Show user status
+show-user:Show properties of one or more users
+enable-linger:Enable linger state of one or more users
+disable-linger:Disable linger state of one or more users
+terminate-user:Terminate all sessions of one or more users
+kill-user:Send signal to processes of a user
+list-seats:List seats
+seat-status:Show seat status
+show-seat:Show properties of one or more seats
+attach:Attach one or more devices to a seat
+flush-devices:Flush all device associations
+terminate-seat:Terminate all sessions on one or more seats
+  )
+
+  if (( CURRENT == 1 )); then
+_describe -t commands 'loginctl command' _loginctl_cmds || compadd $@
+  else
+local curcontext=$curcontext
+
+cmd=${${_loginctl_cmds[(r)$words[1]:*]%%:*}}
+
+if (( $#cmd )); then
+  curcontext=${curcontext%:*:*}:loginctl-${cmd}:
+
+  _call_function ret _loginctl_$cmd || _message 'no more arguments'
+else
+  _message unknown loginctl command: $words[1]
+fi
+return ret
+  fi
+}
+
+
+_arguments -s \
+{-h,--help}'[Show help]' \
+'--version[Show package version]' \
+\*{-p,--property=}'[Show only properties by this name]:unit property' \
+{-a,--all}'[Show all properties, including empty ones]' \
+'--kill-who=[Who to send signal to]:killwho:(main control all)' \
+{-s,--signal=}'[Which signal to send]:signal:_signals' \
+'--no-ask-password[Do not ask for system passwords]' \
+{-H,--host=}'[Show information for remote 
host]:userathost:_hosts_or_user_at_host' \
+{-P,--privileged}'[Acquire privileges before execution]' \
+'--no-pager[Do not pipe output into a pager]' \
+'*::loginctl command:_loginctl_command'
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 64e0994..80a14ac 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,24 +1,9 @@
-#compdef loginctl journalctl hostnamectl localectl 

[systemd-devel] [PATCH 04/16] shell-comp: Split out zsh _hostnamectl

2013-07-30 Thread William Giokas
---
 Makefile.am   |  3 +++
 shell-completion/zsh/_hostnamectl | 38 ++
 shell-completion/zsh/_systemd | 34 +-
 3 files changed, 42 insertions(+), 33 deletions(-)
 create mode 100644 shell-completion/zsh/_hostnamectl

diff --git a/Makefile.am b/Makefile.am
index 9fa7944..ba40350 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3363,6 +3363,9 @@ bin_PROGRAMS += \
 dist_bashcompletion_DATA += \
shell-completion/bash/hostnamectl
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_hostnamectl
+
 endif
 
 polkitpolicy_in_files += \
diff --git a/shell-completion/zsh/_hostnamectl 
b/shell-completion/zsh/_hostnamectl
new file mode 100644
index 000..bc4441d
--- /dev/null
+++ b/shell-completion/zsh/_hostnamectl
@@ -0,0 +1,38 @@
+#compdef hostnamectl
+
+_hosts_or_user_at_host() {
+  _alternative \
+'users-hosts:: _user_at_host' \
+'hosts:: _hosts'
+}
+
+_hostnamectl_command() {
+local -a _hostnamectl_cmds
+_hostnamectl_cmds=(
+status:Show current hostname settings
+set-hostname:Set system hostname
+set-icon-name:Set icon name for host
+)
+if (( CURRENT == 1 )); then
+_describe -t commands 'hostnamectl commands' _hostnamectl_cmds || 
compadd $@
+else
+local curcontext=$curcontext
+cmd=${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}
+if (( $#cmd )); then
+[[ $cmd == status ]]  msg=no options || msg=options for $cmd
+_message $msg
+else
+_message unknown hostnamectl command: $words[1]
+fi
+fi
+}
+
+_arguments -s \
+{-h,--help}'[Show this help]' \
+'--version[Show package version]' \
+'--transient[Only set transient hostname]' \
+'--static[Only set static hostname]' \
+'--pretty[Only set pretty hostname]' \
+'--no-ask-password[Do not prompt for password]' \
+{-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
+'*::hostnamectl commands:_hostnamectl_command'
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 80a14ac..ce7ea1a 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,20 +1,9 @@
-#compdef journalctl hostnamectl localectl timedatectl systemd-coredumpctl 
udevadm systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef journalctl localectl timedatectl systemd-coredumpctl udevadm 
systemd-analyze systemd-cat systemd-ask-password systemd-cgls systemd-cgtop 
systemd-delta systemd-detect-virt systemd-inhibit systemd-machine-id-setup 
systemd-notify systemd-nspawn systemd-tmpfiles systemd-tty-ask-password-agent 
machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-hostnamectl)
-_arguments -s \
-{-h,--help}'[Show this help]' \
-'--version[Show package version]' \
-'--transient[Only set transient hostname]' \
-'--static[Only set static hostname]' \
-'--pretty[Only set pretty hostname]' \
-'--no-ask-password[Do not prompt for password]' \
-{-H,--host=}'[Operate on remote 
host]:userathost:_hosts_or_user_at_host' \
-'*::hostnamectl commands:_hostnamectl_command'
-;;
 journalctl)
 _arguments -s \
 '--since=[Start showing entries newer or of the specified 
date]:-MM-DD HH\:MM\:SS' \
@@ -323,27 +312,6 @@ _journal_fields() {
 _describe 'possible values' _fields
 }
 
-_hostnamectl_command() {
-local -a _hostnamectl_cmds
-_hostnamectl_cmds=(
-status:Show current hostname settings
-set-hostname:Set system hostname
-set-icon-name:Set icon name for host
-)
-if (( CURRENT == 1 )); then
-_describe -t commands 'hostnamectl commands' _hostnamectl_cmds || 
compadd $@
-else
-local curcontext=$curcontext
-cmd=${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}
-if (( $#cmd )); then
-[[ $cmd == status ]]  msg=no options || msg=options for $cmd
-_message $msg
-else
-_message unknown hostnamectl command: $words[1]
-fi
-fi
-}
-
 _localectl_set-locale() {
 local -a _confs _locales
 local expl suf
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 05/16] shell-comp: Split out zsh _journalctl

2013-07-30 Thread William Giokas
Re-ordered some of the options and added a few that were missing
previously as well.
---
 Makefile.am  |  1 +
 shell-completion/zsh/_journalctl | 83 
 shell-completion/zsh/_systemd| 70 +
 3 files changed, 85 insertions(+), 69 deletions(-)
 create mode 100644 shell-completion/zsh/_journalctl

diff --git a/Makefile.am b/Makefile.am
index ba40350..e331e67 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -345,6 +345,7 @@ dist_bashcompletion_DATA = \
 
 dist_zshcompletion_DATA = \
shell-completion/zsh/_systemctl \
+   shell-completion/zsh/_journalctl \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
new file mode 100644
index 000..440e35d
--- /dev/null
+++ b/shell-completion/zsh/_journalctl
@@ -0,0 +1,83 @@
+#compdef journalctl
+
+_outputmodes() {
+local -a _output_opts
+_output_opts=(short short-monotonic verbose export json json-pretty 
json-see cat)
+_describe -t output 'output mode' _output_opts || compadd $@
+}
+
+_list_fields() {
+local -a journal_fields
+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}
+_SYSTEMD_USER_UNIT
+_SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
+_{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
+_KERNEL_{DEVICE,SUBSYSTEM}
+_UDEV_{SYSNAME,DEVNODE,DEVLINK}
+__CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
+_describe 'possible fields' journal_fields
+}
+
+_journal_none() {
+local -a _commands _files
+_commands=( ${(f)$(_call_program commands $service -F _EXE 
2/dev/null)} )
+_alternative : \
+'files:/dev files:_files -W /dev -P /dev/' \
+commands:commands:($_commands[@]) \
+'fields:fields:_list_fields'
+}
+
+_journal_fields() {
+local -a _fields cmd
+cmd=(journalctl -F ${@[-1]} 2/dev/null )
+_fields=( ${(f)$(_call_program fields $cmd[@])} )
+typeset -U _fields
+_describe 'possible values' _fields
+}
+
+_arguments -s \
+{-h,--help}'[Show this help]' \
+'--version[Show package version]' \
+'--no-pager[Do not pipe output into a pager]' \
+{-l,--full}'[Show long fields in full]' \
+{-a,--all}'[Show all fields, including long and unprintable]' \
+{-f,--follow}'[Follow journal]' \
+{-e,--pager-end}'[Jump to the end of the journal in the pager]' \
+{-n,--lines=}'[Number of journal entries to show]:integer' \
+'--no-tail[Show all lines, even in follow mode]' \
+{-r,--reverse}'[Reverse output]' \
+{-o,--output=}'[Change journal output mode]:output modes:_outputmodes' \
+{-x,--catalog}'[Show explanatory texts with each log line]' \
+{-q,--quiet}[Don't show privilege warning] \
+{-m,--merge}'[Show entries from all available journals]' \
+{-b,--boot}'[Show entries from the specified boot only]' \
+{-k,--dmesg}'[Show only kernel messages, Implies -b]' \
+{-u,--unit=}'[Show data only from the specified 
unit]:units:_journal_fields _SYSTEMD_UNIT' \
+'--user-unit[Show data only from the specified user session 
unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
+{-p,--priority=}'[Show only messages within the specified priority 
range]:priority:_journal_fields PRIORITY' \
+{-c,--cursor=}'[Start showing entries from specified 
cursor]:cursors:_journal_fields __CURSORS' \
+'--after-cursor=[Start showing entries from the location in the journal 
after the cursor]:cursors:_journal_fields __CURSORS' \
+'--since=[Start showing entries newer or of the specified date]:-MM-DD 
HH\:MM\:SS' \
+'--until=[Stop showing entries older or of the specified date]:-MM-DD 
HH\:MM\:SS' \
+{-F,--field=}'[List all values a certain field takes]:Fields:_list_fields' 
\
+'--system[Show system and kernel messages]' \
+'--user[Show messages from user services]' \
+{-D,--directory=}'[Show journal files from 
directory]:directories:_directories' \
+'--file=[Operate on specified journal files]:file:_files' \
+'--root=[Operate on catalog hierarchy under specified 
directory]:directories:_directories' \
+'--new-id128[Generate a new 128 Bit ID]' \
+'--header[Show journal header information]' \
+'--disk-usage[Show total disk usage]' \
+'--list-catalog[List messages in catalog]' \
+'--dump-catalog[Dump messages in catalog]' \
+'--update-catalog[Update binary catalog database]' \
+'--setup-keys[Generate new FSS key pair]' \
+'--force[Force recreation of FSS keys]' \
+'--interval=[Time interval for changing the FSS sealing key]:time 
interval' \
+'--verify[Verify journal 

[systemd-devel] [PATCH 06/16] shell-comp: Split out zsh _localectl

2013-07-30 Thread William Giokas
---
 Makefile.am |  3 ++
 shell-completion/zsh/_localectl | 89 +
 shell-completion/zsh/_systemd   | 86 +--
 3 files changed, 93 insertions(+), 85 deletions(-)
 create mode 100644 shell-completion/zsh/_localectl

diff --git a/Makefile.am b/Makefile.am
index e331e67..64d4785 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3443,6 +3443,9 @@ bin_PROGRAMS += \
 dist_bashcompletion_DATA += \
shell-completion/bash/localectl
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_localectl
+
 endif
 
 polkitpolicy_in_files += \
diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl
new file mode 100644
index 000..0beed4f
--- /dev/null
+++ b/shell-completion/zsh/_localectl
@@ -0,0 +1,89 @@
+#compdef localectl
+
+_localectl_set-locale() {
+local -a _confs _locales
+local expl suf
+_locales=( ${(f)$(_call_program locales $service list-locales)} )
+_confs=( ${${(f)$(_call_program confs locale 2/dev/null)}%\=*} )
+if [[ -prefix 1 *\= ]]; then
+local conf=${PREFIX%%\=*}
+compset -P1 '*='
+_wanted locales expl locales configs \
+_combination localeconfs  confs=$conf locales $@ -
+else
+compadd -S '='  $_confs
+fi
+}
+
+_localectl_set-keymap() {
+local -a _keymaps
+_keymaps=( ${(f)$(_call_program locales $service list-keymaps)} )
+if (( CURRENT = 3 )); then
+_describe keymaps _keymaps
+else
+_message no more options
+fi
+}
+
+_localectl_set-x11-keymap() {
+if (( $+commands[pkg-config] )); then
+local -a _file _layout _model _variant _options
+local _xorg_lst
+_xorg_lst=${$($commands[pkg-config] xkeyboard-config 
--variable=xkb_base)}
+_file=( ${(ps:\n\!:)$($_xorg_lst/rules/xorg.lst)} )
+_layout=( ${${${(M)${(f)_file[1]}:#  *}#  }%% *} )
+_model=( ${${${(M)${(f)_file[2]}:#  *}#  }%% *} )
+_variant=( ${${${(M)${(f)_file[3]}:#  *}#  }%% *} )
+_options=( ${${${(M)${(f)_file[4]}:#  *}#  }%% *} )
+#_layout=( ${(f)$( echo $_file[1] | awk '/^  / {print $1}' )} )
+#_model=( ${(f)$(echo $_file[2] | awk '/^  / {print $1}')} )
+#_variant=( ${(f)$(echo $_file[3] | awk '/^  / {print $1}')} )
+#_options=( ${(f)$(echo ${_file[4]//:/\\:} | awk '/^  / {print 
$1}')} )
+
+case $CURRENT in
+2) _describe layouts _layout ;;
+3) _describe models _model;;
+4) _describe variants _variant;;
+5) _describe options _options;;
+*) _message no more options
+esac
+fi
+}
+
+_localectl_command() {
+local -a _localectl_cmds
+_localectl_cmds=(
+'status:Show current locale settings'
+'set-locale:Set system locale'
+'list-locales:Show known locales'
+'set-keymap:Set virtual console keyboard mapping'
+'list-keymaps:Show known virtual console keyboard mappings'
+'set-x11-keymap:Set X11 keyboard mapping'
+)
+if (( CURRENT == 1 )); then
+_describe -t commands 'localectl command' _localectl_cmds
+else
+local curcontext=$curcontext
+cmd=${${_localectl_cmds[(r)$words[1]:*]%%:*}}
+if (( $+functions[_localectl_$cmd] )); then
+_localectl_$cmd
+else
+_message no more options
+fi
+fi
+}
+
+_hosts_or_user_at_host() {
+  _alternative \
+'users-hosts:: _user_at_host' \
+'hosts:: _hosts'
+}
+
+_arguments \
+{-h,--help}'[Show this help]' \
+'--version[Show package version]' \
+--no-convert[Don't convert keyboard mappings] \
+'--no-pager[Do not pipe output into a pager]' \
+'--no-ask-password[Do not prompt for password]' \
+{-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
+'*::localectl commands:_localectl_command'
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 488d460..70746ef 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,19 +1,9 @@
-#compdef localectl timedatectl systemd-coredumpctl udevadm systemd-analyze 
systemd-cat systemd-ask-password systemd-cgls systemd-cgtop systemd-delta 
systemd-detect-virt systemd-inhibit systemd-machine-id-setup systemd-notify 
systemd-nspawn systemd-tmpfiles systemd-tty-ask-password-agent machinectl
+#compdef timedatectl systemd-coredumpctl udevadm systemd-analyze systemd-cat 
systemd-ask-password systemd-cgls systemd-cgtop systemd-delta 
systemd-detect-virt systemd-inhibit systemd-machine-id-setup systemd-notify 
systemd-nspawn systemd-tmpfiles systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-localectl)
-_arguments \
-{-h,--help}'[Show this help]' \
-'--version[Show package version]' \
---no-convert[Don't 

[systemd-devel] [PATCH 07/16] shell-comp: Split out zsh _coredumpctl

2013-07-30 Thread William Giokas
---
 Makefile.am   |  3 +++
 shell-completion/zsh/_systemd | 38 +--
 shell-completion/zsh/_systemd-coredumpctl | 34 +++
 3 files changed, 38 insertions(+), 37 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-coredumpctl

diff --git a/Makefile.am b/Makefile.am
index 64d4785..cf764cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3104,6 +3104,9 @@ bin_PROGRAMS += \
 dist_bashcompletion_DATA += \
shell-completion/bash/systemd-coredumpctl
 
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_systemd-coredumpctl
+
 sysctl_DATA = \
sysctl.d/50-coredump.conf
 
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 70746ef..1d0f840 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,18 +1,9 @@
-#compdef timedatectl systemd-coredumpctl udevadm systemd-analyze systemd-cat 
systemd-ask-password systemd-cgls systemd-cgtop systemd-delta 
systemd-detect-virt systemd-inhibit systemd-machine-id-setup systemd-notify 
systemd-nspawn systemd-tmpfiles systemd-tty-ask-password-agent machinectl
+#compdef timedatectl udevadm systemd-analyze systemd-cat systemd-ask-password 
systemd-cgls systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-systemd-coredumpctl)
-_arguments \
-{-o,--output=}'[Write output to FILE]:output file:_files' \
-'--no-pager[Do not pipe output into a pager]' \
-{-h,--help}'[Show this help]' \
-'--version[Show package version]' \
-'*::systemd-coredumpctl commands:_systemd-coredumpctl_command'
-
-;;
 timedatectl)
 _arguments -s \
 {-h,--help}'[Show this help]' \
@@ -288,33 +279,6 @@ _timedatectl_command(){
 fi
 fi
 }
-_systemd-coredumpctl_command(){
-local -a _systemd_coredumpctl_cmds
-_systemd_coredumpctl_cmds=(
-'list:List available coredumps'
-'dump:Print coredump to std'
-)
-if (( CURRENT == 1 )); then
-_describe -t commands 'systemd-coredumpctl command' 
_systemd_coredumpctl_cmds
-else
-local curcontext=$curcontext
-local -a _dumps
-cmd=${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}
-if (( $#cmd  )); then
-   # user can set zstyle 
':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by 
date, otherwise they get ordered by pid
-   _dumps=( ${(foa)$(systemd-coredumpctl list | awk 
'BEGIN{OFS=:} /^\s/ {sub(/[[ \t]+/, ); print $5,$0}' 2/dev/null)} )
-if [[ -n $_dumps ]]; then
-_describe -t pids 'coredumps' _dumps
-else
-_message no coredumps
-fi
-else
-_message no more options
-fi
-
-fi
-
-}
 
 (( $+functions[_machinectl_command] )) || _machinectl_command()
 {
diff --git a/shell-completion/zsh/_systemd-coredumpctl 
b/shell-completion/zsh/_systemd-coredumpctl
new file mode 100644
index 000..f5d12cb
--- /dev/null
+++ b/shell-completion/zsh/_systemd-coredumpctl
@@ -0,0 +1,34 @@
+#compdef systemd-coredumpctl
+
+_systemd-coredumpctl_command(){
+local -a _systemd_coredumpctl_cmds
+_systemd_coredumpctl_cmds=(
+'list:List available coredumps'
+'dump:Print coredump to std'
+)
+if (( CURRENT == 1 )); then
+_describe -t commands 'systemd-coredumpctl command' 
_systemd_coredumpctl_cmds
+else
+local curcontext=$curcontext
+local -a _dumps
+cmd=${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}
+if (( $#cmd  )); then
+   # user can set zstyle 
':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by 
date, otherwise they get ordered by pid
+   _dumps=( ${(foa)$(systemd-coredumpctl list | awk 
'BEGIN{OFS=:} /^\s/ {sub(/[[ \t]+/, ); print $5,$0}' 2/dev/null)} )
+if [[ -n $_dumps ]]; then
+_describe -t pids 'coredumps' _dumps
+else
+_message no coredumps
+fi
+else
+_message no more options
+fi
+fi
+}
+
+_arguments \
+{-o,--output=}'[Write output to FILE]:output file:_files' \
+'--no-pager[Do not pipe output into a pager]' \
+{-h,--help}'[Show this help]' \
+'--version[Show package version]' \
+'*::systemd-coredumpctl commands:_systemd-coredumpctl_command'
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 08/16] shell-comp: Split out zsh _timedatectl

2013-07-30 Thread William Giokas
---
 Makefile.am   |  3 ++
 shell-completion/zsh/_systemd | 67 +---
 shell-completion/zsh/_timedatectl | 71 +++
 3 files changed, 75 insertions(+), 66 deletions(-)
 create mode 100644 shell-completion/zsh/_timedatectl

diff --git a/Makefile.am b/Makefile.am
index cf764cd..cdf5c46 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3518,6 +3518,9 @@ bin_PROGRAMS += \
 
 dist_bashcompletion_DATA += \
shell-completion/bash/timedatectl
+
+dist_zshcompletion_DATA += \
+   shell-completion/zsh/_timedatectl
 endif
 
 polkitpolicy_in_files += \
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 1d0f840..7e23d78 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,19 +1,9 @@
-#compdef timedatectl udevadm systemd-analyze systemd-cat systemd-ask-password 
systemd-cgls systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef udevadm systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-timedatectl)
-_arguments -s \
-{-h,--help}'[Show this help]' \
-'--version[Show package version]' \
-'--adjust-system-clock[Adjust system clock when changing local 
RTC mode]' \
-'--no-pager[Do not pipe output into a pager]' \
-'--no-ask-password[Do not prompt for password]' \
-{-H,--host=}'[Operate on remote 
host]:userathost:_hosts_or_user_at_host' \
-'*::timedatectl commands:_timedatectl_command'
-;;
 udevadm)
 _arguments \
 '--debug[Print debug messages to stderr]' \
@@ -225,61 +215,6 @@ _outputmodes() {
 _describe -t output 'output mode' _output_opts || compadd $@
 }
 
-_timedatectl_set-timezone(){
-local -a _timezones
-_timezones=( ${(f)$(_call_program timezones ${service} 
list-timezones)} )
-compadd $_timezones[@]
-}
-
-_timedatectl_set-time(){
-_message -MM-DD HH:MM:SS
-}
-
-_timedatectl_set-local-rtc(){
-local -a _options
-_options=(
-'0:Maintain RTC in universal time'
-'1:Maintain RTC in local time'
-)
-_describe options _options
-}
-
-_timedatectl_set-ntp(){
-local -a _options
-_options=(
-'0:Disable NTP based network time configuration'
-'1:Enable NTP based network time configuration'
-)
-_describe options _options
-}
-
-_timedatectl_command(){
-local -a _timedatectl_cmds
-_timedatectl_cmds=(
-'status:Show current time settings'
-'set-time:Set system time'
-'set-timezone:Set system timezone'
-'list-timezones:Show known timezones'
-'set-local-rtc:Control whether RTC is in local time'
-'set-ntp:Control whether NTP is enabled'
-)
-if (( CURRENT == 1 )); then
-_describe -t commands 'timedatectl command' _timedatectl_cmds
-else
-local curcontext=$curcontext
-cmd=${${_timedatectl_cmds[(r)$words[1]:*]%%:*}}
-if (( $#cmd )); then
-if (( $+functions[_timedatectl_$cmd] )); then
-_timedatectl_$cmd
-else
-_message no more options
-fi
-else
-_message unknown timedatectl command: $words[1]
-fi
-fi
-}
-
 (( $+functions[_machinectl_command] )) || _machinectl_command()
 {
   local -a _machinectl_cmds
diff --git a/shell-completion/zsh/_timedatectl 
b/shell-completion/zsh/_timedatectl
new file mode 100644
index 000..091b6f1
--- /dev/null
+++ b/shell-completion/zsh/_timedatectl
@@ -0,0 +1,71 @@
+#compdef timedatectl
+
+_timedatectl_set-timezone(){
+local -a _timezones
+_timezones=( ${(f)$(_call_program timezones ${service} 
list-timezones)} )
+compadd $_timezones[@]
+}
+
+_timedatectl_set-time(){
+_message -MM-DD HH:MM:SS
+}
+
+_timedatectl_set-local-rtc(){
+local -a _options
+_options=(
+'0:Maintain RTC in universal time'
+'1:Maintain RTC in local time'
+)
+_describe options _options
+}
+
+_timedatectl_set-ntp(){
+local -a _options
+_options=(
+'0:Disable NTP based network time configuration'
+'1:Enable NTP based network time configuration'
+)
+_describe options _options
+}
+
+_timedatectl_command(){
+local -a _timedatectl_cmds
+_timedatectl_cmds=(
+'status:Show current time settings'
+'set-time:Set system time'
+'set-timezone:Set system timezone'
+'list-timezones:Show known timezones'
+

[systemd-devel] [PATCH 09/16] shell-comp: Split out zsh _udevadm

2013-07-30 Thread William Giokas
---
 Makefile.am   |   1 +
 shell-completion/zsh/_systemd | 142 +-
 shell-completion/zsh/_udevadm | 141 +
 3 files changed, 143 insertions(+), 141 deletions(-)
 create mode 100644 shell-completion/zsh/_udevadm

diff --git a/Makefile.am b/Makefile.am
index cdf5c46..c96c8b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -346,6 +346,7 @@ dist_bashcompletion_DATA = \
 dist_zshcompletion_DATA = \
shell-completion/zsh/_systemctl \
shell-completion/zsh/_journalctl \
+   shell-completion/zsh/_udevadm \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 7e23d78..78cb061 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,16 +1,9 @@
-#compdef udevadm systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
 local curcontext=$curcontext state lstate line
 case $service in
-udevadm)
-_arguments \
-'--debug[Print debug messages to stderr]' \
-'--version[Print version number]' \
-'--help[Print help text]' \
-'*::udevadm commands:_udevadm_command'
-;;
 systemd-analyze)
 _arguments \
 {-h,--help}'[Show help text.]' \
@@ -247,139 +240,6 @@ _outputmodes() {
   fi
 }
 
-_udevadm_info(){
-_arguments \
-'--query=[Query the database for specified type of device data. It 
needs the --path or --name to identify the specified device.]:type:(name 
symlink path property all)' \
-'--path=[The devpath of the device to query.]:sys files:_files -P 
/sys/ -W /sys' \
-'--name=[The name of the device node or a symlink to query]:device 
files:_files -P /dev/ -W /dev' \
-'--root[Print absolute paths in name or symlink query.]' \
-'--attribute-walk[Print all sysfs properties of the specified device 
that can be used in udev rules to match the specified device]' \
-'--export[Print output as key/value pairs.]' \
-'--export-prefix=[Add a prefix to the key name of exported 
values.]:prefix' \
-'--device-id-of-file=[Print major/minor numbers of the underlying 
device, where the file lives on.]:files:_udevadm_mounts' \
-'--export-db[Export the content of the udev database.]' \
-'--cleanup-db[Cleanup the udev database.]'
-}
-
-_udevadm_trigger(){
-_arguments \
-'--verbose[Print the list of devices which will be triggered.]' \
-'--dry-run[Do not actually trigger the event.]' \
-'--type=[Trigger a specific type of devices.]:types:(devices 
subsystems failed)' \
-'--action=[Type of event to be triggered.]:actions:(add change 
remove)' \
-'--subsystem-match=[Trigger events for devices which belong to a 
matching subsystem.]' \
-'--subsystem-nomatch=[Do not trigger events for devices which belong 
to a matching subsystem.]' \
-'--attr-match=attribute=[Trigger events for devices with a matching 
sysfs attribute.]' \
-'--attr-nomatch=attribute=[Do not trigger events for devices with a 
matching sysfs attribute.]' \
-'--property-match=[Trigger events for devices with a matching property 
value.]' \
-'--tag-match=property[Trigger events for devices with a matching 
tag.]' \
-'--sysname-match=[Trigger events for devices with a matching sys 
device name.]' \
-'--parent-match=[Trigger events for all children of a given device.]'
-}
-
-_udevadm_settle(){
-_arguments \
-   '--timeout=[Maximum number of seconds to wait for the event queue to 
become empty.]' \
-   '--seq-start=[Wait only for events after the given sequence number.]' \
-   '--seq-end=[Wait only for events before the given sequence number.]' \
-   '--exit-if-exists=[Stop waiting if file exists.]:files:_files' \
-   '--quiet[Do not print any output, like the remaining queue entries when 
reaching the timeout.]' \
-   '--help[Print help text.]'
-}
-
-_udevadm_control(){
-_arguments \
-'--exit[Signal and wait for systemd-udevd to exit.]' \
-'--log-priority=[Set the internal log level of 
systemd-udevd.]:priorities:(err info debug)' \
-'--stop-exec-queue[Signal systemd-udevd to stop executing new events. 
Incoming events will be queued.]' \
-'--start-exec-queue[Signal systemd-udevd to enable the execution of 
events.]' \
-'--reload[Signal 

[systemd-devel] [PATCH 10/16] shell-comp: Split out zsh _systemd-nspawn

2013-07-30 Thread William Giokas
---
 Makefile.am  |  1 +
 shell-completion/zsh/_systemd| 26 +-
 shell-completion/zsh/_systemd-nspawn | 24 
 3 files changed, 26 insertions(+), 25 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-nspawn

diff --git a/Makefile.am b/Makefile.am
index c96c8b1..24e4fa4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,6 +347,7 @@ dist_zshcompletion_DATA = \
shell-completion/zsh/_systemctl \
shell-completion/zsh/_journalctl \
shell-completion/zsh/_udevadm \
+   shell-completion/zsh/_systemd-nspawn \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 78cb061..bacf179 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,4 +1,4 @@
-#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
@@ -96,20 +96,6 @@ _ctls()
 '--booted[Returns 0 if the system was booted up with systemd]' 
\
 '--readahead=[Controls disk read-ahead 
operations]:arguments:(cancel done noreply)'
 ;;
-systemd-nspawn)
-_arguments \
-{-h,--help}'[Show this help]' \
-{--directory=,-D}'[Directory to use as file system root for 
the namespace container. If omitted the current directory will be 
used.]:directories:_directories' \
-{--boot,-b}'[Automatically search for an init binary and 
invoke it instead of a shell or a user supplied program.]' \
-{--user=,-u}'[Run the command under specified user, create 
home directory and cd into it.]' \
-'--uuid=[Set the specified uuid for the container.]' \
-{--controllers=,-C}'[Makes the container appear in other 
hierarchies than the name=systemd:/ one. Takes a comma-separated list of 
controllers.]' \
-'--private-network[Turn off networking in the container. This 
makes all network interfaces unavailable in the container, with the exception 
of the loopback device.]' \
-'--read-only[Mount the root file system read only for the 
container.]' \
-'--capability=[List one or more additional capabilities to 
grant the container.]:capabilities:_systemd-nspawn' \
---link-journal=[Control whether the container's journal shall 
be made visible to the host system.]:options:(no, host, guest, auto) \
-'-j[Equivalent to --link-journal=guest.]'
-;;
 systemd-tmpfiles)
 _arguments \
 '--create[Create, set ownership/permissions based on the 
config files.]' \
@@ -150,16 +136,6 @@ _ctls()
 esac
 }
 
-_systemd-nspawn(){
-local -a _caps
-_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
-CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
CAP_LINUX_IMMUTABLE
-CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
CAP_SETFCAP CAP_SETPCAP
-CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
-CAP_SYS_RESOURCE CAP_SYS_BOOT )
-_values -s , 'capabilities' $_caps[@]
-}
-
 _systemd_inhibit_command(){
 if (( CURRENT == 1 )); then
 compset -q
diff --git a/shell-completion/zsh/_systemd-nspawn 
b/shell-completion/zsh/_systemd-nspawn
new file mode 100644
index 000..4612a44
--- /dev/null
+++ b/shell-completion/zsh/_systemd-nspawn
@@ -0,0 +1,24 @@
+#compdef systemd-nspawn
+
+_systemd-nspawn(){
+local -a _caps
+_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
+CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
CAP_LINUX_IMMUTABLE
+CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
CAP_SETFCAP CAP_SETPCAP
+CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
+CAP_SYS_RESOURCE CAP_SYS_BOOT )
+_values -s , 'capabilities' $_caps[@]
+}
+
+_arguments \
+{-h,--help}'[Show this help]' \
+{--directory=,-D}'[Directory to use as file system root for the namespace 
container. If omitted the current directory will be 
used.]:directories:_directories' \
+{--boot,-b}'[Automatically search for an init binary and invoke it instead 
of a shell or a user supplied program.]' \
+{--user=,-u}'[Run the command under specified user, create home directory 
and cd into it.]' \
+'--uuid=[Set the specified uuid for the container.]' \
+

[systemd-devel] [PATCH 01/16] shell-completion: fix zsh completion installation

2013-07-30 Thread William Giokas
Moved zsh shell completion to shell-completion/zsh/_systemd for
automake's sake. Also allow users to specify where the files should go
with::

  ./configure --with-zshcompletiondir=/path/to/some/where

and by default going to `$datadir/zsh/site-functions`
---

My server is down for maintenance, so I'll be putting these on the ml
directly.

 Makefile.am   | 8 +---
 configure.ac  | 6 ++
 shell-completion/{systemd-zsh-completion.zsh = zsh/_systemd} | 0
 3 files changed, 11 insertions(+), 3 deletions(-)
 rename shell-completion/{systemd-zsh-completion.zsh = zsh/_systemd} (100%)

diff --git a/Makefile.am b/Makefile.am
index c81c40c..27e03ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,6 +68,7 @@ pkgconfigdatadir=$(datadir)/pkgconfig
 pkgconfiglibdir=$(libdir)/pkgconfig
 polkitpolicydir=$(datadir)/polkit-1/actions
 bashcompletiondir=@bashcompletiondir@
+zshcompletiondir=@zshcompletiondir@
 rpmmacrosdir=$(prefix)/lib/rpm/macros.d
 sysvinitdir=$(SYSTEM_SYSVINIT_PATH)
 sysvrcnddir=$(SYSTEM_SYSVRCND_PATH)
@@ -342,6 +343,9 @@ dist_bashcompletion_DATA = \
shell-completion/bash/udevadm \
shell-completion/bash/kernel-install
 
+dist_zshcompletion_DATA = \
+   shell-completion/zsh/_systemd
+
 dist_sysctl_DATA = \
sysctl.d/50-default.conf
 
@@ -4234,9 +4238,6 @@ EXTRA_DIST += \
docs/sysvinit/README.in \
docs/var-log/README.in
 
-EXTRA_DIST += \
-   shell-completion/systemd-zsh-completion.zsh
-
 SOCKETS_TARGET_WANTS += \
systemd-initctl.socket \
systemd-shutdownd.socket
@@ -4351,6 +4352,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
--with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
--with-dbusinterfacedir=$$dc_install_base/$(dbusinterfacedir) \
--with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
+   --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
--with-pamlibdir=$$dc_install_base/$(pamlibdir) \
--with-rootprefix=$$dc_install_base \
--disable-split-usr
diff --git a/configure.ac b/configure.ac
index f71e15c..0ecc716 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,6 +915,10 @@ AC_ARG_WITH([bashcompletiondir],
 with_bashcompletiondir=${datadir}/bash-completion/completions
 ])])
 
+AC_ARG_WITH([zshcompletiondir],
+AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions 
directory]),
+[], [with_zshcompletiondir=${datadir}/zsh/site-functions])
+
 AC_ARG_WITH([rootprefix],
 AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for 
config files and kernel modules]),
 [], [with_rootprefix=${ac_default_prefix}])
@@ -959,6 +963,7 @@ AC_SUBST([dbussessionservicedir], 
[$with_dbussessionservicedir])
 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
+AC_SUBST([zshcompletiondir], [$with_zshcompletiondir])
 AC_SUBST([pamlibdir], [$with_pamlibdir])
 AC_SUBST([rootprefix], [$with_rootprefix])
 AC_SUBST([rootlibdir], [$with_rootlibdir])
@@ -1036,6 +1041,7 @@ AC_MSG_RESULT([
 D-Bus system dir:${with_dbussystemservicedir}
 D-Bus interfaces dir:${with_dbusinterfacedir}
 Bash completions dir:${with_bashcompletiondir}
+Zsh completions dir: ${with_zshcompletiondir}
 Extra start script:  ${RC_LOCAL_SCRIPT_PATH_START}
 Extra stop script:   ${RC_LOCAL_SCRIPT_PATH_STOP}
 Debug shell: ${SUSHELL} @ ${DEBUGTTY}
diff --git a/shell-completion/systemd-zsh-completion.zsh 
b/shell-completion/zsh/_systemd
similarity index 100%
rename from shell-completion/systemd-zsh-completion.zsh
rename to shell-completion/zsh/_systemd
-- 
1.8.4.rc0.352.g531e8cb

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel