mirror of
https://github.com/systemd/systemd.git
synced 2024-12-02 23:03:50 +08:00
Merge branch 'master' into journal
This commit is contained in:
commit
1e2579fdeb
37
Makefile.am
37
Makefile.am
@ -119,6 +119,13 @@ AM_CPPFLAGS += \
|
|||||||
-DKBD_LOADKEYS=\"/bin/loadkeys\" \
|
-DKBD_LOADKEYS=\"/bin/loadkeys\" \
|
||||||
-DKBD_SETFONT=\"/bin/setfont\" \
|
-DKBD_SETFONT=\"/bin/setfont\" \
|
||||||
-DDEFAULT_FONT=\"latarcyrheb-sun16\"
|
-DDEFAULT_FONT=\"latarcyrheb-sun16\"
|
||||||
|
else
|
||||||
|
if TARGET_MAGEIA
|
||||||
|
AM_CPPFLAGS += \
|
||||||
|
-DKBD_LOADKEYS=\"/bin/loadkeys\" \
|
||||||
|
-DKBD_SETFONT=\"/bin/setfont\" \
|
||||||
|
-DDEFAULT_FONT=\"LatArCyrHeb-16\"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -318,7 +325,7 @@ dbusinterface_DATA += \
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
dist_bashcompletion_DATA = \
|
dist_bashcompletion_DATA = \
|
||||||
src/systemctl-bash-completion.sh
|
src/systemd-bash-completion.sh
|
||||||
|
|
||||||
dist_tmpfiles_DATA = \
|
dist_tmpfiles_DATA = \
|
||||||
tmpfiles.d/systemd.conf \
|
tmpfiles.d/systemd.conf \
|
||||||
@ -546,6 +553,13 @@ dist_systemunit_DATA += \
|
|||||||
units/suse/halt-local.service
|
units/suse/halt-local.service
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if TARGET_MAGEIA
|
||||||
|
dist_systemunit_DATA += \
|
||||||
|
units/mageia/prefdm.service \
|
||||||
|
units/fedora/rc-local.service \
|
||||||
|
units/fedora/halt-local.service
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_PLYMOUTH
|
if HAVE_PLYMOUTH
|
||||||
dist_systemunit_DATA += \
|
dist_systemunit_DATA += \
|
||||||
units/plymouth-start.service \
|
units/plymouth-start.service \
|
||||||
@ -1488,7 +1502,8 @@ systemd_stdio_bridge_LDADD = \
|
|||||||
|
|
||||||
systemadm_SOURCES = \
|
systemadm_SOURCES = \
|
||||||
src/systemadm.vala \
|
src/systemadm.vala \
|
||||||
src/systemd-interfaces.vala
|
src/systemd-interfaces.vala \
|
||||||
|
src/wraplabel.vala
|
||||||
|
|
||||||
systemadm_CFLAGS = \
|
systemadm_CFLAGS = \
|
||||||
$(AM_CFLAGS) \
|
$(AM_CFLAGS) \
|
||||||
@ -1501,6 +1516,7 @@ systemadm_CFLAGS = \
|
|||||||
systemadm_VALAFLAGS = \
|
systemadm_VALAFLAGS = \
|
||||||
--pkg=posix \
|
--pkg=posix \
|
||||||
--pkg=gtk+-2.0 \
|
--pkg=gtk+-2.0 \
|
||||||
|
--pkg=gee-1.0 \
|
||||||
-g
|
-g
|
||||||
|
|
||||||
systemadm_LDADD = \
|
systemadm_LDADD = \
|
||||||
@ -2061,6 +2077,23 @@ if TARGET_SUSE
|
|||||||
$(LN_S) $(systemunitdir)/halt-local.service halt-local.service )
|
$(LN_S) $(systemunitdir)/halt-local.service halt-local.service )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if TARGET_MAGEIA
|
||||||
|
$(MKDIR_P) -m 0755 $(DESTDIR)$(systemunitdir)/final.target.wants
|
||||||
|
( cd $(DESTDIR)$(systemunitdir)/multi-user.target.wants && \
|
||||||
|
rm -f rc-local.service && \
|
||||||
|
$(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
|
||||||
|
( cd $(DESTDIR)$(systemunitdir)/final.target.wants && \
|
||||||
|
rm -f halt-local.service && \
|
||||||
|
$(LN_S) $(systemunitdir)/halt-local.service halt-local.service )
|
||||||
|
( cd $(DESTDIR)$(systemunitdir) && \
|
||||||
|
rm -f display-manager.service && \
|
||||||
|
$(LN_S) prefdm.service display-manager.service && \
|
||||||
|
$(LN_S) prefdm.service dm.service )
|
||||||
|
( cd $(DESTDIR)$(systemunitdir)/graphical.target.wants && \
|
||||||
|
rm -f display-manager.service && \
|
||||||
|
$(LN_S) $(systemunitdir)/display-manager.service display-manager.service )
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_SYSV_COMPAT
|
if HAVE_SYSV_COMPAT
|
||||||
( cd $(DESTDIR)$(systemunitdir)/local-fs.target.wants && \
|
( cd $(DESTDIR)$(systemunitdir)/local-fs.target.wants && \
|
||||||
rm -f var-lock.mount && \
|
rm -f var-lock.mount && \
|
||||||
|
5
README
5
README
@ -30,7 +30,10 @@ LICENSE:
|
|||||||
GPLv2+ for all code, except sd-daemon.[ch] which is MIT
|
GPLv2+ for all code, except sd-daemon.[ch] which is MIT
|
||||||
|
|
||||||
REQUIREMENTS:
|
REQUIREMENTS:
|
||||||
Linux kernel >= 2.6.39 (with devtmpfs, cgroups; optional but strongly recommended: autofs4, ipv6)
|
Linux kernel >= 2.6.39
|
||||||
|
with devtmpfs
|
||||||
|
with cgroups (but it's OK to disable all controllers)
|
||||||
|
optional but strongly recommended: autofs4, ipv6
|
||||||
libudev >= 172
|
libudev >= 172
|
||||||
dbus >= 1.4.0
|
dbus >= 1.4.0
|
||||||
libcap
|
libcap
|
||||||
|
6
TODO
6
TODO
@ -23,8 +23,14 @@ Features:
|
|||||||
|
|
||||||
* check utf8 everywhere
|
* check utf8 everywhere
|
||||||
|
|
||||||
|
* when an instanced service exits, remove its parent cgroup too if possible.
|
||||||
|
|
||||||
|
* as Tom Gundersen pointed out there's a always a dep loop if people use crypto file systems with random keys
|
||||||
|
|
||||||
* unset container= in PID1?
|
* unset container= in PID1?
|
||||||
|
|
||||||
|
* automatically escape unit names passed on the service (i.e. think "systemctl start serial-getty.service@serial/by-path/jshdfjsdfhkjh" being automatically escaped as necessary.
|
||||||
|
|
||||||
* if we can not get user quota for tmpfs, mount a separate tmpfs instance
|
* if we can not get user quota for tmpfs, mount a separate tmpfs instance
|
||||||
for every user in /run/user/$USER with a configured maximum size
|
for every user in /run/user/$USER with a configured maximum size
|
||||||
|
|
||||||
|
10
configure.ac
10
configure.ac
@ -327,7 +327,7 @@ AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
|
|||||||
have_gtk=no
|
have_gtk=no
|
||||||
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
|
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
|
||||||
if test "x$enable_gtk" != "xno"; then
|
if test "x$enable_gtk" != "xno"; then
|
||||||
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
|
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 gee-1.0],
|
||||||
[AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
|
[AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
|
||||||
AC_SUBST(GTK_CFLAGS)
|
AC_SUBST(GTK_CFLAGS)
|
||||||
AC_SUBST(GTK_LIBS)
|
AC_SUBST(GTK_LIBS)
|
||||||
@ -371,6 +371,7 @@ if test "z$with_distro" = "z"; then
|
|||||||
test -f "/etc/mandriva-release" && with_distro="mandriva"
|
test -f "/etc/mandriva-release" && with_distro="mandriva"
|
||||||
test -f "/etc/meego-release" && with_distro="meego"
|
test -f "/etc/meego-release" && with_distro="meego"
|
||||||
test -f "/etc/angstrom-version" && with_distro="angstrom"
|
test -f "/etc/angstrom-version" && with_distro="angstrom"
|
||||||
|
test -f "/etc/mageia-release" && with_distro="mageia"
|
||||||
if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
|
if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
|
||||||
with_distro="ubuntu"
|
with_distro="ubuntu"
|
||||||
fi
|
fi
|
||||||
@ -458,6 +459,12 @@ case $with_distro in
|
|||||||
AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
|
AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
|
||||||
M4_DEFINES=-DTARGET_ANGSTROM=1
|
M4_DEFINES=-DTARGET_ANGSTROM=1
|
||||||
;;
|
;;
|
||||||
|
mageia)
|
||||||
|
SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
|
||||||
|
AC_DEFINE(TARGET_MAGEIA, [], [Target is Mageia])
|
||||||
|
M4_DISTRO_FLAG=-DTARGET_MAGEIA=1
|
||||||
|
have_plymouth=yes
|
||||||
|
;;
|
||||||
other)
|
other)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -515,6 +522,7 @@ AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
|
|||||||
AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
|
AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
|
||||||
AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
|
AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
|
||||||
AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
|
AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
|
||||||
|
AM_CONDITIONAL(TARGET_MAGEIA, test x"$with_distro" = xmageia)
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
|
AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
|
||||||
AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
|
AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
|
||||||
|
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@ -12,4 +12,5 @@ org.freedesktop.systemd1.policy
|
|||||||
gnome-ask-password-agent.c
|
gnome-ask-password-agent.c
|
||||||
systemd-interfaces.c
|
systemd-interfaces.c
|
||||||
systemadm.c
|
systemadm.c
|
||||||
|
wraplabel.c
|
||||||
73-seat-late.rules
|
73-seat-late.rules
|
||||||
|
15
src/cgroup.c
15
src/cgroup.c
@ -38,9 +38,6 @@ int cgroup_bonding_realize(CGroupBonding *b) {
|
|||||||
assert(b->path);
|
assert(b->path);
|
||||||
assert(b->controller);
|
assert(b->controller);
|
||||||
|
|
||||||
if (b->realized)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = cg_create(b->controller, b->path);
|
r = cg_create(b->controller, b->path);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_warning("Failed to create cgroup %s:%s: %s", b->controller, b->path, strerror(-r));
|
log_warning("Failed to create cgroup %s:%s: %s", b->controller, b->path, strerror(-r));
|
||||||
@ -366,7 +363,8 @@ int cgroup_notify_empty(Manager *m, const char *group) {
|
|||||||
assert(m);
|
assert(m);
|
||||||
assert(group);
|
assert(group);
|
||||||
|
|
||||||
if (!(l = hashmap_get(m->cgroup_bondings, group)))
|
l = hashmap_get(m->cgroup_bondings, group);
|
||||||
|
if (!l)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
LIST_FOREACH(by_path, b, l) {
|
LIST_FOREACH(by_path, b, l) {
|
||||||
@ -375,7 +373,8 @@ int cgroup_notify_empty(Manager *m, const char *group) {
|
|||||||
if (!b->unit)
|
if (!b->unit)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((t = cgroup_bonding_is_empty_list(b)) < 0) {
|
t = cgroup_bonding_is_empty_list(b);
|
||||||
|
if (t < 0) {
|
||||||
|
|
||||||
/* If we don't know, we don't know */
|
/* If we don't know, we don't know */
|
||||||
if (t != -EAGAIN)
|
if (t != -EAGAIN)
|
||||||
@ -384,9 +383,13 @@ int cgroup_notify_empty(Manager *m, const char *group) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t > 0)
|
if (t > 0) {
|
||||||
|
/* If it is empty, let's delete it */
|
||||||
|
cgroup_bonding_trim_list(b->unit->meta.cgroup_bondings, true);
|
||||||
|
|
||||||
if (UNIT_VTABLE(b->unit)->cgroup_notify_empty)
|
if (UNIT_VTABLE(b->unit)->cgroup_notify_empty)
|
||||||
UNIT_VTABLE(b->unit)->cgroup_notify_empty(b->unit);
|
UNIT_VTABLE(b->unit)->cgroup_notify_empty(b->unit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -187,6 +187,8 @@ static bool test_capability(const char *parameter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
return !!(capabilities & (1ULL << value));
|
return !!(capabilities & (1ULL << value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +112,7 @@ static int create_disk(
|
|||||||
"DefaultDependencies=no\n"
|
"DefaultDependencies=no\n"
|
||||||
"BindTo=%s dev-mapper-%%i.device\n"
|
"BindTo=%s dev-mapper-%%i.device\n"
|
||||||
"After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
|
"After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
|
||||||
"Before=umount.target\n"
|
"Before=umount.target\n",
|
||||||
"Before=local-fs.target\n",
|
|
||||||
d, d);
|
d, d);
|
||||||
|
|
||||||
if (!nofail)
|
if (!nofail)
|
||||||
@ -125,6 +124,9 @@ static int create_disk(
|
|||||||
streq(password, "/dev/hw_random")))
|
streq(password, "/dev/hw_random")))
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"After=systemd-random-seed-load.service\n");
|
"After=systemd-random-seed-load.service\n");
|
||||||
|
else
|
||||||
|
fprintf(f,
|
||||||
|
"Before=local-fs.target\n");
|
||||||
|
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"\n[Service]\n"
|
"\n[Service]\n"
|
||||||
|
@ -127,7 +127,7 @@ static int parse_proc_cmdline(void) {
|
|||||||
arg_skip = true;
|
arg_skip = true;
|
||||||
else if (startswith(w, "fsck.mode"))
|
else if (startswith(w, "fsck.mode"))
|
||||||
log_warning("Invalid fsck.mode= parameter. Ignoring.");
|
log_warning("Invalid fsck.mode= parameter. Ignoring.");
|
||||||
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
|
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
|
||||||
else if (strneq(w, "fastboot", l))
|
else if (strneq(w, "fastboot", l))
|
||||||
arg_skip = true;
|
arg_skip = true;
|
||||||
else if (strneq(w, "forcefsck", l))
|
else if (strneq(w, "forcefsck", l))
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO)
|
#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA)
|
||||||
#define FILENAME "/etc/sysconfig/network"
|
#define FILENAME "/etc/sysconfig/network"
|
||||||
#elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)
|
#elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)
|
||||||
#define FILENAME "/etc/HOSTNAME"
|
#define FILENAME "/etc/HOSTNAME"
|
||||||
@ -64,7 +64,7 @@ static int read_and_strip_hostname(const char *path, char **hn) {
|
|||||||
|
|
||||||
static int read_distro_hostname(char **hn) {
|
static int read_distro_hostname(char **hn) {
|
||||||
|
|
||||||
#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO)
|
#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA)
|
||||||
int r;
|
int r;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ typedef struct Server {
|
|||||||
unsigned n_fifos;
|
unsigned n_fifos;
|
||||||
|
|
||||||
DBusConnection *bus;
|
DBusConnection *bus;
|
||||||
|
|
||||||
|
bool quit;
|
||||||
} Server;
|
} Server;
|
||||||
|
|
||||||
struct Fifo {
|
struct Fifo {
|
||||||
@ -174,6 +176,13 @@ static void request_process(Server *s, const struct init_request *req) {
|
|||||||
case 'U':
|
case 'U':
|
||||||
if (kill(1, SIGTERM) < 0)
|
if (kill(1, SIGTERM) < 0)
|
||||||
log_error("kill() failed: %m");
|
log_error("kill() failed: %m");
|
||||||
|
|
||||||
|
/* The bus connection will be
|
||||||
|
* terminated if PID 1 is reexecuted,
|
||||||
|
* hence let's just exit here, and
|
||||||
|
* rely on that we'll be restarted on
|
||||||
|
* the next request */
|
||||||
|
s->quit = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
@ -404,7 +413,7 @@ int main(int argc, char *argv[]) {
|
|||||||
"READY=1\n"
|
"READY=1\n"
|
||||||
"STATUS=Processing requests...");
|
"STATUS=Processing requests...");
|
||||||
|
|
||||||
for (;;) {
|
while (!server.quit) {
|
||||||
struct epoll_event event;
|
struct epoll_event event;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
|
19
src/job.c
19
src/job.c
@ -527,6 +527,7 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
|
|||||||
Unit *other;
|
Unit *other;
|
||||||
JobType t;
|
JobType t;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
|
bool recursed = false;
|
||||||
|
|
||||||
assert(j);
|
assert(j);
|
||||||
assert(j->installed);
|
assert(j->installed);
|
||||||
@ -573,23 +574,29 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
|
|||||||
if (other->meta.job &&
|
if (other->meta.job &&
|
||||||
(other->meta.job->type == JOB_START ||
|
(other->meta.job->type == JOB_START ||
|
||||||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
||||||
other->meta.job->type == JOB_RELOAD_OR_START))
|
other->meta.job->type == JOB_RELOAD_OR_START)) {
|
||||||
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
||||||
|
recursed = true;
|
||||||
|
}
|
||||||
|
|
||||||
SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
|
SET_FOREACH(other, u->meta.dependencies[UNIT_BOUND_BY], i)
|
||||||
if (other->meta.job &&
|
if (other->meta.job &&
|
||||||
(other->meta.job->type == JOB_START ||
|
(other->meta.job->type == JOB_START ||
|
||||||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
||||||
other->meta.job->type == JOB_RELOAD_OR_START))
|
other->meta.job->type == JOB_RELOAD_OR_START)) {
|
||||||
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
||||||
|
recursed = true;
|
||||||
|
}
|
||||||
|
|
||||||
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i)
|
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i)
|
||||||
if (other->meta.job &&
|
if (other->meta.job &&
|
||||||
!other->meta.job->override &&
|
!other->meta.job->override &&
|
||||||
(other->meta.job->type == JOB_START ||
|
(other->meta.job->type == JOB_START ||
|
||||||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
||||||
other->meta.job->type == JOB_RELOAD_OR_START))
|
other->meta.job->type == JOB_RELOAD_OR_START)) {
|
||||||
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
||||||
|
recursed = true;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (t == JOB_STOP) {
|
} else if (t == JOB_STOP) {
|
||||||
|
|
||||||
@ -597,8 +604,10 @@ int job_finish_and_invalidate(Job *j, JobResult result) {
|
|||||||
if (other->meta.job &&
|
if (other->meta.job &&
|
||||||
(other->meta.job->type == JOB_START ||
|
(other->meta.job->type == JOB_START ||
|
||||||
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
other->meta.job->type == JOB_VERIFY_ACTIVE ||
|
||||||
other->meta.job->type == JOB_RELOAD_OR_START))
|
other->meta.job->type == JOB_RELOAD_OR_START)) {
|
||||||
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
job_finish_and_invalidate(other->meta.job, JOB_DEPENDENCY);
|
||||||
|
recursed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +635,7 @@ finish:
|
|||||||
|
|
||||||
manager_check_finished(u->meta.manager);
|
manager_check_finished(u->meta.manager);
|
||||||
|
|
||||||
return 0;
|
return recursed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int job_start_timer(Job *j) {
|
int job_start_timer(Job *j) {
|
||||||
|
@ -199,7 +199,7 @@ int locale_setup(void) {
|
|||||||
if (r != -ENOENT)
|
if (r != -ENOENT)
|
||||||
log_warning("Failed to read /etc/profile.env: %s", strerror(-r));
|
log_warning("Failed to read /etc/profile.env: %s", strerror(-r));
|
||||||
}
|
}
|
||||||
#elif defined(TARGET_MANDRIVA)
|
#elif defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA )
|
||||||
if (r <= 0 &&
|
if (r <= 0 &&
|
||||||
(r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
|
(r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
|
||||||
"LANG", &variables[VARIABLE_LANG],
|
"LANG", &variables[VARIABLE_LANG],
|
||||||
|
@ -286,7 +286,10 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
#ifdef HAVE_AUDIT
|
#ifdef HAVE_AUDIT
|
||||||
if ((m->audit_fd = audit_open()) < 0)
|
if ((m->audit_fd = audit_open()) < 0 &&
|
||||||
|
/* If the kernel lacks netlink or audit support,
|
||||||
|
* don't worry about it. */
|
||||||
|
errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
|
||||||
log_error("Failed to connect to audit log: %m");
|
log_error("Failed to connect to audit log: %m");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1214,13 +1217,18 @@ static int transaction_apply(Manager *m, JobMode mode) {
|
|||||||
|
|
||||||
/* When isolating first kill all installed jobs which
|
/* When isolating first kill all installed jobs which
|
||||||
* aren't part of the new transaction */
|
* aren't part of the new transaction */
|
||||||
|
rescan:
|
||||||
HASHMAP_FOREACH(j, m->jobs, i) {
|
HASHMAP_FOREACH(j, m->jobs, i) {
|
||||||
assert(j->installed);
|
assert(j->installed);
|
||||||
|
|
||||||
if (hashmap_get(m->transaction_jobs, j->unit))
|
if (hashmap_get(m->transaction_jobs, j->unit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
job_finish_and_invalidate(j, JOB_CANCELED);
|
/* 'j' itself is safe to remove, but if other jobs
|
||||||
|
are invalidated recursively, our iterator may become
|
||||||
|
invalid and we need to start over. */
|
||||||
|
if (job_finish_and_invalidate(j, JOB_CANCELED) > 0)
|
||||||
|
goto rescan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ static bool needs_quota(MountParameters *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mount_add_fstab_links(Mount *m) {
|
static int mount_add_fstab_links(Mount *m) {
|
||||||
const char *target, *after = NULL;
|
const char *target, *after = NULL, *after2 = NULL;
|
||||||
MountParameters *p;
|
MountParameters *p;
|
||||||
Unit *tu;
|
Unit *tu;
|
||||||
int r;
|
int r;
|
||||||
@ -358,6 +358,7 @@ static int mount_add_fstab_links(Mount *m) {
|
|||||||
if (mount_is_network(p)) {
|
if (mount_is_network(p)) {
|
||||||
target = SPECIAL_REMOTE_FS_TARGET;
|
target = SPECIAL_REMOTE_FS_TARGET;
|
||||||
after = SPECIAL_REMOTE_FS_PRE_TARGET;
|
after = SPECIAL_REMOTE_FS_PRE_TARGET;
|
||||||
|
after2 = SPECIAL_NETWORK_TARGET;
|
||||||
} else {
|
} else {
|
||||||
target = SPECIAL_LOCAL_FS_TARGET;
|
target = SPECIAL_LOCAL_FS_TARGET;
|
||||||
after = SPECIAL_LOCAL_FS_PRE_TARGET;
|
after = SPECIAL_LOCAL_FS_PRE_TARGET;
|
||||||
@ -374,6 +375,10 @@ static int mount_add_fstab_links(Mount *m) {
|
|||||||
if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0)
|
if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
if (after2)
|
||||||
|
if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after2, NULL, true)) < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
if (automount) {
|
if (automount) {
|
||||||
Unit *am;
|
Unit *am;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static int parse_proc_cmdline(void) {
|
|||||||
arg_skip = true;
|
arg_skip = true;
|
||||||
else if (startswith(w, "quotacheck.mode"))
|
else if (startswith(w, "quotacheck.mode"))
|
||||||
log_warning("Invalid quotacheck.mode= parameter. Ignoring.");
|
log_warning("Invalid quotacheck.mode= parameter. Ignoring.");
|
||||||
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
|
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
|
||||||
else if (strneq(w, "forcequotacheck", l))
|
else if (strneq(w, "forcequotacheck", l))
|
||||||
arg_force = true;
|
arg_force = true;
|
||||||
#endif
|
#endif
|
||||||
@ -65,8 +65,8 @@ static int parse_proc_cmdline(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_files(void) {
|
static void test_files(void) {
|
||||||
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
|
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
|
||||||
/* This exists only on Fedora or Mandriva */
|
/* This exists only on Fedora, Mandriva or Mageia */
|
||||||
if (access("/forcequotacheck", F_OK) >= 0)
|
if (access("/forcequotacheck", F_OK) >= 0)
|
||||||
arg_force = true;
|
arg_force = true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,7 +51,11 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
/* Read pool size, if possible */
|
/* Read pool size, if possible */
|
||||||
if ((f = fopen("/proc/sys/kernel/random/poolsize", "re"))) {
|
if ((f = fopen("/proc/sys/kernel/random/poolsize", "re"))) {
|
||||||
fscanf(f, "%zu", &buf_size);
|
if (fscanf(f, "%zu", &buf_size) > 0) {
|
||||||
|
/* poolsize is in bits on 2.6, but we want bytes */
|
||||||
|
buf_size /= 8;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ static const struct {
|
|||||||
|
|
||||||
#define RUNLEVELS_UP "12345"
|
#define RUNLEVELS_UP "12345"
|
||||||
/* #define RUNLEVELS_DOWN "06" */
|
/* #define RUNLEVELS_DOWN "06" */
|
||||||
/* #define RUNLEVELS_BOOT "bBsS" */
|
#define RUNLEVELS_BOOT "bBsS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
||||||
@ -277,7 +277,8 @@ static int sysv_translate_facility(const char *name, const char *filename, char
|
|||||||
static const char * const table[] = {
|
static const char * const table[] = {
|
||||||
/* LSB defined facilities */
|
/* LSB defined facilities */
|
||||||
"local_fs", SPECIAL_LOCAL_FS_TARGET,
|
"local_fs", SPECIAL_LOCAL_FS_TARGET,
|
||||||
#ifndef TARGET_MANDRIVA
|
#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
|
||||||
|
#else
|
||||||
/* Due to unfortunate name selection in Mandriva,
|
/* Due to unfortunate name selection in Mandriva,
|
||||||
* $network is provided by network-up which is ordered
|
* $network is provided by network-up which is ordered
|
||||||
* after network which actually starts interfaces.
|
* after network which actually starts interfaces.
|
||||||
@ -811,6 +812,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
|
|||||||
|
|
||||||
if ((r = sysv_exec_commands(s)) < 0)
|
if ((r = sysv_exec_commands(s)) < 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
if (s->sysv_runlevels &&
|
||||||
|
chars_intersect(RUNLEVELS_BOOT, s->sysv_runlevels) &&
|
||||||
|
chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
|
||||||
|
/* Service has both boot and "up" runlevels
|
||||||
|
configured. Kill the "up" ones. */
|
||||||
|
delete_chars(s->sysv_runlevels, RUNLEVELS_UP);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
|
if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
|
||||||
/* If there a runlevels configured for this service
|
/* If there a runlevels configured for this service
|
||||||
|
@ -23,6 +23,20 @@ using Pango;
|
|||||||
|
|
||||||
static bool user = false;
|
static bool user = false;
|
||||||
|
|
||||||
|
public string format_time(uint64 time_ns) {
|
||||||
|
if (time_ns <= 0)
|
||||||
|
return "";
|
||||||
|
Time timestamp = Time.local((time_t) (time_ns / 1000000));
|
||||||
|
return timestamp.format("%a, %d %b %Y %H:%M:%S");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void new_column(TreeView view, int column_id, string title) {
|
||||||
|
TreeViewColumn col;
|
||||||
|
col = new TreeViewColumn.with_attributes(title, new CellRendererText(), "text", column_id);
|
||||||
|
col.set_sort_column_id(column_id);
|
||||||
|
view.insert_column(col, -1);
|
||||||
|
}
|
||||||
|
|
||||||
public class LeftLabel : Label {
|
public class LeftLabel : Label {
|
||||||
public LeftLabel(string? text = null) {
|
public LeftLabel(string? text = null) {
|
||||||
if (text != null)
|
if (text != null)
|
||||||
@ -32,12 +46,11 @@ public class LeftLabel : Label {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RightLabel : Label {
|
public class RightLabel : WrapLabel {
|
||||||
|
|
||||||
public RightLabel(string? text = null) {
|
public RightLabel(string? text = null) {
|
||||||
set_text_or_na(text);
|
|
||||||
set_alignment(0, 0);
|
|
||||||
set_ellipsize(EllipsizeMode.START);
|
|
||||||
set_selectable(true);
|
set_selectable(true);
|
||||||
|
set_text_or_na(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set_text_or_na(string? text = null) {
|
public void set_text_or_na(string? text = null) {
|
||||||
@ -66,6 +79,8 @@ public class MainWindow : Window {
|
|||||||
private ListStore unit_model;
|
private ListStore unit_model;
|
||||||
private ListStore job_model;
|
private ListStore job_model;
|
||||||
|
|
||||||
|
private Gee.HashMap<string, Unit> unit_map;
|
||||||
|
|
||||||
private Button start_button;
|
private Button start_button;
|
||||||
private Button stop_button;
|
private Button stop_button;
|
||||||
private Button restart_button;
|
private Button restart_button;
|
||||||
@ -81,7 +96,6 @@ public class MainWindow : Window {
|
|||||||
private Manager manager;
|
private Manager manager;
|
||||||
|
|
||||||
private RightLabel unit_id_label;
|
private RightLabel unit_id_label;
|
||||||
private RightLabel unit_aliases_label;
|
|
||||||
private RightLabel unit_dependency_label;
|
private RightLabel unit_dependency_label;
|
||||||
private RightLabel unit_description_label;
|
private RightLabel unit_description_label;
|
||||||
private RightLabel unit_load_state_label;
|
private RightLabel unit_load_state_label;
|
||||||
@ -99,6 +113,7 @@ public class MainWindow : Window {
|
|||||||
private RightLabel job_type_label;
|
private RightLabel job_type_label;
|
||||||
|
|
||||||
private ComboBox unit_type_combo_box;
|
private ComboBox unit_type_combo_box;
|
||||||
|
private CheckButton inactive_checkbox;
|
||||||
|
|
||||||
public MainWindow() throws IOError {
|
public MainWindow() throws IOError {
|
||||||
title = user ? "systemd User Service Manager" : "systemd System Manager";
|
title = user ? "systemd User Service Manager" : "systemd System Manager";
|
||||||
@ -123,18 +138,24 @@ public class MainWindow : Window {
|
|||||||
type_hbox.pack_start(unit_type_combo_box, false, false, 0);
|
type_hbox.pack_start(unit_type_combo_box, false, false, 0);
|
||||||
unit_vbox.pack_start(type_hbox, false, false, 0);
|
unit_vbox.pack_start(type_hbox, false, false, 0);
|
||||||
|
|
||||||
unit_type_combo_box.append_text("Show All Units");
|
unit_type_combo_box.append_text("All unit types");
|
||||||
unit_type_combo_box.append_text("Show Only Live Units");
|
unit_type_combo_box.append_text("Targets");
|
||||||
unit_type_combo_box.append_text("Services");
|
unit_type_combo_box.append_text("Services");
|
||||||
unit_type_combo_box.append_text("Sockets");
|
|
||||||
unit_type_combo_box.append_text("Devices");
|
unit_type_combo_box.append_text("Devices");
|
||||||
unit_type_combo_box.append_text("Mounts");
|
unit_type_combo_box.append_text("Mounts");
|
||||||
unit_type_combo_box.append_text("Automounts");
|
unit_type_combo_box.append_text("Automounts");
|
||||||
unit_type_combo_box.append_text("Targets");
|
unit_type_combo_box.append_text("Swaps");
|
||||||
|
unit_type_combo_box.append_text("Sockets");
|
||||||
|
unit_type_combo_box.append_text("Paths");
|
||||||
|
unit_type_combo_box.append_text("Timers");
|
||||||
unit_type_combo_box.append_text("Snapshots");
|
unit_type_combo_box.append_text("Snapshots");
|
||||||
unit_type_combo_box.set_active(1);
|
unit_type_combo_box.set_active(0); // Show All
|
||||||
unit_type_combo_box.changed.connect(unit_type_changed);
|
unit_type_combo_box.changed.connect(unit_type_changed);
|
||||||
|
|
||||||
|
inactive_checkbox = new CheckButton.with_label("inactive too");
|
||||||
|
inactive_checkbox.toggled.connect(unit_type_changed);
|
||||||
|
type_hbox.pack_start(inactive_checkbox, false, false, 0);
|
||||||
|
|
||||||
unit_load_entry = new Entry();
|
unit_load_entry = new Entry();
|
||||||
unit_load_button = new Button.with_mnemonic("_Load");
|
unit_load_button = new Button.with_mnemonic("_Load");
|
||||||
unit_load_button.set_sensitive(false);
|
unit_load_button.set_sensitive(false);
|
||||||
@ -160,26 +181,30 @@ public class MainWindow : Window {
|
|||||||
unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit));
|
unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit));
|
||||||
job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32));
|
job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32));
|
||||||
|
|
||||||
|
unit_map = new Gee.HashMap<string, Unit>();
|
||||||
|
|
||||||
TreeModelFilter unit_model_filter;
|
TreeModelFilter unit_model_filter;
|
||||||
unit_model_filter = new TreeModelFilter(unit_model, null);
|
unit_model_filter = new TreeModelFilter(unit_model, null);
|
||||||
unit_model_filter.set_visible_func(unit_filter);
|
unit_model_filter.set_visible_func(unit_filter);
|
||||||
|
|
||||||
unit_view = new TreeView.with_model(unit_model_filter);
|
TreeModelSort unit_model_sort = new TreeModelSort.with_model(unit_model_filter);
|
||||||
|
|
||||||
|
unit_view = new TreeView.with_model(unit_model_sort);
|
||||||
job_view = new TreeView.with_model(job_model);
|
job_view = new TreeView.with_model(job_model);
|
||||||
|
|
||||||
unit_view.cursor_changed.connect(unit_changed);
|
unit_view.cursor_changed.connect(unit_changed);
|
||||||
job_view.cursor_changed.connect(job_changed);
|
job_view.cursor_changed.connect(job_changed);
|
||||||
|
|
||||||
unit_view.insert_column_with_attributes(-1, "Load State", new CellRendererText(), "text", 2);
|
new_column(unit_view, 2, "Load State");
|
||||||
unit_view.insert_column_with_attributes(-1, "Active State", new CellRendererText(), "text", 3);
|
new_column(unit_view, 3, "Active State");
|
||||||
unit_view.insert_column_with_attributes(-1, "Unit State", new CellRendererText(), "text", 4);
|
new_column(unit_view, 4, "Unit State");
|
||||||
unit_view.insert_column_with_attributes(-1, "Unit", new CellRendererText(), "text", 0);
|
new_column(unit_view, 0, "Unit");
|
||||||
unit_view.insert_column_with_attributes(-1, "Job", new CellRendererText(), "text", 5);
|
new_column(unit_view, 5, "Job");
|
||||||
|
|
||||||
job_view.insert_column_with_attributes(-1, "Job", new CellRendererText(), "text", 0);
|
new_column(job_view, 0, "Job");
|
||||||
job_view.insert_column_with_attributes(-1, "Unit", new CellRendererText(), "text", 1);
|
new_column(job_view, 1, "Unit");
|
||||||
job_view.insert_column_with_attributes(-1, "Type", new CellRendererText(), "text", 2);
|
new_column(job_view, 2, "Type");
|
||||||
job_view.insert_column_with_attributes(-1, "State", new CellRendererText(), "text", 3);
|
new_column(job_view, 3, "State");
|
||||||
|
|
||||||
ScrolledWindow scroll = new ScrolledWindow(null, null);
|
ScrolledWindow scroll = new ScrolledWindow(null, null);
|
||||||
scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
|
scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
|
||||||
@ -194,7 +219,6 @@ public class MainWindow : Window {
|
|||||||
job_vbox.pack_start(scroll, true, true, 0);
|
job_vbox.pack_start(scroll, true, true, 0);
|
||||||
|
|
||||||
unit_id_label = new RightLabel();
|
unit_id_label = new RightLabel();
|
||||||
unit_aliases_label = new RightLabel();
|
|
||||||
unit_dependency_label = new RightLabel();
|
unit_dependency_label = new RightLabel();
|
||||||
unit_description_label = new RightLabel();
|
unit_description_label = new RightLabel();
|
||||||
unit_load_state_label = new RightLabel();
|
unit_load_state_label = new RightLabel();
|
||||||
@ -212,7 +236,7 @@ public class MainWindow : Window {
|
|||||||
job_type_label = new RightLabel();
|
job_type_label = new RightLabel();
|
||||||
|
|
||||||
unit_dependency_label.set_track_visited_links(false);
|
unit_dependency_label.set_track_visited_links(false);
|
||||||
unit_dependency_label.set_selectable(false);
|
unit_dependency_label.set_selectable(true);
|
||||||
unit_dependency_label.activate_link.connect(on_activate_link);
|
unit_dependency_label.activate_link.connect(on_activate_link);
|
||||||
|
|
||||||
unit_fragment_path_label.set_track_visited_links(false);
|
unit_fragment_path_label.set_track_visited_links(false);
|
||||||
@ -229,33 +253,31 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
unit_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_id_label, 1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_id_label, 1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Aliases:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Description:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_aliases_label, 1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_description_label, 1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Description:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Dependencies:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_description_label, 1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_dependency_label, 1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Dependencies:"), 0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Fragment Path:"), 0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_dependency_label, 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_fragment_path_label, 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Fragment Path:"), 0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Control Group:"), 0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_fragment_path_label, 1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_cgroup_label, 1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Control Group:"), 0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
|
||||||
unit_table.attach(unit_cgroup_label, 1, 6, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
|
||||||
|
|
||||||
unit_table.attach(new LeftLabel("Load State:"), 0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Load State:"), 0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_load_state_label, 1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_load_state_label, 1, 2, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Active State:"), 0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Active State:"), 0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_active_state_label, 1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_active_state_label, 1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Unit State:"), 0, 1, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Unit State:"), 0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_sub_state_label, 1, 2, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_sub_state_label, 1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
|
|
||||||
unit_table.attach(new LeftLabel("Active Enter Timestamp:"), 2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Activated:"), 2, 3, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_active_enter_timestamp_label, 3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_active_enter_timestamp_label, 3, 4, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Active Exit Timestamp:"), 2, 3, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Deactivated:"), 2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_active_exit_timestamp_label, 3, 4, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_active_exit_timestamp_label, 3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
|
|
||||||
unit_table.attach(new LeftLabel("Can Start/Stop:"), 4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Can Start/Stop:"), 4, 5, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_can_start_label, 5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_can_start_label, 5, 6, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(new LeftLabel("Can Reload:"), 4, 5, 8, 9, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(new LeftLabel("Can Reload:"), 4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
unit_table.attach(unit_can_reload_label, 5, 6, 8, 9, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
unit_table.attach(unit_can_reload_label, 5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
|
|
||||||
job_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
job_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
job_table.attach(job_id_label, 1, 2, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
job_table.attach(job_id_label, 1, 2, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0);
|
||||||
@ -333,6 +355,8 @@ public class MainWindow : Window {
|
|||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
i.unit_path);
|
i.unit_path);
|
||||||
|
|
||||||
|
unit_map[i.id] = u;
|
||||||
|
|
||||||
unit_model.append(out iter);
|
unit_model.append(out iter);
|
||||||
unit_model.set(iter,
|
unit_model.set(iter,
|
||||||
0, i.id,
|
0, i.id,
|
||||||
@ -393,6 +417,10 @@ public class MainWindow : Window {
|
|||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Unit? get_unit(string id) {
|
||||||
|
return this.unit_map[id];
|
||||||
|
}
|
||||||
|
|
||||||
public void unit_changed() {
|
public void unit_changed() {
|
||||||
Unit u = get_current_unit();
|
Unit u = get_current_unit();
|
||||||
|
|
||||||
@ -411,7 +439,6 @@ public class MainWindow : Window {
|
|||||||
restart_button.set_sensitive(false);
|
restart_button.set_sensitive(false);
|
||||||
|
|
||||||
unit_id_label.set_text_or_na();
|
unit_id_label.set_text_or_na();
|
||||||
unit_aliases_label.set_text_or_na();
|
|
||||||
unit_description_label.set_text_or_na();
|
unit_description_label.set_text_or_na();
|
||||||
unit_description_label.set_text_or_na();
|
unit_description_label.set_text_or_na();
|
||||||
unit_load_state_label.set_text_or_na();
|
unit_load_state_label.set_text_or_na();
|
||||||
@ -425,7 +452,33 @@ public class MainWindow : Window {
|
|||||||
unit_cgroup_label.set_text_or_na();
|
unit_cgroup_label.set_text_or_na();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string format_unit_link(string i, bool link) {
|
||||||
|
Unit? u = get_unit(i);
|
||||||
|
if(u == null)
|
||||||
|
return "<span color='grey'>" + i + "</span";
|
||||||
|
|
||||||
|
string color;
|
||||||
|
switch (u.sub_state) {
|
||||||
|
case "active": color = "blue"; break;
|
||||||
|
case "dead": color = "red"; break;
|
||||||
|
case "running": color = "green"; break;
|
||||||
|
default: color = "black"; break;
|
||||||
|
}
|
||||||
|
string span = "<span underline='none' color='" + color + "'>"
|
||||||
|
+ i + "(" +
|
||||||
|
u.sub_state + ")" + "</span>";
|
||||||
|
if(link)
|
||||||
|
return " <a href='" + i + "'>" + span + "</a>";
|
||||||
|
else
|
||||||
|
return span;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string make_dependency_string(string? prefix, string word, string[] dependencies) {
|
public string make_dependency_string(string? prefix, string word, string[] dependencies) {
|
||||||
|
Gee.Collection<unowned string> sorted = new Gee.TreeSet<string>();
|
||||||
|
foreach (string i in dependencies)
|
||||||
|
sorted.add(i);
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
string r;
|
string r;
|
||||||
|
|
||||||
@ -434,16 +487,16 @@ public class MainWindow : Window {
|
|||||||
else
|
else
|
||||||
r = prefix;
|
r = prefix;
|
||||||
|
|
||||||
foreach (string i in dependencies) {
|
foreach (string i in sorted) {
|
||||||
if (r != "")
|
if (r != "")
|
||||||
r += first ? "\n" : ",";
|
r += first ? "\n" : ",";
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
r += word;
|
r += "<b>" + word + ":</b>";
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
r += " <a href=\"" + i + "\">" + i + "</a>";
|
r += format_unit_link(i, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@ -452,20 +505,23 @@ public class MainWindow : Window {
|
|||||||
public void show_unit(Unit unit) {
|
public void show_unit(Unit unit) {
|
||||||
current_unit_id = unit.id;
|
current_unit_id = unit.id;
|
||||||
|
|
||||||
unit_id_label.set_text_or_na(current_unit_id);
|
string id_display = format_unit_link(current_unit_id, false);
|
||||||
|
bool has_alias = false;
|
||||||
string a = "";
|
|
||||||
foreach (string i in unit.names) {
|
foreach (string i in unit.names) {
|
||||||
if (i == current_unit_id)
|
if (i == current_unit_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (a == "")
|
if (!has_alias) {
|
||||||
a = i;
|
id_display += " (aliases:";
|
||||||
else
|
has_alias = true;
|
||||||
a += "\n" + i;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
unit_aliases_label.set_text_or_na(a);
|
id_display += " " + i;
|
||||||
|
}
|
||||||
|
if(has_alias)
|
||||||
|
id_display += ")";
|
||||||
|
|
||||||
|
unit_id_label.set_markup_or_na(id_display);
|
||||||
|
|
||||||
string[]
|
string[]
|
||||||
requires = unit.requires,
|
requires = unit.requires,
|
||||||
@ -511,23 +567,16 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
string fp = unit.fragment_path;
|
string fp = unit.fragment_path;
|
||||||
if (fp != "")
|
if (fp != "")
|
||||||
unit_fragment_path_label.set_markup_or_na("<a href=\"file://" + fp +"\">" + fp + "</a>" );
|
unit_fragment_path_label.set_markup_or_na(
|
||||||
|
"<a href=\"file://" + fp +"\">" +
|
||||||
|
"<span underline='none' color='black'>" + fp + "</span></a>");
|
||||||
else
|
else
|
||||||
unit_fragment_path_label.set_text_or_na();
|
unit_fragment_path_label.set_text_or_na();
|
||||||
|
|
||||||
uint64 t = unit.active_enter_timestamp;
|
|
||||||
if (t > 0) {
|
|
||||||
Time timestamp = Time.local((time_t) (t / 1000000));
|
|
||||||
unit_active_enter_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
|
|
||||||
} else
|
|
||||||
unit_active_enter_timestamp_label.set_text_or_na();
|
|
||||||
|
|
||||||
t = unit.active_exit_timestamp;
|
unit_active_enter_timestamp_label.set_text_or_na(format_time(unit.active_enter_timestamp));
|
||||||
if (t > 0) {
|
|
||||||
Time timestamp = Time.local((time_t) (t / 1000000));
|
unit_active_exit_timestamp_label.set_text_or_na(format_time(unit.active_exit_timestamp));
|
||||||
unit_active_exit_timestamp_label.set_text_or_na(timestamp.format("%a, %d %b %Y %H:%M:%S %z"));
|
|
||||||
} else
|
|
||||||
unit_active_exit_timestamp_label.set_text_or_na();
|
|
||||||
|
|
||||||
bool b = unit.can_start;
|
bool b = unit.can_start;
|
||||||
start_button.set_sensitive(b);
|
start_button.set_sensitive(b);
|
||||||
@ -596,7 +645,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
u.start("replace");
|
u.start("replace");
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,7 +658,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
u.stop("replace");
|
u.stop("replace");
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,7 +671,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
u.reload("replace");
|
u.reload("replace");
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,7 +684,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
u.restart("replace");
|
u.restart("replace");
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -648,7 +697,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
j.cancel();
|
j.cancel();
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,7 +725,7 @@ public class MainWindow : Window {
|
|||||||
4, u.sub_state,
|
4, u.sub_state,
|
||||||
5, t != "" ? "→ %s".printf(t) : "",
|
5, t != "" ? "→ %s".printf(t) : "",
|
||||||
6, u);
|
6, u);
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,8 +748,10 @@ public class MainWindow : Window {
|
|||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
path);
|
path);
|
||||||
|
|
||||||
|
unit_map[id] = u;
|
||||||
|
|
||||||
update_unit_iter(iter, id, u);
|
update_unit_iter(iter, id, u);
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -736,7 +787,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
update_job_iter(iter, id, j);
|
update_job_iter(iter, id, j);
|
||||||
|
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -760,6 +811,8 @@ public class MainWindow : Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} while (unit_model.iter_next(ref iter));
|
} while (unit_model.iter_next(ref iter));
|
||||||
|
|
||||||
|
unit_map.unset(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_job_removed(uint32 id, ObjectPath path, string res) {
|
public void on_job_removed(uint32 id, ObjectPath path, string res) {
|
||||||
@ -816,7 +869,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
} while (unit_model.iter_next(ref iter));
|
} while (unit_model.iter_next(ref iter));
|
||||||
|
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -852,7 +905,7 @@ public class MainWindow : Window {
|
|||||||
|
|
||||||
} while (job_model.iter_next(ref iter));
|
} while (job_model.iter_next(ref iter));
|
||||||
|
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -865,41 +918,41 @@ public class MainWindow : Window {
|
|||||||
if (id == null)
|
if (id == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!inactive_checkbox.get_active()
|
||||||
|
&& active_state == "inactive" && job == "")
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (unit_type_combo_box.get_active()) {
|
switch (unit_type_combo_box.get_active()) {
|
||||||
|
case 0:
|
||||||
case 0:
|
return true;
|
||||||
return true;
|
case 1:
|
||||||
|
return id.has_suffix(".target");
|
||||||
case 1:
|
case 2:
|
||||||
return active_state != "inactive" || job != "";
|
return id.has_suffix(".service");
|
||||||
|
case 3:
|
||||||
case 2:
|
return id.has_suffix(".device");
|
||||||
return id.has_suffix(".service");
|
case 4:
|
||||||
|
return id.has_suffix(".mount");
|
||||||
case 3:
|
case 5:
|
||||||
return id.has_suffix(".socket");
|
return id.has_suffix(".automount");
|
||||||
|
case 6:
|
||||||
case 4:
|
return id.has_suffix(".swap");
|
||||||
return id.has_suffix(".device");
|
case 7:
|
||||||
|
return id.has_suffix(".socket");
|
||||||
case 5:
|
case 8:
|
||||||
return id.has_suffix(".mount");
|
return id.has_suffix(".path");
|
||||||
|
case 9:
|
||||||
case 6:
|
return id.has_suffix(".timer");
|
||||||
return id.has_suffix(".automount");
|
case 10:
|
||||||
|
return id.has_suffix(".snapshot");
|
||||||
case 7:
|
default:
|
||||||
return id.has_suffix(".target");
|
assert(false);
|
||||||
|
return false;
|
||||||
case 8:
|
|
||||||
return id.has_suffix(".snapshot");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unit_type_changed() {
|
public void unit_type_changed() {
|
||||||
TreeModelFilter model = (TreeModelFilter) unit_view.get_model();
|
TreeModelFilter model = (TreeModelFilter) ((TreeModelSort) unit_view.get_model()).get_model();
|
||||||
|
|
||||||
model.refilter();
|
model.refilter();
|
||||||
}
|
}
|
||||||
@ -907,7 +960,7 @@ public class MainWindow : Window {
|
|||||||
public void on_server_reload() {
|
public void on_server_reload() {
|
||||||
try {
|
try {
|
||||||
manager.reload();
|
manager.reload();
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -919,7 +972,7 @@ public class MainWindow : Window {
|
|||||||
if (unit_type_combo_box.get_active() != 0)
|
if (unit_type_combo_box.get_active() != 0)
|
||||||
unit_type_combo_box.set_active(8);
|
unit_type_combo_box.set_active(8);
|
||||||
|
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -948,7 +1001,7 @@ public class MainWindow : Window {
|
|||||||
m.destroy();
|
m.destroy();
|
||||||
|
|
||||||
show_unit(u);
|
show_unit(u);
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -968,7 +1021,7 @@ public class MainWindow : Window {
|
|||||||
path);
|
path);
|
||||||
|
|
||||||
show_unit(u);
|
show_unit(u);
|
||||||
} catch (IOError e) {
|
} catch (Error e) {
|
||||||
show_error(e.message);
|
show_error(e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
# This file is part of systemd.
|
|
||||||
#
|
|
||||||
# Copyright 2010 Ran Benita
|
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# systemd is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
__contains_word () {
|
|
||||||
local word=$1; shift
|
|
||||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
__filter_units_by_property () {
|
|
||||||
local property=$1 value=$2 ; shift ; shift
|
|
||||||
local -a units=( $* )
|
|
||||||
local -a props=( $(systemctl show --property "$property" -- ${units[*]} | grep -v ^$) )
|
|
||||||
for ((i=0; $i < ${#units[*]}; i++)); do
|
|
||||||
if [[ "${props[i]}" = "$property=$value" ]]; then
|
|
||||||
echo "${units[i]}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
__get_all_units () { systemctl list-units --full --all | awk ' {print $1}' ; }
|
|
||||||
__get_active_units () { systemctl list-units --full | awk ' {print $1}' ; }
|
|
||||||
__get_inactive_units () { systemctl list-units --full --all | awk '$3 == "inactive" {print $1}' ; }
|
|
||||||
__get_failed_units () { systemctl list-units --full | awk '$3 == "failed" {print $1}' ; }
|
|
||||||
|
|
||||||
_systemctl () {
|
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
||||||
local verb comps
|
|
||||||
|
|
||||||
local -A OPTS=(
|
|
||||||
[STANDALONE]='--all -a --defaults --fail --ignore-dependencies --failed --force -f --full --global
|
|
||||||
--help -h --no-ask-password --no-block --no-pager --no-reload --no-wall
|
|
||||||
--order --require --quiet -q --privileged -P --system --user --version'
|
|
||||||
[ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t'
|
|
||||||
)
|
|
||||||
|
|
||||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
|
||||||
case $prev in
|
|
||||||
--signal|-s)
|
|
||||||
comps=$(compgen -A signal | grep '^SIG' | grep -Ev 'RTMIN|RTMAX|JUNK')
|
|
||||||
;;
|
|
||||||
--type|-t)
|
|
||||||
comps='automount device mount path service snapshot socket swap target timer'
|
|
||||||
;;
|
|
||||||
--kill-who)
|
|
||||||
comps='all control main'
|
|
||||||
;;
|
|
||||||
--kill-mode)
|
|
||||||
comps='control-group process'
|
|
||||||
;;
|
|
||||||
--property|-p|--host|-H)
|
|
||||||
comps=''
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$cur" = -* ]]; then
|
|
||||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- "$cur") )
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local -A VERBS=(
|
|
||||||
[ALL_UNITS]='enable disable is-active is-enabled status show'
|
|
||||||
[FAILED_UNITS]='reset-failed'
|
|
||||||
[STARTABLE_UNITS]='start'
|
|
||||||
[STOPPABLE_UNITS]='stop kill try-restart condrestart'
|
|
||||||
[ISOLATABLE_UNITS]='isolate'
|
|
||||||
[RELOADABLE_UNITS]='reload reload-or-try-restart force-reload'
|
|
||||||
[RESTARTABLE_UNITS]='restart reload-or-restart'
|
|
||||||
[JOBS]='cancel'
|
|
||||||
[SNAPSHOTS]='delete'
|
|
||||||
[ENVS]='set-environment unset-environment'
|
|
||||||
[STANDALONE]='daemon-reexec daemon-reload default dot dump emergency exit halt kexec
|
|
||||||
list-jobs list-units poweroff reboot rescue show-environment'
|
|
||||||
[NAME]='snapshot load'
|
|
||||||
)
|
|
||||||
|
|
||||||
local verb
|
|
||||||
for ((i=0; $i <= $COMP_CWORD; i++)); do
|
|
||||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
|
||||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
|
|
||||||
verb=${COMP_WORDS[i]}
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z $verb ]]; then
|
|
||||||
comps="${VERBS[*]}"
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
|
|
||||||
comps=$( __get_all_units )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
|
|
||||||
comps=$( __filter_units_by_property CanStart yes \
|
|
||||||
$( __get_inactive_units | grep -Ev '\.(device|snapshot)$' ))
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
|
|
||||||
comps=$( __filter_units_by_property CanStart yes \
|
|
||||||
$( __get_all_units | grep -Ev '\.(device|snapshot|socket|timer)$' ))
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
|
|
||||||
comps=$( __filter_units_by_property CanStop yes \
|
|
||||||
$( __get_active_units ) )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
|
|
||||||
comps=$( __filter_units_by_property CanReload yes \
|
|
||||||
$( __get_active_units ) )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
|
|
||||||
comps=$( __filter_units_by_property AllowIsolate yes \
|
|
||||||
$( __get_all_units ) )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
|
|
||||||
comps=$( __get_failed_units )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
|
|
||||||
comps=''
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[JOBS]}; then
|
|
||||||
comps=$( systemctl list-jobs | awk '{print $1}' )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then
|
|
||||||
comps=$( systemctl list-units --type snapshot --full --all | awk '{print $1}' )
|
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[ENVS]}; then
|
|
||||||
comps=$( systemctl show-environment | sed 's_\([^=]\+=\).*_\1_' )
|
|
||||||
compopt -o nospace
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _systemctl systemctl
|
|
@ -551,11 +551,30 @@ static bool output_show_unit_file(const UnitFileList *u) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void output_unit_file_list(const UnitFileList *units, unsigned c) {
|
static void output_unit_file_list(const UnitFileList *units, unsigned c) {
|
||||||
unsigned n_shown = 0;
|
unsigned max_id_len, id_cols, state_cols, n_shown = 0;
|
||||||
const UnitFileList *u;
|
const UnitFileList *u;
|
||||||
|
|
||||||
if (on_tty())
|
max_id_len = sizeof("UNIT FILE")-1;
|
||||||
printf("%-25s %-6s\n", "UNIT FILE", "STATE");
|
state_cols = sizeof("STATE")-1;
|
||||||
|
for (u = units; u < units + c; u++) {
|
||||||
|
if (!output_show_unit_file(u))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
max_id_len = MAX(max_id_len, strlen(file_name_from_path(u->path)));
|
||||||
|
state_cols = MAX(state_cols, strlen(unit_file_state_to_string(u->state)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arg_full) {
|
||||||
|
unsigned basic_cols;
|
||||||
|
id_cols = MIN(max_id_len, 25);
|
||||||
|
basic_cols = 1 + id_cols + state_cols;
|
||||||
|
if (basic_cols < (unsigned) columns())
|
||||||
|
id_cols += MIN(columns() - basic_cols, max_id_len - id_cols);
|
||||||
|
} else
|
||||||
|
id_cols = max_id_len;
|
||||||
|
|
||||||
|
if (!arg_no_legend)
|
||||||
|
printf("%-*s %-*s\n", id_cols, "UNIT FILE", state_cols, "STATE");
|
||||||
|
|
||||||
for (u = units; u < units + c; u++) {
|
for (u = units; u < units + c; u++) {
|
||||||
char *e;
|
char *e;
|
||||||
@ -580,16 +599,16 @@ static void output_unit_file_list(const UnitFileList *units, unsigned c) {
|
|||||||
|
|
||||||
id = file_name_from_path(u->path);
|
id = file_name_from_path(u->path);
|
||||||
|
|
||||||
e = arg_full ? NULL : ellipsize(id, 25, 33);
|
e = arg_full ? NULL : ellipsize(id, id_cols, 33);
|
||||||
|
|
||||||
printf("%-25s %s%-6s%s\n",
|
printf("%-*s %s%-*s%s\n",
|
||||||
e ? e : id,
|
id_cols, e ? e : id,
|
||||||
on, unit_file_state_to_string(u->state), off);
|
on, state_cols, unit_file_state_to_string(u->state), off);
|
||||||
|
|
||||||
free(e);
|
free(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (on_tty())
|
if (!arg_no_legend)
|
||||||
printf("\n%u unit files listed.\n", n_shown);
|
printf("\n%u unit files listed.\n", n_shown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3443,7 +3462,7 @@ finish:
|
|||||||
static int enable_sysv_units(char **args) {
|
static int enable_sysv_units(char **args) {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX))
|
#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX) || defined(TARGET_MAGEIA))
|
||||||
const char *verb = args[0];
|
const char *verb = args[0];
|
||||||
unsigned f = 1, t = 1;
|
unsigned f = 1, t = 1;
|
||||||
LookupPaths paths;
|
LookupPaths paths;
|
||||||
|
264
src/systemd-bash-completion.sh
Normal file
264
src/systemd-bash-completion.sh
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# Copyright 2010 Ran Benita
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# systemd is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
__systemctl() {
|
||||||
|
systemctl --full --no-legend "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
__contains_word () {
|
||||||
|
local word=$1; shift
|
||||||
|
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
__filter_units_by_property () {
|
||||||
|
local property=$1 value=$2 ; shift ; shift
|
||||||
|
local -a units=( $* )
|
||||||
|
local -a props=( $(__systemctl show --property "$property" -- ${units[*]} | grep -v ^$) )
|
||||||
|
for ((i=0; $i < ${#units[*]}; i++)); do
|
||||||
|
if [[ "${props[i]}" = "$property=$value" ]]; then
|
||||||
|
echo "${units[i]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
__get_all_units () { __systemctl list-units --all | awk ' {print $1}' ; }
|
||||||
|
__get_active_units () { __systemctl list-units | awk ' {print $1}' ; }
|
||||||
|
__get_inactive_units () { __systemctl list-units --all | awk '$3 == "inactive" {print $1}' ; }
|
||||||
|
__get_failed_units () { __systemctl list-units | awk '$3 == "failed" {print $1}' ; }
|
||||||
|
__get_enabled_units () { __systemctl list-unit-files | awk '$2 == "enabled" {print $1}' ; }
|
||||||
|
__get_disabled_units () { __systemctl list-unit-files | awk '$2 == "disabled" {print $1}' ; }
|
||||||
|
__get_masked_units () { __systemctl list-unit-files | awk '$2 == "masked" {print $1}' ; }
|
||||||
|
|
||||||
|
_systemctl () {
|
||||||
|
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
local verb comps
|
||||||
|
|
||||||
|
local -A OPTS=(
|
||||||
|
[STANDALONE]='--all -a --defaults --fail --ignore-dependencies --failed --force -f --full --global
|
||||||
|
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
|
||||||
|
--order --require --quiet -q --privileged -P --system --user --version --runtime'
|
||||||
|
[ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --root'
|
||||||
|
)
|
||||||
|
|
||||||
|
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||||
|
case $prev in
|
||||||
|
--signal|-s)
|
||||||
|
comps=$(compgen -A signal)
|
||||||
|
;;
|
||||||
|
--type|-t)
|
||||||
|
comps='automount device mount path service snapshot socket swap target timer'
|
||||||
|
;;
|
||||||
|
--kill-who)
|
||||||
|
comps='all control main'
|
||||||
|
;;
|
||||||
|
--kill-mode)
|
||||||
|
comps='control-group process'
|
||||||
|
;;
|
||||||
|
--root)
|
||||||
|
comps=$(compgen -A directory -- "$cur" )
|
||||||
|
compopt -o filenames
|
||||||
|
;;
|
||||||
|
--host|-H)
|
||||||
|
comps=$(compgen -A hostname)
|
||||||
|
;;
|
||||||
|
--property|-p)
|
||||||
|
comps=''
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$cur" = -* ]]; then
|
||||||
|
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local -A VERBS=(
|
||||||
|
[ALL_UNITS]='is-active is-enabled status show mask preset'
|
||||||
|
[ENABLED_UNITS]='disable reenable'
|
||||||
|
[DISABLED_UNITS]='enable'
|
||||||
|
[FAILED_UNITS]='reset-failed'
|
||||||
|
[STARTABLE_UNITS]='start'
|
||||||
|
[STOPPABLE_UNITS]='stop condstop kill try-restart condrestart'
|
||||||
|
[ISOLATABLE_UNITS]='isolate'
|
||||||
|
[RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
|
||||||
|
[RESTARTABLE_UNITS]='restart reload-or-restart'
|
||||||
|
[MASKED_UNITS]='unmask'
|
||||||
|
[JOBS]='cancel'
|
||||||
|
[SNAPSHOTS]='delete'
|
||||||
|
[ENVS]='set-environment unset-environment'
|
||||||
|
[STANDALONE]='daemon-reexec daemon-reload default dot dump
|
||||||
|
emergency exit halt kexec list-jobs list-units
|
||||||
|
list-unit-files poweroff reboot rescue show-environment'
|
||||||
|
[NAME]='snapshot load'
|
||||||
|
[FILE]='link'
|
||||||
|
)
|
||||||
|
|
||||||
|
for ((i=0; $i <= $COMP_CWORD; i++)); do
|
||||||
|
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||||
|
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
|
||||||
|
verb=${COMP_WORDS[i]}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $verb ]]; then
|
||||||
|
comps="${VERBS[*]}"
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
|
||||||
|
comps=$( __get_all_units )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
|
||||||
|
comps=$( __get_enabled_units )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
|
||||||
|
comps=$( __get_disabled_units )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
|
||||||
|
comps=$( __filter_units_by_property CanStart yes \
|
||||||
|
$( __get_inactive_units | grep -Ev '\.(device|snapshot)$' ))
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
|
||||||
|
comps=$( __filter_units_by_property CanStart yes \
|
||||||
|
$( __get_all_units | grep -Ev '\.(device|snapshot|socket|timer)$' ))
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
|
||||||
|
comps=$( __filter_units_by_property CanStop yes \
|
||||||
|
$( __get_active_units ) )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
|
||||||
|
comps=$( __filter_units_by_property CanReload yes \
|
||||||
|
$( __get_active_units ) )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
|
||||||
|
comps=$( __filter_units_by_property AllowIsolate yes \
|
||||||
|
$( __get_all_units ) )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
|
||||||
|
comps=$( __get_failed_units )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
|
||||||
|
comps=$( __get_masked_units )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
|
||||||
|
comps=''
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[JOBS]}; then
|
||||||
|
comps=$( __systemctl list-jobs | awk '{print $1}' )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then
|
||||||
|
comps=$( __systemctl list-units --type snapshot --full --all | awk '{print $1}' )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[ENVS]}; then
|
||||||
|
comps=$( __systemctl show-environment | sed 's_\([^=]\+=\).*_\1_' )
|
||||||
|
compopt -o nospace
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[FILE]}; then
|
||||||
|
comps=$( compgen -A file -- "$cur" )
|
||||||
|
compopt -o filenames
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _systemctl systemctl
|
||||||
|
|
||||||
|
__get_all_sessions () { systemd-loginctl list-sessions | awk '{print $1}' ; }
|
||||||
|
__get_all_users () { systemd-loginctl list-users | awk '{print $2}' ; }
|
||||||
|
__get_all_seats () { systemd-loginctl list-seats | awk '{print $1}' ; }
|
||||||
|
|
||||||
|
_systemd_loginctl () {
|
||||||
|
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
local verb comps
|
||||||
|
|
||||||
|
local -A OPTS=(
|
||||||
|
[STANDALONE]='--all -a --help -h --no-pager --privileged -P --version'
|
||||||
|
[ARG]='--host -H --kill-who --property -p --signal -s'
|
||||||
|
)
|
||||||
|
|
||||||
|
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||||
|
case $prev in
|
||||||
|
--signal|-s)
|
||||||
|
comps=$(compgen -A signal)
|
||||||
|
;;
|
||||||
|
--kill-who)
|
||||||
|
comps='all leader'
|
||||||
|
;;
|
||||||
|
--host|-H)
|
||||||
|
comps=$(compgen -A hostname)
|
||||||
|
;;
|
||||||
|
--property|-p)
|
||||||
|
comps=''
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$cur" = -* ]]; then
|
||||||
|
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local -A VERBS=(
|
||||||
|
[SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session'
|
||||||
|
[USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user'
|
||||||
|
[SEATS]='seat-status show-seat terminate-seat'
|
||||||
|
[STANDALONE]='list-sessions list-users list-seats flush-devices'
|
||||||
|
[ATTACH]='attach'
|
||||||
|
)
|
||||||
|
|
||||||
|
for ((i=0; $i <= $COMP_CWORD; i++)); do
|
||||||
|
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||||
|
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
|
||||||
|
verb=${COMP_WORDS[i]}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $verb ]]; then
|
||||||
|
comps="${VERBS[*]}"
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[SESSIONS]}; then
|
||||||
|
comps=$( __get_all_sessions )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[USERS]}; then
|
||||||
|
comps=$( __get_all_users )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[SEATS]}; then
|
||||||
|
comps=$( __get_all_seats )
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
|
||||||
|
comps=''
|
||||||
|
|
||||||
|
elif __contains_word "$verb" ${VERBS[ATTACH]}; then
|
||||||
|
if [[ $prev = $verb ]]; then
|
||||||
|
comps=$( __get_all_seats )
|
||||||
|
else
|
||||||
|
comps=$(compgen -A file -- "$cur" )
|
||||||
|
compopt -o filenames
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMPREPLY=( $(compgen -W "$comps" -- "$cur") )
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -F _systemd_loginctl systemd-loginctl
|
@ -206,6 +206,7 @@ static int ask_password_plymouth(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
memcpy(&size, buffer+1, sizeof(size));
|
memcpy(&size, buffer+1, sizeof(size));
|
||||||
|
size = le32toh(size);
|
||||||
if (size+5 > sizeof(buffer)) {
|
if (size+5 > sizeof(buffer)) {
|
||||||
r = -EIO;
|
r = -EIO;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -376,7 +376,10 @@ int main(int argc, char *argv[]) {
|
|||||||
umask(0022);
|
umask(0022);
|
||||||
|
|
||||||
#ifdef HAVE_AUDIT
|
#ifdef HAVE_AUDIT
|
||||||
if ((c.audit_fd = audit_open()) < 0)
|
if ((c.audit_fd = audit_open()) < 0 &&
|
||||||
|
/* If the kernel lacks netlink or audit support,
|
||||||
|
* don't worry about it. */
|
||||||
|
errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
|
||||||
log_error("Failed to connect to audit log: %m");
|
log_error("Failed to connect to audit log: %m");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ int main(int argc, char **argv) {
|
|||||||
#ifdef TARGET_GENTOO
|
#ifdef TARGET_GENTOO
|
||||||
char *vc_unicode = NULL;
|
char *vc_unicode = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TARGET_MANDRIVA
|
#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
|
||||||
char *vc_keytable = NULL;
|
char *vc_keytable = NULL;
|
||||||
#endif
|
#endif
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
@ -371,7 +371,7 @@ int main(int argc, char **argv) {
|
|||||||
log_warning("Failed to read /etc/conf.d/keymaps: %s", strerror(-r));
|
log_warning("Failed to read /etc/conf.d/keymaps: %s", strerror(-r));
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(TARGET_MANDRIVA)
|
#elif defined(TARGET_MANDRIVA) || defined (TARGET_MAGEIA)
|
||||||
|
|
||||||
if ((r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
|
if ((r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
|
||||||
"SYSFONT", &vc_font,
|
"SYSFONT", &vc_font,
|
||||||
|
73
src/wraplabel.vala
Normal file
73
src/wraplabel.vala
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// Copyright (c) 2005 VMware, Inc.
|
||||||
|
|
||||||
|
// This is a translation of http://git.gnome.org/browse/meld/tree/meld/ui/wraplabel.py,
|
||||||
|
// which in turn is a translation of WrapLabel from libview.
|
||||||
|
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
|
||||||
|
// Python translation from wrapLabel.{cc|h} by Gian Mario Tagliaretti
|
||||||
|
// Vala translation from wraplabel.py by Zbigniew Jędrzejewski-Szmek
|
||||||
|
|
||||||
|
public class WrapLabel : Gtk.Label {
|
||||||
|
private int _wrap_width;
|
||||||
|
|
||||||
|
public WrapLabel(string? text = null) {
|
||||||
|
this._wrap_width = 0;
|
||||||
|
var layout = get_layout();
|
||||||
|
layout.set_wrap(Pango.WrapMode.WORD_CHAR);
|
||||||
|
if (text != null)
|
||||||
|
this.set_text(text);
|
||||||
|
this.set_alignment(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void size_request(out Gtk.Requisition requisition) {
|
||||||
|
int width, height;
|
||||||
|
var layout = get_layout();
|
||||||
|
layout.get_pixel_size(out width, out height);
|
||||||
|
requisition.width = 0;
|
||||||
|
requisition.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void size_allocate(Gdk.Rectangle allocation) {
|
||||||
|
base.size_allocate (allocation);
|
||||||
|
this._set_wrap_width(allocation.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void set_text(string str) {
|
||||||
|
base.set_text(str);
|
||||||
|
this._set_wrap_width(this._wrap_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void set_markup(string str) {
|
||||||
|
base.set_markup(str);
|
||||||
|
this._set_wrap_width(this._wrap_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _set_wrap_width(int width) {
|
||||||
|
if (width == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var layout = get_layout();
|
||||||
|
layout.set_width(width * Pango.SCALE);
|
||||||
|
if (_wrap_width != width) {
|
||||||
|
this._wrap_width = width;
|
||||||
|
this.queue_resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,9 @@ After=rc-local.service
|
|||||||
m4_ifdef(`TARGET_MANDRIVA',
|
m4_ifdef(`TARGET_MANDRIVA',
|
||||||
After=rc-local.service
|
After=rc-local.service
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
|
m4_ifdef(`TARGET_MAGEIA',
|
||||||
|
After=rc-local.service
|
||||||
|
)m4_dnl
|
||||||
Before=getty.target
|
Before=getty.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
@ -24,6 +24,9 @@ After=rc-local.service
|
|||||||
m4_ifdef(`TARGET_MANDRIVA',
|
m4_ifdef(`TARGET_MANDRIVA',
|
||||||
After=rc-local.service
|
After=rc-local.service
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
|
m4_ifdef(`TARGET_MAGEIA',
|
||||||
|
After=rc-local.service
|
||||||
|
)m4_dnl
|
||||||
|
|
||||||
# If additional gettys are spawned during boot then we should make
|
# If additional gettys are spawned during boot then we should make
|
||||||
# sure that this is synchronized before getty.target, even though
|
# sure that this is synchronized before getty.target, even though
|
||||||
|
21
units/mageia/prefdm.service
Normal file
21
units/mageia/prefdm.service
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Display Manager
|
||||||
|
After=livesys-late.service rc-local.service systemd-user-sessions.service
|
||||||
|
After=network.target acpid.service fs.service haldaemon.service
|
||||||
|
|
||||||
|
# Do not stop plymouth, it is done in prefdm if required
|
||||||
|
Conflicts=plymouth-quit.service
|
||||||
|
After=plymouth-quit.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/etc/X11/prefdm
|
||||||
|
Type=forking
|
||||||
|
Restart=always
|
||||||
|
RestartSec=0
|
@ -10,6 +10,3 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Remote File Systems (Pre)
|
Description=Remote File Systems (Pre)
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
@ -25,10 +25,13 @@ ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
|||||||
m4_ifdef(`TARGET_MANDRIVA',
|
m4_ifdef(`TARGET_MANDRIVA',
|
||||||
`EnvironmentFile=/etc/sysconfig/init
|
`EnvironmentFile=/etc/sysconfig/init
|
||||||
ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
||||||
|
m4_ifdef(`TARGET_MAGEIA',
|
||||||
|
`EnvironmentFile=/etc/sysconfig/init
|
||||||
|
ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
||||||
m4_ifdef(`TARGET_MEEGO',
|
m4_ifdef(`TARGET_MEEGO',
|
||||||
`EnvironmentFile=/etc/sysconfig/init
|
`EnvironmentFile=/etc/sysconfig/init
|
||||||
ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
ExecStart=-/bin/bash -c "exec ${SINGLE}"',
|
||||||
`ExecStart=-/sbin/sulogin')))
|
`ExecStart=-/sbin/sulogin'))))
|
||||||
ExecStopPost=-/bin/systemctl --fail --no-block default
|
ExecStopPost=-/bin/systemctl --fail --no-block default
|
||||||
StandardInput=tty-force
|
StandardInput=tty-force
|
||||||
StandardOutput=inherit
|
StandardOutput=inherit
|
||||||
|
@ -24,6 +24,9 @@ After=rc-local.service
|
|||||||
m4_ifdef(`TARGET_MANDRIVA',
|
m4_ifdef(`TARGET_MANDRIVA',
|
||||||
After=rc-local.service
|
After=rc-local.service
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
|
m4_ifdef(`TARGET_MAGEIA',
|
||||||
|
After=rc-local.service
|
||||||
|
)m4_dnl
|
||||||
|
|
||||||
# If additional gettys are spawned during boot then we should make
|
# If additional gettys are spawned during boot then we should make
|
||||||
# sure that this is synchronized before getty.target, even though
|
# sure that this is synchronized before getty.target, even though
|
||||||
|
Loading…
Reference in New Issue
Block a user