aboutsummaryrefslogtreecommitdiffstats
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/CMakeLists.txt32
-rw-r--r--conf/system/CMakeLists.txt42
-rw-r--r--conf/system/afm-system-daemon.conf (renamed from conf/afm-system-daemon.conf)0
-rw-r--r--conf/system/afm-system-daemon.service.in (renamed from conf/afm-system-daemon.service.in)0
-rw-r--r--conf/system/afm-system-daemon.socket.in (renamed from conf/afm-system-daemon.socket.in)2
-rw-r--r--conf/system/afm-user-session@.service15
-rw-r--r--conf/system/afm-user-session@.target3
-rw-r--r--conf/system/afm-user-setup@.path7
-rw-r--r--conf/system/afm-user-setup@.service14
-rw-r--r--conf/unit/CMakeLists.txt31
-rw-r--r--conf/unit/afm-unit-debug.conf.in (renamed from conf/afm-unit-debug.conf.in)19
-rw-r--r--conf/unit/afm-unit.conf.in (renamed from conf/afm-unit.conf.in)19
-rw-r--r--conf/unit/generate-unit-conf/Makefile (renamed from conf/generate-unit-conf/Makefile)0
-rw-r--r--conf/unit/generate-unit-conf/afm-unit (renamed from conf/generate-unit-conf/afm-unit)0
-rw-r--r--conf/unit/generate-unit-conf/binder.inc (renamed from conf/generate-unit-conf/binder.inc)0
-rw-r--r--conf/unit/generate-unit-conf/provided.inc (renamed from conf/generate-unit-conf/provided.inc)7
-rw-r--r--conf/unit/generate-unit-conf/service.inc (renamed from conf/generate-unit-conf/service.inc)14
-rw-r--r--conf/user/CMakeLists.txt31
-rw-r--r--conf/user/afm-user-daemon.conf (renamed from conf/afm-user-daemon.conf)0
-rw-r--r--conf/user/afm-user-daemon.service.in (renamed from conf/afm-user-daemon.service.in)0
-rw-r--r--conf/user/afm-user-start.service8
21 files changed, 189 insertions, 55 deletions
diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt
index 714c321..3e29f82 100644
--- a/conf/CMakeLists.txt
+++ b/conf/CMakeLists.txt
@@ -1,5 +1,5 @@
###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
+# Copyright 2017 IoT.bzh
#
# author: José Bollo <jose.bollo@iot.bzh>
#
@@ -16,31 +16,7 @@
# limitations under the License.
###########################################################################
-cmake_minimum_required(VERSION 2.8)
-
-configure_file(afm-unit.conf.in afm-unit.conf)
-configure_file(afm-unit-debug.conf.in afm-unit-debug.conf)
-configure_file(afm-system-daemon.service.in afm-system-daemon.service)
-configure_file(afm-system-daemon.socket.in afm-system-daemon.socket)
-configure_file(afm-user-daemon.service.in afm-user-daemon.service)
-
-if(NOT USE_SDK)
- set(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d CACHE STRING "Path to dbus system configuration files")
- set(SYSCONFDIR_DBUS_USER ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d CACHE STRING "Path to dbus session configuration files")
- set(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system CACHE STRING "Path to systemd system unit files")
- set(UNITDIR_USER ${CMAKE_INSTALL_LIBDIR}/systemd/user CACHE STRING "Path to systemd system unit files")
-
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-system-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_SYSTEM})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-system-daemon.service DESTINATION ${UNITDIR_SYSTEM})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-system-daemon.socket DESTINATION ${UNITDIR_SYSTEM})
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_USER})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-user-daemon.service DESTINATION ${UNITDIR_USER})
- install(DIRECTORY DESTINATION ${afm_confdir}/unit.env.d)
-
- if(AGL_DEVEL)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-unit-debug.conf DESTINATION ${afm_confdir} RENAME afm-unit.conf)
- else()
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-unit.conf DESTINATION ${afm_confdir})
- endif()
-endif()
+add_subdirectory(unit)
+add_subdirectory(system)
+add_subdirectory(user)
diff --git a/conf/system/CMakeLists.txt b/conf/system/CMakeLists.txt
new file mode 100644
index 0000000..f0e4c6a
--- /dev/null
+++ b/conf/system/CMakeLists.txt
@@ -0,0 +1,42 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 2.8)
+
+configure_file(afm-system-daemon.service.in afm-system-daemon.service)
+configure_file(afm-system-daemon.socket.in afm-system-daemon.socket)
+
+if(NOT USE_SDK)
+ set(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d CACHE STRING "Path to dbus system configuration files")
+ set(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system CACHE STRING "Path to systemd system unit files")
+
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-system-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_SYSTEM})
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/afm-system-daemon.service
+ ${CMAKE_CURRENT_BINARY_DIR}/afm-system-daemon.socket
+ ${CMAKE_CURRENT_SOURCE_DIR}/afm-system-daemon.conf
+ ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-session@.service
+ ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-session@.target
+ ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-setup@.path
+ ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-setup@.service
+ DESTINATION
+ ${UNITDIR_SYSTEM}
+ )
+endif()
+
diff --git a/conf/afm-system-daemon.conf b/conf/system/afm-system-daemon.conf
index 18d45fb..18d45fb 100644
--- a/conf/afm-system-daemon.conf
+++ b/conf/system/afm-system-daemon.conf
diff --git a/conf/afm-system-daemon.service.in b/conf/system/afm-system-daemon.service.in
index ca4ca1d..ca4ca1d 100644
--- a/conf/afm-system-daemon.service.in
+++ b/conf/system/afm-system-daemon.service.in
diff --git a/conf/afm-system-daemon.socket.in b/conf/system/afm-system-daemon.socket.in
index d3f0285..eeae06f 100644
--- a/conf/afm-system-daemon.socket.in
+++ b/conf/system/afm-system-daemon.socket.in
@@ -3,8 +3,6 @@
SmackLabel=*
ListenStream=/run/afm/apis/ws/afm-main
FileDescriptorName=afm-main
-SocketUser=afm
-SocketGroup=afm
Service=afm-system-daemon.service
diff --git a/conf/system/afm-user-session@.service b/conf/system/afm-user-session@.service
new file mode 100644
index 0000000..53563f5
--- /dev/null
+++ b/conf/system/afm-user-session@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Starts the session of afm user %i
+After=systemd-user-sessions.service
+Wants=afm-user-setup@%i.service
+Before=afm-user-setup@%i.service
+Wants=afm-user-session@%i.target
+Before=afm-user-session@%i.target
+[Service]
+PAMName=agl-user-session
+User=%i
+Type=simple
+ExecStartPre=/bin/echo START afm-user-session@%i
+ExecStart=/bin/sleep 2147483648
+ExecStop=/bin/echo STOP afm-user-session@%i
+RemainAfterExit=yes
diff --git a/conf/system/afm-user-session@.target b/conf/system/afm-user-session@.target
new file mode 100644
index 0000000..1e39ce0
--- /dev/null
+++ b/conf/system/afm-user-session@.target
@@ -0,0 +1,3 @@
+[Unit]
+After=afm-user-session@%i.service
+After=afm-user-setup@%i.service
diff --git a/conf/system/afm-user-setup@.path b/conf/system/afm-user-setup@.path
new file mode 100644
index 0000000..2dd0f75
--- /dev/null
+++ b/conf/system/afm-user-setup@.path
@@ -0,0 +1,7 @@
+[Unit]
+DefaultDependencies=false
+[Path]
+PathExists=/run/user/%i/wayland-0
+PathExists=/run/user/%i/afm-user-started
+
+
diff --git a/conf/system/afm-user-setup@.service b/conf/system/afm-user-setup@.service
new file mode 100644
index 0000000..124a4ca
--- /dev/null
+++ b/conf/system/afm-user-setup@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Starts the session of afm user %i
+Requires=afm-user-setup@%i.path
+After=afm-user-setup@%i.path
+After=afm-user-session@%i.service
+Before=afm-user-session@%i.target
+After=user@%i.service
+[Service]
+User=%i
+ExecStartPre=/bin/echo USER SETUP %i
+ExecStartPre=/bin/systemctl status
+ExecStart=/bin/rm /run/user/%i/afm-user-started
+
+
diff --git a/conf/unit/CMakeLists.txt b/conf/unit/CMakeLists.txt
new file mode 100644
index 0000000..69f201d
--- /dev/null
+++ b/conf/unit/CMakeLists.txt
@@ -0,0 +1,31 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 2.8)
+
+if(AGL_DEVEL)
+ configure_file(afm-unit-debug.conf.in afm-unit.conf)
+else()
+ configure_file(afm-unit.conf.in afm-unit.conf)
+endif()
+
+if(NOT USE_SDK)
+ install(DIRECTORY DESTINATION ${afm_confdir}/unit.env.d)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-unit.conf DESTINATION ${afm_confdir})
+endif()
+
diff --git a/conf/afm-unit-debug.conf.in b/conf/unit/afm-unit-debug.conf.in
index 2b8a899..8c435d5 100644
--- a/conf/afm-unit-debug.conf.in
+++ b/conf/unit/afm-unit-debug.conf.in
@@ -82,6 +82,8 @@
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%nl
+%systemd-unit system
+%systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@
[Unit]
Description={{description}}
X-AFM-description={{description}}
@@ -103,7 +105,8 @@ X-AFM--type={{content.type}}
X-AFM--wgtdir={{:#metadata.install-dir}}
X-AFM--workdir=/home/%i/app-data/{{:id}}
%nl
-Wants=sockets.target
+Wants=afm-user-session@%i.target
+After=afm-user-setup@%i.service
# Adds check to smack
ConditionSecurity=smack
%nl
@@ -119,7 +122,6 @@ After=afm-api-ws-{{name}}@%i.socket
EnvironmentFile=-@afm_confdir@/unit.env.d/*
SmackProcessLabel=User::App::{{:id}}
SuccessExitStatus=0 SIGKILL
-#PAMName=su
User=%i
Slice=user-%i.slice
#CapabilityBoundingSet=
@@ -142,8 +144,6 @@ Environment=LD_LIBRARY_PATH=$ORIGIN/lib
; Needed to enable debug
Environment=AFM_ID={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
EnvironmentFile=-/var/run/afm-debug/{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}.env
-%systemd-unit system
-%systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@
SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
StandardInput=null
StandardOutput=journal
@@ -190,8 +190,8 @@ ExecStart={{:#metadata.install-dir}}/{{content.src}}
; auto start
;---------------------------------------------------------------------------------
[Install]
-WantedBy=default.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
{{/required-permission.urn:AGL:permission::system:run-by-default}}
%end systemd-unit
;---------------------------------------------------------------------------------
@@ -203,6 +203,9 @@ WantedBy=default.target
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%systemd-unit system
%systemd-unit socket afm-api-ws-{{name}}@
+[Unit]
+Description=Provides api {{name}} for user %i
+After=afm-user-setup@%i.service
[Socket]
SmackLabel=*
ListenStream=/run/user/%i/apis/ws/{{name}}
@@ -210,8 +213,8 @@ FileDescriptorName={{name}}
Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@%i.service
%nl
[Install]
-WantedBy=sockets.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
%end systemd-unit
{{/value=ws|auto}}
{{/provided-api}}
diff --git a/conf/afm-unit.conf.in b/conf/unit/afm-unit.conf.in
index 5338df4..64c2f23 100644
--- a/conf/afm-unit.conf.in
+++ b/conf/unit/afm-unit.conf.in
@@ -82,6 +82,8 @@
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%nl
+%systemd-unit system
+%systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@
[Unit]
Description={{description}}
X-AFM-description={{description}}
@@ -103,7 +105,8 @@ X-AFM--type={{content.type}}
X-AFM--wgtdir={{:#metadata.install-dir}}
X-AFM--workdir=/home/%i/app-data/{{:id}}
%nl
-Wants=sockets.target
+Wants=afm-user-session@%i.target
+After=afm-user-setup@%i.service
# Adds check to smack
ConditionSecurity=smack
%nl
@@ -119,7 +122,6 @@ After=afm-api-ws-{{name}}@%i.socket
EnvironmentFile=-@afm_confdir@/unit.env.d/*
SmackProcessLabel=User::App::{{:id}}
SuccessExitStatus=0 SIGKILL
-#PAMName=su
User=%i
Slice=user-%i.slice
#CapabilityBoundingSet=
@@ -139,8 +141,6 @@ Environment=XDG_CACHE_HOME=/home/%i/app-data/{{:id}}
Environment=XDG_RUNTIME_DIR=/run/user/%i
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%i/bus
Environment=LD_LIBRARY_PATH=$ORIGIN/lib
-%systemd-unit system
-%systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@
SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
StandardInput=null
StandardOutput=journal
@@ -190,8 +190,8 @@ ExecStart={{:#metadata.install-dir}}/{{content.src}}
; auto start
;---------------------------------------------------------------------------------
[Install]
-WantedBy=default.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
{{/required-permission.urn:AGL:permission::system:run-by-default}}
%end systemd-unit
;---------------------------------------------------------------------------------
@@ -203,6 +203,9 @@ WantedBy=default.target
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%systemd-unit system
%systemd-unit socket afm-api-ws-{{name}}@
+[Unit]
+Description=Provides api {{name}} for user %i
+After=afm-user-setup@%i.service
[Socket]
SmackLabel=*
ListenStream=/run/user/%i/apis/ws/{{name}}
@@ -210,8 +213,8 @@ FileDescriptorName={{name}}
Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@%i.service
%nl
[Install]
-WantedBy=sockets.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
%end systemd-unit
{{/value=ws|auto}}
{{/provided-api}}
diff --git a/conf/generate-unit-conf/Makefile b/conf/unit/generate-unit-conf/Makefile
index 5f5346b..5f5346b 100644
--- a/conf/generate-unit-conf/Makefile
+++ b/conf/unit/generate-unit-conf/Makefile
diff --git a/conf/generate-unit-conf/afm-unit b/conf/unit/generate-unit-conf/afm-unit
index 9a8cd62..9a8cd62 100644
--- a/conf/generate-unit-conf/afm-unit
+++ b/conf/unit/generate-unit-conf/afm-unit
diff --git a/conf/generate-unit-conf/binder.inc b/conf/unit/generate-unit-conf/binder.inc
index 98efd4e..98efd4e 100644
--- a/conf/generate-unit-conf/binder.inc
+++ b/conf/unit/generate-unit-conf/binder.inc
diff --git a/conf/generate-unit-conf/provided.inc b/conf/unit/generate-unit-conf/provided.inc
index d9c12a0..7e085bd 100644
--- a/conf/generate-unit-conf/provided.inc
+++ b/conf/unit/generate-unit-conf/provided.inc
@@ -12,6 +12,9 @@ dnl vim: set filetype=sysctl.conf.m4 syntax=sysctl.conf.m4:
%systemd-unit system
%systemd-unit socket afm-api-ws-{{name}}@
+[Unit]
+Description=Provides api {{name}} for user %i
+After=afm-user-setup@%i.service
[Socket]
SmackLabel=*
@@ -22,8 +25,8 @@ Service=UNIT_NAME_SERVICE
%nl
[Install]
-WantedBy=sockets.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
%end systemd-unit
diff --git a/conf/generate-unit-conf/service.inc b/conf/unit/generate-unit-conf/service.inc
index 7e8dd40..ac10f97 100644
--- a/conf/generate-unit-conf/service.inc
+++ b/conf/unit/generate-unit-conf/service.inc
@@ -7,6 +7,9 @@ dnl vim: set filetype=sysctl.conf.m4 syntax=sysctl.conf.m4:
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%nl
+%systemd-unit system
+%systemd-unit service UNIT_NAME_BASE
+
[Unit]
Description={{description}}
X-AFM-description={{description}}
@@ -29,7 +32,8 @@ X-AFM--wgtdir={{:#metadata.install-dir}}
X-AFM--workdir=APP_DATA_DIR/{{:id}}
%nl
-Wants=sockets.target
+Wants=afm-user-session@%i.target
+After=afm-user-setup@%i.service
# Adds check to smack
ConditionSecurity=smack
@@ -49,7 +53,6 @@ EnvironmentFile=-AFM_CONFIG_DIR/unit.env.d/*
SmackProcessLabel=User::App::{{:id}}
SuccessExitStatus=0 SIGKILL
-#PAMName=su
User=%i
Slice=user-%i.slice
@@ -79,9 +82,6 @@ Environment=AFM_ID=TARGET
EnvironmentFile=-/var/run/afm-debug/TARGET.env
ENDIF
-%systemd-unit system
-%systemd-unit service UNIT_NAME_BASE
-
SyslogIdentifier=afbd-TARGET
StandardInput=null
StandardOutput=journal
@@ -106,8 +106,8 @@ IF_PERM(:system:run-by-default)
; auto start
;---------------------------------------------------------------------------------
[Install]
-WantedBy=default.target
-%systemd-unit wanted-by agl-user-session@.service
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
ENDIF
%end systemd-unit
diff --git a/conf/user/CMakeLists.txt b/conf/user/CMakeLists.txt
new file mode 100644
index 0000000..1545b15
--- /dev/null
+++ b/conf/user/CMakeLists.txt
@@ -0,0 +1,31 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 2.8)
+
+configure_file(afm-user-daemon.service.in afm-user-daemon.service)
+
+if(NOT USE_SDK)
+ set(SYSCONFDIR_DBUS_USER ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d CACHE STRING "Path to dbus session configuration files")
+ set(UNITDIR_USER ${CMAKE_INSTALL_LIBDIR}/systemd/user CACHE STRING "Path to systemd system unit files")
+
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_USER})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-user-daemon.service DESTINATION ${UNITDIR_USER})
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-start.service DESTINATION ${UNITDIR_USER})
+endif()
+
diff --git a/conf/afm-user-daemon.conf b/conf/user/afm-user-daemon.conf
index 801c7ae..801c7ae 100644
--- a/conf/afm-user-daemon.conf
+++ b/conf/user/afm-user-daemon.conf
diff --git a/conf/afm-user-daemon.service.in b/conf/user/afm-user-daemon.service.in
index 11e479c..11e479c 100644
--- a/conf/afm-user-daemon.service.in
+++ b/conf/user/afm-user-daemon.service.in
diff --git a/conf/user/afm-user-start.service b/conf/user/afm-user-start.service
new file mode 100644
index 0000000..130c460
--- /dev/null
+++ b/conf/user/afm-user-start.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=start mark of afm user
+
+[Service]
+Type=oneshot
+ExecStart=/bin/touch %t/afm-user-started
+
+