aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-06 05:58:22 -0400
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-06 05:59:16 -0400
commit806488a709394326f9ea8c1aa17f6815448e7780 (patch)
tree39f8530bcd51bfc16419d1086c5180ecf9176faf
parentUpdate README (diff)
downloadopenrc-settingsd-806488a709394326f9ea8c1aa17f6815448e7780.tar.gz
openrc-settingsd-806488a709394326f9ea8c1aa17f6815448e7780.tar.bz2
openrc-settingsd-806488a709394326f9ea8c1aa17f6815448e7780.zip
Prepare for installation and distribution
-rw-r--r--Makefile.am91
-rw-r--r--NEWS0
-rw-r--r--README16
-rw-r--r--TODO6
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac31
-rw-r--r--data/conf.d/openrc-settingsd8
-rwxr-xr-xdata/init.d/openrc-settingsd.in27
-rw-r--r--data/org.freedesktop.hostname1.policy37
-rw-r--r--data/org.freedesktop.hostname1.service.in4
-rw-r--r--data/org.freedesktop.hostname1.xml (renamed from data/hostname1.xml)2
-rw-r--r--data/org.freedesktop.locale1.policy27
-rw-r--r--data/org.freedesktop.locale1.service.in4
-rw-r--r--data/org.freedesktop.locale1.xml (renamed from data/locale1.xml)2
-rw-r--r--data/org.freedesktop.timedate1.policy47
-rw-r--r--data/org.freedesktop.timedate1.service.in4
-rw-r--r--data/org.freedesktop.timedate1.xml (renamed from data/timedate1.xml)2
17 files changed, 283 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am
index e12c3d7..dde27ad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,62 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
EXTRA_DIST = \
- data/hostname1.xml \
- data/locale1.xml \
- data/timedate1.xml \
+ data/org.freedesktop.hostname1.service.in \
+ data/org.freedesktop.locale1.service.in \
+ data/org.freedesktop.timedate1.service.in \
+ data/init.d/openrc-settingsd.in \
+ AUTHORS \
+ COPYING \
+ src/copypaste/COPYING.LGPL-2.1 \
+ README \
+ NEWS \
+ TODO \
$(NULL)
-pkgdata_DATA = \
+dist_pkgdata_DATA = \
data/kbd-model-map \
$(NULL)
+dbusinterfacesdir = @dbusinterfacesdir@
+dist_dbusinterfaces_DATA = \
+ data/org.freedesktop.hostname1.xml \
+ data/org.freedesktop.locale1.xml \
+ data/org.freedesktop.timedate1.xml \
+ $(NULL)
+
+dbusservicesdir = @dbussystemservicesdir@
+dbusservices_DATA = \
+ data/org.freedesktop.hostname1.service \
+ data/org.freedesktop.locale1.service \
+ data/org.freedesktop.timedate1.service \
+ $(NULL)
+
+polkitactiondir = @polkitactiondir@
+dist_polkitaction_DATA = \
+ data/org.freedesktop.hostname1.policy \
+ data/org.freedesktop.locale1.policy \
+ data/org.freedesktop.timedate1.policy \
+ $(NULL)
+
+initddir = $(sysconfdir)/init.d
+initd_SCRIPTS = data/init.d/openrc-settingsd
+
+confddir = $(sysconfdir)/conf.d
+dist_confd_DATA = data/conf.d/openrc-settingsd
+
+rootsbindir = @rootsbindir@
+
+do_subst = sed -e 's,[@]libexecdir[@],$(libexecdir),g' \
+ -e 's,[@]localstatedir[@],$(localstatedir),g' \
+ -e 's,[@]rootsbindir[@],$(rootsbindir),g' \
+ $(NULL)
+
+data/init.d/openrc-settingsd : data/init.d/openrc-settingsd.in
+ $(do_subst) < $(srcdir)/data/init.d/openrc-settingsd.in > $(top_srcdir)/data/init.d/openrc-settingsd
+
+%.service : %.service.in
+ $(do_subst) < $(srcdir)/$< > $(top_srcdir)/$@
+
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
@@ -49,9 +96,6 @@ copypaste_sources = \
$(NULL)
openrc_settingsd_SOURCES = \
- $(hostnamed_built_sources) \
- $(localed_built_sources) \
- $(timedated_built_sources) \
$(copypaste_sources) \
src/hostnamed.c \
src/hostnamed.h \
@@ -64,29 +108,46 @@ openrc_settingsd_SOURCES = \
src/main.c \
$(NULL)
-$(hostnamed_built_sources) : data/hostname1.xml
+nodist_openrc_settingsd_SOURCES = \
+ $(hostnamed_built_sources) \
+ $(localed_built_sources) \
+ $(timedated_built_sources) \
+ $(NULL)
+
+$(hostnamed_built_sources) : data/org.freedesktop.hostname1.xml
( $(GDBUS_CODEGEN) \
--interface-prefix org.freedesktop. \
--c-namespace OpenrcSettingsdHostnamed \
--generate-c-code hostname1-generated \
- $(srcdir)/data/hostname1.xml; \
+ $(srcdir)/data/org.freedesktop.hostname1.xml; \
mv hostname1-generated.{c,h} $(top_srcdir)/src/ )
-$(localed_built_sources) : data/locale1.xml
+$(localed_built_sources) : data/org.freedesktop.locale1.xml
( $(GDBUS_CODEGEN) \
--interface-prefix org.freedesktop. \
--c-namespace OpenrcSettingsdLocaled \
--generate-c-code locale1-generated \
- $(srcdir)/data/locale1.xml; \
+ $(srcdir)/data/org.freedesktop.locale1.xml; \
mv locale1-generated.{c,h} $(top_srcdir)/src/ )
-$(timedated_built_sources) : data/timedate1.xml
+$(timedated_built_sources) : data/org.freedesktop.timedate1.xml
( $(GDBUS_CODEGEN) \
--interface-prefix org.freedesktop. \
--c-namespace OpenrcSettingsdTimedated \
--generate-c-code timedate1-generated \
- $(srcdir)/data/timedate1.xml; \
+ $(srcdir)/data/org.freedesktop.timedate1.xml; \
mv timedate1-generated.{c,h} $(top_srcdir)/src/ )
-BUILT_SOURCES = $(hostnamed_built_sources) $(localed_built_sources) $(timedated_built_sources)
-CLEANFILES = $(hostnamed_built_sources) $(localed_built_sources) $(timedated_built_sources)
+BUILT_SOURCES = \
+ $(hostnamed_built_sources) \
+ $(localed_built_sources) \
+ $(timedated_built_sources) \
+ $(NULL)
+
+CLEANFILES = \
+ $(hostnamed_built_sources) \
+ $(localed_built_sources) \
+ $(timedated_built_sources) \
+ data/init.d/openrc-settingsd \
+ $(dbusservices_DATA) \
+ $(NULL)
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
index f222799..e279f16 100644
--- a/README
+++ b/README
@@ -1,12 +1,16 @@
openrc-settingsd provides an implementation of the the hostnamed, localed,
-and timedated DBus services for OpenRC-based systems - in particular, for
+and timedated D-Bus services for OpenRC-based systems - in particular, for
typical installations of Gentoo Linux.
-Bugs should be reported (for the moment) to gnome@gentoo.org
+It is maintained by Gentoo's GNOME desktop team, which can be contacted
+via gnome@gentoo.org, or in #gentoo-desktop on Freenode IRC.
+
+Bugs should be reported to Gentoo Bugzilla (https://bugs.gentoo.org/)
+using "GNOME" as the component.
Hostnamed:
- See http://www.freedesktop.org/wiki/Software/systemd/hostnamed for the DBus
+ See http://www.freedesktop.org/wiki/Software/systemd/hostnamed for the D-Bus
protocol description.
The static hostname is stored in /etc/conf.d/hostname as
@@ -22,7 +26,7 @@ Hostnamed:
Localed:
- See http://www.freedesktop.org/wiki/Software/systemd/localed for the DBus
+ See http://www.freedesktop.org/wiki/Software/systemd/localed for the D-Bus
protocol description.
The system locale variables are set in /etc/env.d/02locale.
@@ -38,8 +42,8 @@ Localed:
Timedated:
- See http://www.freedesktop.org/wiki/Software/systemd/timedated for the DBus
- protocol description.
+ See http://www.freedesktop.org/wiki/Software/systemd/timedated for the
+ D-Bus protocol description.
The RTC UTC vs. local time setting is set in /etc/conf.d/hwclock as
clock="UTC" or clock="local".
diff --git a/TODO b/TODO
index 9b68c84..f2fccd1 100644
--- a/TODO
+++ b/TODO
@@ -8,10 +8,4 @@ document that this case is not supported?
De-systemd-ize hwclock.c
-Do something about runtime dependency on systemd's org.freedesktop.hostname1.policy,
-org.freedesktop.locale1.policy, and org.freedesktop.timedate1.policy files.
-
-Decide how openrc-settingsd should be started (/etc/init.d? dbus activation?
-might that conflict with systemd's services or files in some way?)
-
Make an ebuild, and add it to portage!
diff --git a/autogen.sh b/autogen.sh
index 4f9c076..6383ac1 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,7 +3,8 @@
autoreconf --install --symlink
args="--prefix=/usr \
---sysconfdir=/etc"
+--sysconfdir=/etc \
+--localstatedir=/var"
echo
echo "----------------------------------------------------------------"
diff --git a/configure.ac b/configure.ac
index fe600ed..a162912 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,36 @@ if test "x$GDBUS_CODEGEN" = x; then
AC_MSG_ERROR([Failed to find gdbus-codegen])
fi
+AC_ARG_WITH([rootsbindir], AS_HELP_STRING([--with-rootsbindir=DIR], [root /sbin directory @<:@default=/sbin@:>@]), [], [with_rootsbindir=/sbin])
+AC_SUBST([rootsbindir], [$with_rootsbindir])
+
+AC_MSG_CHECKING([dbus interfaces directory])
+dbusinterfacesdir=`$PKG_CONFIG --variable=interfaces_dir dbus-1`
+if test "x$dbusinterfacesdir" = "x"; then
+ AC_MSG_ERROR([not found])
+else
+ AC_MSG_RESULT([$dbusinterfacesdir])
+fi
+AC_SUBST([dbusinterfacesdir])
+
+AC_MSG_CHECKING([dbus system services directory])
+dbussystemservicesdir=`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`
+if test "x$dbussystemservicesdir" = "x"; then
+ AC_MSG_ERROR([not found])
+else
+ AC_MSG_RESULT([$dbussystemservicesdir])
+fi
+AC_SUBST([dbussystemservicesdir])
+
+AC_MSG_CHECKING([polkit actions directory])
+polkitactiondir=`$PKG_CONFIG --variable=actiondir polkit-gobject-1`
+if test "x$polkitactiondir" = "x"; then
+ AC_MSG_ERROR([not found])
+else
+ AC_MSG_RESULT([$polkitactiondir])
+fi
+AC_SUBST([polkitactiondir])
+
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
@@ -38,6 +68,7 @@ AC_MSG_RESULT([
prefix: ${prefix}
sysconfdir: ${sysconfdir}
+ rootsbindir: ${with_rootsbindir}
compiler: ${CC}
cflags: ${CFLAGS}
diff --git a/data/conf.d/openrc-settingsd b/data/conf.d/openrc-settingsd
new file mode 100644
index 0000000..eb51089
--- /dev/null
+++ b/data/conf.d/openrc-settingsd
@@ -0,0 +1,8 @@
+# openrc-settingsd will attempt to auto-detect your ntp implementation
+# If you want to use a specific ntp rc service, set it here
+
+# NTP_SERVICE=""
+
+# Other options you want to pass to openrc-settingsd, e.g. --read-only
+
+OPENRC_SETTINGSD_OPTS=""
diff --git a/data/init.d/openrc-settingsd.in b/data/init.d/openrc-settingsd.in
new file mode 100755
index 0000000..dfdcda8
--- /dev/null
+++ b/data/init.d/openrc-settingsd.in
@@ -0,0 +1,27 @@
+#!/sbin/runscript
+# Copyright 2012 Alexandre Rostovtsev <tetromino@gentoo.org>
+# Distributed under the terms of the GNU General Public License v2
+
+description="hostnamed, localed, and timedated D-Bus services for OpenRC"
+
+depend() {
+ need dbus
+}
+
+start() {
+ [ -n "${NTP_SERVICE}" ] &&
+ OPENRC_SETTINGSD_OPTS="--ntp-service=${NTP_SERVICE} ${OPENRC_SETTINGSD_OPTS}"
+ ebegin "Starting openrc-settingsd"
+ start-stop-daemon --start --quiet --pidfile "@localstatedir@/run/openrc-settingsd.pid" \
+ --make-pidfile --background "@libexecdir@/openrc-settingsd" -- \
+ ${OPENRC_SETTINGSD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping openrc-settingsd"
+ start-stop-daemon --stop --quiet --pidfile "@localstatedir@/run/openrc-settingsd.pid"
+ eend $?
+}
+
+# vim: set ft=gentoo-init-d ts=4 :
diff --git a/data/org.freedesktop.hostname1.policy b/data/org.freedesktop.hostname1.policy
new file mode 100644
index 0000000..74851e2
--- /dev/null
+++ b/data/org.freedesktop.hostname1.policy
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+
+<policyconfig>
+ <vendor>Gentoo Linux</vendor>
+ <vendor_url>http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git</vendor_url>
+
+ <action id="org.freedesktop.hostname1.set-hostname">
+ <description>Set local host name</description>
+ <message>System policy prevents modifying the local host name.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.hostname1.set-static-hostname">
+ <description>Set statically configured local host name and pretty host name</description>
+ <message>System policy prevents modifying the statically configured local host name or pretty host name.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.hostname1.set-machine-info">
+ <description>Set local machine information</description>
+ <message>System policy prevents modifying the local machine information.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+</policyconfig>
diff --git a/data/org.freedesktop.hostname1.service.in b/data/org.freedesktop.hostname1.service.in
new file mode 100644
index 0000000..0d850f5
--- /dev/null
+++ b/data/org.freedesktop.hostname1.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.hostname1
+Exec=@rootsbindir@/rc-service openrc-settingsd start
+User=root \ No newline at end of file
diff --git a/data/hostname1.xml b/data/org.freedesktop.hostname1.xml
index 7a731f6..e351096 100644
--- a/data/hostname1.xml
+++ b/data/org.freedesktop.hostname1.xml
@@ -1,4 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
<node name="/org/freedesktop/hostname1">
<interface name="org.freedesktop.hostname1">
<method name="SetHostname">
diff --git a/data/org.freedesktop.locale1.policy b/data/org.freedesktop.locale1.policy
new file mode 100644
index 0000000..e56cc74
--- /dev/null
+++ b/data/org.freedesktop.locale1.policy
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+
+<policyconfig>
+ <vendor>Gentoo Linux</vendor>
+ <vendor_url>http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git</vendor_url>
+
+ <action id="org.freedesktop.locale1.set-locale">
+ <description>Set system locale environment variables</description>
+ <message>System policy prevents modifying the system locale environment variables.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.locale1.set-keyboard">
+ <description>Set system keyboard layout</description>
+ <message>System policy prevents modifying the system keyboard layout.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+</policyconfig>
diff --git a/data/org.freedesktop.locale1.service.in b/data/org.freedesktop.locale1.service.in
new file mode 100644
index 0000000..eda463a
--- /dev/null
+++ b/data/org.freedesktop.locale1.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.locale1
+Exec=@rootsbindir@/rc-service openrc-settingsd start
+User=root \ No newline at end of file
diff --git a/data/locale1.xml b/data/org.freedesktop.locale1.xml
index dfd98d3..51c0f91 100644
--- a/data/locale1.xml
+++ b/data/org.freedesktop.locale1.xml
@@ -1,4 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
<node name="/org/freedesktop/locale1">
<interface name="org.freedesktop.locale1">
<method name="SetLocale">
diff --git a/data/org.freedesktop.timedate1.policy b/data/org.freedesktop.timedate1.policy
new file mode 100644
index 0000000..9bc276b
--- /dev/null
+++ b/data/org.freedesktop.timedate1.policy
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+
+<policyconfig>
+ <vendor>Gentoo Linux</vendor>
+ <vendor_url>http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git</vendor_url>
+
+ <action id="org.freedesktop.timedate1.set-time">
+ <description>Set system time</description>
+ <message>System policy prevents modifying the system time.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.timedate1.set-timezone">
+ <description>Set system timezone</description>
+ <message>System policy prevents modifying the system timezone.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.timedate1.set-local-rtc">
+ <description>Set system hardware clock to UTC or to the local timezone</description>
+ <message>System policy prevents modifying the system hardware clock settings.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.timedate1.set-ntp">
+ <description>Enable or disable network time synchronization</description>
+ <message>System policy prevents modifying network time synchronization settings.</message>
+ <defaults>
+ <allow_any>auth_admin_keep</allow_any>
+ <allow_inactive>auth_admin_keep</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+</policyconfig>
diff --git a/data/org.freedesktop.timedate1.service.in b/data/org.freedesktop.timedate1.service.in
new file mode 100644
index 0000000..6138b3b
--- /dev/null
+++ b/data/org.freedesktop.timedate1.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.timedate1
+Exec=@rootsbindir@/rc-service openrc-settingsd start
+User=root \ No newline at end of file
diff --git a/data/timedate1.xml b/data/org.freedesktop.timedate1.xml
index 18aa6d6..c5cdbee 100644
--- a/data/timedate1.xml
+++ b/data/org.freedesktop.timedate1.xml
@@ -1,4 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
<node name="/org/freedesktop/timedate1">
<interface name="org.freedesktop.timedate1">
<method name="SetTime">