[systemd-commits] 2 commits - src/hostname src/locale src/systemctl src/timedate
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Wed May 22 21:58:33 PDT 2013
src/hostname/hostnamectl.c | 6 +++---
src/locale/localectl.c | 12 ++++++++----
src/systemctl/systemctl.c | 22 +++++++++++-----------
src/timedate/timedatectl.c | 14 +++++++++-----
4 files changed, 31 insertions(+), 23 deletions(-)
New commits:
commit 3a05c0f96c88984b47ca2f77bbf67dd5048a47d8
Author: Václav PavlÃn <vpavlin at redhat.com>
Date: Fri May 17 16:03:36 2013 +0200
systemctl: mangle names when avoiding dbus
Unit names were mangled in function enable_unit only when dbus was
used. This patch adds mangling also when the dbus is not in use.
This makes it possible to say e.g.:
systemctl --root=/path enable cups
without spelling cups.service out in full.
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e6bd855..f8573d3 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4221,24 +4221,28 @@ static int enable_unit(DBusConnection *bus, char **args) {
if (!args[1])
return 0;
+ r = mangle_names(args+1, &mangled_names);
+ if (r < 0)
+ goto finish;
+
if (!bus || avoid_bus()) {
if (streq(verb, "enable")) {
- r = unit_file_enable(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
+ r = unit_file_enable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "disable"))
- r = unit_file_disable(arg_scope, arg_runtime, arg_root, args+1, &changes, &n_changes);
+ r = unit_file_disable(arg_scope, arg_runtime, arg_root, mangled_names, &changes, &n_changes);
else if (streq(verb, "reenable")) {
- r = unit_file_reenable(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
+ r = unit_file_reenable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "link"))
- r = unit_file_link(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
+ r = unit_file_link(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
else if (streq(verb, "preset")) {
- r = unit_file_preset(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
+ r = unit_file_preset(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
carries_install_info = r;
} else if (streq(verb, "mask"))
- r = unit_file_mask(arg_scope, arg_runtime, arg_root, args+1, arg_force, &changes, &n_changes);
+ r = unit_file_mask(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);
else if (streq(verb, "unmask"))
- r = unit_file_unmask(arg_scope, arg_runtime, arg_root, args+1, &changes, &n_changes);
+ r = unit_file_unmask(arg_scope, arg_runtime, arg_root, mangled_names, &changes, &n_changes);
else
assert_not_reached("Unknown verb");
@@ -4297,10 +4301,6 @@ static int enable_unit(DBusConnection *bus, char **args) {
dbus_message_iter_init_append(m, &iter);
- r = mangle_names(args+1, &mangled_names);
- if(r < 0)
- goto finish;
-
r = bus_append_strv_iter(&iter, mangled_names);
if (r < 0) {
log_error("Failed to append unit files.");
commit 546158bc6f46f8004cc11e81d19d223e0da56730
Author: Jan Janssen <medhefgo at web.de>
Date: Fri May 17 15:38:12 2013 +0200
Fix --no-ask-password
POSIX_ME_HARDER mode is disabled for localectl. It doesn't
make much sense in case of localectl, and there's little reason
for localectl to behave specially.
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 7acd772..d108a24 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -219,7 +219,7 @@ static int show_status(DBusConnection *bus, char **args, unsigned n) {
static int set_hostname(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true;
+ dbus_bool_t interactive = arg_ask_password;
_cleanup_free_ char *h = NULL;
const char *hostname = args[1];
int r;
@@ -311,7 +311,7 @@ static int set_hostname(DBusConnection *bus, char **args, unsigned n) {
static int set_icon_name(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true;
+ dbus_bool_t interactive = arg_ask_password;
assert(args);
assert(n == 2);
@@ -333,7 +333,7 @@ static int set_icon_name(DBusConnection *bus, char **args, unsigned n) {
static int set_chassis(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true;
+ dbus_bool_t interactive = arg_ask_password;
assert(args);
assert(n == 2);
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 3096d06..b5cd344 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -223,7 +223,7 @@ static int show_status(DBusConnection *bus, char **args, unsigned n) {
static int set_locale(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
- dbus_bool_t interactive = true;
+ dbus_bool_t interactive = arg_ask_password;
DBusError error;
DBusMessageIter iter;
int r;
@@ -459,7 +459,7 @@ static int list_locales(DBusConnection *bus, char **args, unsigned n) {
static int set_vconsole_keymap(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true, b;
+ dbus_bool_t interactive = arg_ask_password, b;
const char *map, *toggle_map;
assert(bus);
@@ -565,7 +565,7 @@ static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) {
static int set_x11_keymap(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true, b;
+ dbus_bool_t interactive = arg_ask_password, b;
const char *layout, *model, *variant, *options;
assert(bus);
@@ -758,7 +758,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "has:H:P", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hH:P", options, NULL)) >= 0) {
switch (c) {
@@ -788,6 +788,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_no_pager = true;
break;
+ case ARG_NO_ASK_PASSWORD:
+ arg_ask_password = false;
+ break;
+
case '?':
return -EINVAL;
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index be3b8b4..e8bc452 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -304,7 +304,7 @@ static int show_status(DBusConnection *bus, char **args, unsigned n) {
static int set_time(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t relative = false, interactive = true;
+ dbus_bool_t relative = false, interactive = arg_ask_password;
usec_t t;
dbus_int64_t u;
int r;
@@ -338,7 +338,7 @@ static int set_time(DBusConnection *bus, char **args, unsigned n) {
static int set_timezone(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true;
+ dbus_bool_t interactive = arg_ask_password;
assert(args);
assert(n == 2);
@@ -360,7 +360,7 @@ static int set_timezone(DBusConnection *bus, char **args, unsigned n) {
static int set_local_rtc(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true, b, q;
+ dbus_bool_t interactive = arg_ask_password, b, q;
int r;
assert(args);
@@ -393,7 +393,7 @@ static int set_local_rtc(DBusConnection *bus, char **args, unsigned n) {
static int set_ntp(DBusConnection *bus, char **args, unsigned n) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
- dbus_bool_t interactive = true, b;
+ dbus_bool_t interactive = arg_ask_password, b;
int r;
assert(args);
@@ -541,7 +541,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "+hH:P", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hH:P", options, NULL)) >= 0) {
switch (c) {
@@ -563,6 +563,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_host = optarg;
break;
+ case ARG_NO_ASK_PASSWORD:
+ arg_ask_password = false;
+ break;
+
case ARG_ADJUST_SYSTEM_CLOCK:
arg_adjust_system_clock = true;
break;
More information about the systemd-commits
mailing list