From d53da44f7292b3c9acd00b316a6fb248a9dd96d8 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Wed, 28 Dec 2022 23:19:58 +0100 Subject: [PATCH] Makefile: Install dbus service Optionally activate the systemd service --- Makefile | 10 +++++++++- dbus/id.waydro.Container.conf | 12 ++++++++++++ dbus/id.waydro.Container.service | 5 +++++ debian/control | 4 +++- systemd/waydroid-container.service | 3 +-- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 dbus/id.waydro.Container.conf create mode 100644 dbus/id.waydro.Container.service diff --git a/Makefile b/Makefile index c70814d..f838328 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ PREFIX := /usr USE_SYSTEMD ?= 1 +USE_DBUS_ACTIVATION ?= 1 USE_NFTABLES ?= 0 WAYDROID_DIR := $(PREFIX)/lib/waydroid @@ -8,6 +9,7 @@ BIN_DIR := $(PREFIX)/bin APPS_DIR := $(PREFIX)/share/applications METAINFO_DIR := $(PREFIX)/share/metainfo SYSD_DIR := $(PREFIX)/lib/systemd/system +DBUS_DIR := $(PREFIX)/share/dbus-1 APPARMOR_DIR := /etc/apparmor.d INSTALL_WAYDROID_DIR := $(DESTDIR)$(WAYDROID_DIR) @@ -15,17 +17,23 @@ INSTALL_BIN_DIR := $(DESTDIR)$(BIN_DIR) INSTALL_APPS_DIR := $(DESTDIR)$(APPS_DIR) INSTALL_METAINFO_DIR := $(DESTDIR)$(METAINFO_DIR) INSTALL_SYSD_DIR := $(DESTDIR)$(SYSD_DIR) +INSTALL_DBUS_DIR := $(DESTDIR)$(DBUS_DIR) INSTALL_APPARMOR_DIR := $(DESTDIR)$(APPARMOR_DIR) build: @echo "Nothing to build, run 'make install' to copy the files!" install: - install -d $(INSTALL_WAYDROID_DIR) $(INSTALL_BIN_DIR) $(INSTALL_APPS_DIR) $(INSTALL_METAINFO_DIR) + install -d $(INSTALL_WAYDROID_DIR) $(INSTALL_BIN_DIR) $(INSTALL_APPS_DIR) $(INSTALL_METAINFO_DIR) $(INSTALL_DBUS_DIR)/system.d cp -a data tools waydroid.py $(INSTALL_WAYDROID_DIR) ln -sf $(WAYDROID_DIR)/waydroid.py $(INSTALL_BIN_DIR)/waydroid mv $(INSTALL_WAYDROID_DIR)/data/*.desktop $(INSTALL_APPS_DIR) mv $(INSTALL_WAYDROID_DIR)/data/*.metainfo.xml $(INSTALL_METAINFO_DIR) + cp dbus/id.waydro.Container.conf $(INSTALL_DBUS_DIR)/system.d/ + if [ $(USE_DBUS_ACTIVATION) = 1 ]; then \ + install -d $(INSTALL_DBUS_DIR)/system-services; \ + cp dbus/id.waydro.Container.service $(INSTALL_DBUS_DIR)/system-services/; \ + fi if [ $(USE_SYSTEMD) = 1 ]; then \ install -d $(INSTALL_SYSD_DIR); \ cp systemd/waydroid-container.service $(INSTALL_SYSD_DIR); \ diff --git a/dbus/id.waydro.Container.conf b/dbus/id.waydro.Container.conf new file mode 100644 index 0000000..e94b9e8 --- /dev/null +++ b/dbus/id.waydro.Container.conf @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/dbus/id.waydro.Container.service b/dbus/id.waydro.Container.service new file mode 100644 index 0000000..26b43d9 --- /dev/null +++ b/dbus/id.waydro.Container.service @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=id.waydro.Container +Exec=/usr/bin/waydroid -w container start +User=root +SystemdService=waydroid-container.service diff --git a/debian/control b/debian/control index b071434..89a4cd4 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,9 @@ Depends: ${misc:Depends}, lxc, python3-gbinder, python3-gi, - gir1.2-gtk-3.0 + gir1.2-gtk-3.0, + python3-dbus, + dbus Description: Android™ application support waydroid allows running a separate Android™ environment confined to a LXC container. diff --git a/systemd/waydroid-container.service b/systemd/waydroid-container.service index a4fd020..c8ffbd8 100644 --- a/systemd/waydroid-container.service +++ b/systemd/waydroid-container.service @@ -2,9 +2,8 @@ Description=Waydroid Container [Service] +BusName=id.waydro.Container ExecStart=/usr/bin/waydroid -w container start -ExecStop=/usr/bin/waydroid container stop -ExecStopPost=/usr/bin/waydroid session stop [Install] WantedBy=multi-user.target -- 2.47.3