Skip to content

Commit 120b8cb

Browse files
authored
Include systemd files in the final built package (#674)
* Include systemd files in the final built package * Fix instructions regarding to systemd service
1 parent 17d6867 commit 120b8cb

File tree

5 files changed

+71
-4
lines changed

5 files changed

+71
-4
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,14 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
635635
set(CPACK_PACKAGE_INSTALL_DIRECTORY "EternalTerminal")
636636
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
637637

638-
SET(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
638+
if(NOT CPACK_GENERATOR)
639+
SET(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
640+
endif()
641+
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/debian/postinst;${CMAKE_SOURCE_DIR}/debian/postrm;${CMAKE_SOURCE_DIR}/debian/prerm")
642+
SET(CPACK_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR}/systemctl;/lib/systemd/system" "${CMAKE_SOURCE_DIR}/etc;/etc")
639643
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unmaintained")
644+
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libprotobuf-dev, libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 12), libutempter0 (>= 1.1.5)")
645+
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS "systemd")
640646

641647
# This must always be last!
642648
include(CPack)

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Debian/Ubuntu Dependencies:
234234
```
235235
sudo apt install libsodium-dev autoconf libtool \
236236
libprotobuf-dev protobuf-compiler libutempter-dev libcurl4-openssl-dev \
237-
build-essential ninja-build cmake git zip
237+
build-essential ninja-build cmake git zip pkg-config
238238
```
239239

240240
Fetch source, build and install:
@@ -246,14 +246,15 @@ mkdir build
246246
cd build
247247
# For ARM (including OS/X with apple silicon):
248248
if [[ $(uname -a | grep 'arm\|aarch64') ]]; then export VCPKG_FORCE_SYSTEM_BINARIES=1; fi
249-
cmake ../
249+
cmake -DCPACK_GENERATOR=DEB ../
250250
make -j$(nproc) package
251251
sudo dpkg --install *.deb
252-
sudo cp ../etc/et.cfg /etc/
253252
```
254253

255254
Once built, the binary only requires `libprotobuf-dev`.
256255

256+
Disable et server by `sudo systemctl disable --now et`
257+
257258
### CentOS 7
258259

259260
Install dependencies:

debian/postinst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
set -e
3+
# Automatically added by dh_installsystemd/13.6ubuntu1
4+
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
5+
# This will only remove masks created by d-s-h on package removal.
6+
deb-systemd-helper unmask 'et.service' >/dev/null || true
7+
8+
# was-enabled defaults to true, so new installations run enable.
9+
if deb-systemd-helper --quiet was-enabled 'et.service'; then
10+
# Enables the unit on first installation, creates new
11+
# symlinks on upgrades if the unit file has changed.
12+
deb-systemd-helper enable 'et.service' >/dev/null || true
13+
else
14+
# Update the statefile to add new symlinks (if any), which need to be
15+
# cleaned up on purge. Also remove old symlinks.
16+
deb-systemd-helper update-state 'et.service' >/dev/null || true
17+
fi
18+
fi
19+
# End automatically added section
20+
# Automatically added by dh_installsystemd/13.6ubuntu1
21+
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
22+
if [ -d /run/systemd/system ]; then
23+
systemctl --system daemon-reload >/dev/null || true
24+
if [ -n "$2" ]; then
25+
_dh_action=restart
26+
else
27+
_dh_action=start
28+
fi
29+
deb-systemd-invoke $_dh_action 'et.service' >/dev/null || true
30+
fi
31+
fi
32+
# End automatically added section

debian/postrm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
set -e
3+
# Automatically added by dh_installsystemd/13.6ubuntu1
4+
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
5+
systemctl --system daemon-reload >/dev/null || true
6+
fi
7+
# End automatically added section
8+
# Automatically added by dh_installsystemd/13.6ubuntu1
9+
if [ "$1" = "remove" ]; then
10+
if [ -x "/usr/bin/deb-systemd-helper" ]; then
11+
deb-systemd-helper mask 'et.service' >/dev/null || true
12+
fi
13+
fi
14+
15+
if [ "$1" = "purge" ]; then
16+
if [ -x "/usr/bin/deb-systemd-helper" ]; then
17+
deb-systemd-helper purge 'et.service' >/dev/null || true
18+
deb-systemd-helper unmask 'et.service' >/dev/null || true
19+
fi
20+
fi
21+
# End automatically added section

debian/prerm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -e
3+
# Automatically added by dh_installsystemd/13.6ubuntu1
4+
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
5+
deb-systemd-invoke stop 'et.service' >/dev/null || true
6+
fi
7+
# End automatically added section

0 commit comments

Comments
 (0)