Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 1572625

Browse files
jcvenegasDamien Lespiau
authored andcommitted
build: Add systemd service file for daemon
This commit adds a systemd service file to start hyperstart when configured in daemon mode. v2: Fix the case where we don't have have the systemd pkgconfig file (Damien) Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
1 parent 911cc71 commit 1572625

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tags
1212
/src/hyperstart
1313
build/hyper_daemon
1414
build/hyper-initrd.img
15+
data/hyperstart.service
1516
build/cbfs.rom
1617
build/root/*
1718
build/*iso

Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ cbfs-local:
66
@echo finish make cbfs
77
kernel-local:
88
@echo finish make kernel
9+
10+
if SYSTEMD
11+
SYSTEMD_SYS_UNITdir = @SYSTEMD_SYSTEMUNIT@
12+
SYSTEMD_SYS_UNIT_DATA = data/hyperstart.service
13+
endif

configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ AC_CONFIG_HEADERS([config.h])
1111
# Checks for programs.
1212
AC_PROG_CC
1313
AM_PROG_CC_C_O
14+
AC_CHECK_PROG(PKG_CONFIG, [pkg-config], [pkg-config], [:])
15+
1416
# Checks for libraries.
1517

1618
# Checks for header files.
@@ -60,10 +62,22 @@ fi
6062

6163
AM_CONDITIONAL([WITH_VBOX], [test "x$with_vbox" != "xno"])
6264

65+
AC_ARG_WITH([systemdsystemunitdir],
66+
AS_HELP_STRING([--with-systemdsystemunitdir=SYSTEMD_SYSTEM_UNIT_DIR],
67+
[path to install systemd system service]),
68+
[SYSTEMD_SYSTEMUNIT=${withval}],
69+
[SYSTEMD_SYSTEMUNIT="`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`"])
70+
71+
AS_IF([test -z "$SYSTEMD_SYSTEMUNIT"],[SYSTEMD_SYSTEMUNIT=no])
72+
AS_IF([test "x$enable_daemon" = "xno"],[SYSTEMD_SYSTEMUNIT=no])
73+
AC_SUBST(SYSTEMD_SYSTEMUNIT)
74+
AM_CONDITIONAL(SYSTEMD, test "x${SYSTEMD_SYSTEMUNIT}" != "xno" )
75+
6376
AC_CONFIG_FILES([
6477
Makefile
6578
src/Makefile
6679
build/Makefile
80+
data/hyperstart.service
6781
])
6882
AC_OUTPUT
6983

@@ -79,4 +93,5 @@ AC_MSG_RESULT([
7993
suid cflags: ${SUID_CFLAGS}
8094
ldflags: ${LDFLAGS}
8195
suid ldflags: ${SUID_LDFLAGS}
96+
systemd unit path: ${SYSTEMD_SYSTEMUNIT}
8297
])

data/hyperstart.service.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[Unit]
2+
Description=hyperstart guest daemon
3+
4+
[Service]
5+
ExecStart=@prefix@/bin/hyperstart

0 commit comments

Comments
 (0)