Skip to content

Commit 7eef13a

Browse files
committed
Add packaging files for debian
1 parent 94513bc commit 7eef13a

File tree

6 files changed

+118
-0
lines changed

6 files changed

+118
-0
lines changed

pkg/deb/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
src/
2+
*.tar
3+
*.buildinfo
4+
*.changes
5+
*.deb

pkg/deb/debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
surface-dtx-daemon (0.1.0) unstable; urgency=medium
2+
3+
* Initial release.
4+
5+
-- Maximilian Luz <[email protected]> Sat, 20 Apr 2019 16:50:43 +0000

pkg/deb/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11

pkg/deb/debian/control

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Source: surface-dtx-daemon
2+
Section: misc
3+
Priority: optional
4+
Maintainer: Maximilian Luz <[email protected]>
5+
Build-Depends: build-essential, debhelper (>= 11), cargo, rustc (>= 1.34.0), libdbus-glib-1-dev
6+
7+
Package: surface-dtx-daemon
8+
Architecture: amd64
9+
Depends: libdbus-1-3
10+
Description: Surface Detachment System (DTX) Daemon

pkg/deb/debian/rules

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/make -f
2+
3+
pkgdir = debian/surface-dtx-daemon
4+
5+
clean:
6+
dh clean
7+
cargo clean
8+
9+
build:
10+
dh build
11+
env CARGO_TARGET_DIR="${PWD}/target" CARGO_INCREMENTAL=0 cargo build --release --locked
12+
13+
binary:
14+
dh binary --without dh_shlibdeps
15+
16+
install:
17+
# binary files
18+
install -D -m755 "target/release/surface-dtx-daemon" "${pkgdir}/usr/bin/surface-dtx-daemon"
19+
install -D -m755 "target/release/surface-dtx-userd" "${pkgdir}/usr/bin/surface-dtx-userd"
20+
21+
# application files
22+
install -D -m644 "etc/dtx/surface-dtx-daemon.conf" "${pkgdir}/etc/surface-dtx/surface-dtx-daemon.conf"
23+
install -D -m644 "etc/dtx/surface-dtx-userd.conf" "${pkgdir}/etc/surface-dtx/surface-dtx-userd.conf"
24+
install -D -m755 "etc/dtx/attach.sh" "${pkgdir}/etc/surface-dtx/attach.sh"
25+
install -D -m755 "etc/dtx/detach.sh" "${pkgdir}/etc/surface-dtx/detach.sh"
26+
27+
# systemd service files
28+
install -D -m644 "etc/systemd/surface-dtx-daemon.service" "${pkgdir}/usr/lib/systemd/system/surface-dtx-daemon.service"
29+
install -D -m644 "etc/systemd/surface-dtx-userd.service" "${pkgdir}/usr/lib/systemd/user/surface-dtx-userd.service"
30+
31+
# dbus config file
32+
install -D -m644 "etc/dbus/org.surface.dtx.conf" "${pkgdir}/etc/dbus-1/system.d/org.surface.dtx.conf"
33+
34+
# completion files
35+
install -D -m644 "target/surface-dtx-daemon.bash" "${pkgdir}/usr/share/bash-completion/completions/surface-dtx-daemon"
36+
install -D -m644 "target/surface-dtx-userd.bash" "${pkgdir}/usr/share/bash-completion/completions/surface-dtx-userd"
37+
38+
install -D -m644 "target/_surface-dtx-daemon" "${pkgdir}/usr/share/zsh/vendor-completions/_surface-dtx-daemon"
39+
install -D -m644 "target/_surface-dtx-userd" "${pkgdir}/usr/share/zsh/vendor-completions/_surface-dtx-userd"
40+
41+
install -D -m644 "target/surface-dtx-daemon.fish" "${pkgdir}/usr/share/fish/completions/surface-dtx-daemon.fish"
42+
install -D -m644 "target/surface-dtx-userd.fish" "${pkgdir}/usr/share/fish/completions/surface-dtx-userd.fish"
43+
44+
# reauired for cross-packaging from Arch
45+
# may be moved to lxc-container once debian has rustc >= 1.34
46+
override_dh_shlibdeps:
47+
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

pkg/deb/makedeb.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
set -e
3+
4+
branch="develop"
5+
basepath="pkg/deb"
6+
7+
8+
pushd() {
9+
command pushd "$@" > /dev/null
10+
}
11+
12+
popd() {
13+
command popd "$@" > /dev/null
14+
}
15+
16+
17+
chkdir() {
18+
if [ ! -d ".git" ]
19+
then
20+
echo "Error: Script must be run from the root directory"
21+
exit 1
22+
fi
23+
}
24+
25+
prepare() {
26+
archive="src.tar"
27+
28+
git archive --format tar "$branch" > "$basepath/$archive"
29+
30+
mkdir -p "$basepath/src"
31+
tar xf "$basepath/$archive" --directory "$basepath/src"
32+
33+
cp -r "$basepath/debian" "$basepath/src/"
34+
}
35+
36+
build() {
37+
pushd "$basepath/src"
38+
dpkg-buildpackage -b -d
39+
popd
40+
}
41+
42+
43+
clean() {
44+
echo "TODO"
45+
}
46+
47+
48+
chkdir
49+
prepare
50+
build

0 commit comments

Comments
 (0)