Commit 7453e4486b1eab856f0ed70ba7612cdbe0b3c006
1 parent
e9255e77
Exists in
master
Empacotando como serviço, ajustando permissões
Showing
7 changed files
with
36 additions
and
4 deletions
Show diff stats
.gitignore
Makefile.in
| @@ -131,6 +131,10 @@ install: \ | @@ -131,6 +131,10 @@ install: \ | ||
| 131 | @$(MKDIR) $(DESTDIR)/$(unitdir) | 131 | @$(MKDIR) $(DESTDIR)/$(unitdir) |
| 132 | @$(INSTALL_DATA) conf/systemd.service $(DESTDIR)/$(unitdir)/$(PACKAGE_NAME).service | 132 | @$(INSTALL_DATA) conf/systemd.service $(DESTDIR)/$(unitdir)/$(PACKAGE_NAME).service |
| 133 | 133 | ||
| 134 | + @$(MKDIR) $(DESTDIR)/etc/dbus-1/system.d | ||
| 135 | + @$(INSTALL_DATA) conf/dbus.conf $(DESTDIR)/etc/dbus-1/system.d/$(PACKAGE_NAME).conf | ||
| 136 | + | ||
| 137 | + | ||
| 134 | bz2: \ | 138 | bz2: \ |
| 135 | $(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.bz2 | 139 | $(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.bz2 |
| 136 | 140 |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +<!DOCTYPE busconfig PUBLIC | ||
| 2 | + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
| 3 | + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
| 4 | +<busconfig> | ||
| 5 | + | ||
| 6 | + <!-- Only root or user avahi can own the Avahi service --> | ||
| 7 | + <policy user="root"> | ||
| 8 | + <allow own="br.com.bb.pw3270.service"/> | ||
| 9 | + </policy> | ||
| 10 | + | ||
| 11 | + <!-- Allow anyone to invoke methods on server --> | ||
| 12 | + <policy context="default"> | ||
| 13 | + <allow send_destination="br.com.bb.pw3270.service"/> | ||
| 14 | + <allow receive_sender="br.com.bb.pw3270.service"/> | ||
| 15 | + </policy> | ||
| 16 | + | ||
| 17 | +</busconfig> | ||
| 18 | + |
conf/systemd.service.in
configure.ac
| @@ -358,6 +358,8 @@ dnl --------------------------------------------------------------------------- | @@ -358,6 +358,8 @@ dnl --------------------------------------------------------------------------- | ||
| 358 | 358 | ||
| 359 | AC_CONFIG_FILES(Makefile) | 359 | AC_CONFIG_FILES(Makefile) |
| 360 | AC_CONFIG_FILES(conf/systemd.service) | 360 | AC_CONFIG_FILES(conf/systemd.service) |
| 361 | +AC_CONFIG_FILES(conf/dbus.service) | ||
| 362 | +AC_CONFIG_FILES(conf/dbus.conf) | ||
| 361 | 363 | ||
| 362 | dnl --------------------------------------------------------------------------- | 364 | dnl --------------------------------------------------------------------------- |
| 363 | dnl Output the generated config.status script. | 365 | dnl Output the generated config.status script. |
src/main.c
| @@ -141,17 +141,18 @@ static void initialize() { | @@ -141,17 +141,18 @@ static void initialize() { | ||
| 141 | connection = dbus_g_bus_get_private(bustype, g_main_context_default(), &error); | 141 | connection = dbus_g_bus_get_private(bustype, g_main_context_default(), &error); |
| 142 | 142 | ||
| 143 | if(error) { | 143 | if(error) { |
| 144 | - g_error("Error \"%s\" getting D-Bus connection",error->message); | 144 | + fprintf(stderr,"Error \"%s\" getting D-Bus connection\n",error->message); |
| 145 | g_error_free(error); | 145 | g_error_free(error); |
| 146 | - return; | 146 | + exit(-1); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); | 149 | proxy = dbus_g_proxy_new_for_name(connection,DBUS_SERVICE_DBUS,DBUS_PATH_DBUS,DBUS_INTERFACE_DBUS); |
| 150 | 150 | ||
| 151 | org_freedesktop_DBus_request_name(proxy, PW3270_SERVICE_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); | 151 | org_freedesktop_DBus_request_name(proxy, PW3270_SERVICE_DBUS_SERVICE, DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error); |
| 152 | if(error) { | 152 | if(error) { |
| 153 | - g_error("Error \"%s\" getting D-Bus name",error->message); | ||
| 154 | - return; | 153 | + fprintf(stderr,"Error \"%s\" getting D-Bus name\n",error->message); |
| 154 | + g_error_free(error); | ||
| 155 | + exit(-1); | ||
| 155 | } | 156 | } |
| 156 | 157 | ||
| 157 | GType object_type = PW3270_TYPE_DBUS; | 158 | GType object_type = PW3270_TYPE_DBUS; |