Added more Linux packaging configuration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-09-01 13:33:41 -04:00
parent 6c5319c195
commit c5b0db8de2
3 changed files with 36 additions and 3 deletions

View File

@ -7,8 +7,6 @@ readme = "README.md"
license = "BSD 2-Clause" license = "BSD 2-Clause"
authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"] authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
toml = "0.5" toml = "0.5"
serde = "1.0" serde = "1.0"
@ -17,7 +15,7 @@ shellexpand = "2.1"
[package.metadata.deb] [package.metadata.deb]
license-file = "LICENSE" license-file = "LICENSE"
maintainer-scripts = "build/debian/service" maintainer-scripts = "build/debian/scripts"
depends = "ffmpeg (>= 4)" depends = "ffmpeg (>= 4)"
section = "video" section = "video"
assets = [ assets = [
@ -26,6 +24,7 @@ assets = [
["README.md", "usr/share/doc/adept/README", "644"] ["README.md", "usr/share/doc/adept/README", "644"]
] ]
[package.metadata.deb.systemd-units] [package.metadata.deb.systemd-units]
unit-scripts = "build/debian/service"
unit-name = "adept.service" unit-name = "adept.service"
enable = true enable = true
start = true start = true
@ -36,5 +35,6 @@ assets = [
{ source = "build/etc/example.toml", dest = "/etc/adept/example.toml", mode = "755"}, { source = "build/etc/example.toml", dest = "/etc/adept/example.toml", mode = "755"},
{ source = "README.md", dest = "/usr/share/doc/adept/README", mode = "644"} { source = "README.md", dest = "/usr/share/doc/adept/README", mode = "644"}
] ]
post_install_script = "build/script/postinst"
[package.metadata.generate-rpm.requires] [package.metadata.generate-rpm.requires]
ffmpeg = ">= 4" ffmpeg = ">= 4"

View File

@ -0,0 +1,11 @@
[Unit]
Description=Adept video transcoder service
[Service]
User=adept
Group=adept
ExecStart=/usr/bin/adept
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target

22
build/scripts/postinst Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
GETENT_USER=$(getent passwd adept)
GETENT_GROUP=$(getent group adept)
# Create the adept user if it doesn't already exist
if [ "$GETENT_USER" = "" ]; then
useradd -r adept
else
echo "The 'adept' user already exists, skipping creation."
fi
# Create the adept group if it doesn't already exist
if [ "$GETENT_GROUP" = "" ]; then
groupadd adept
usermod -aG adept adept
else
echo "The 'adept' group already exists, skipping creation."
fi
# Change the directory ownership of /etc
chown -R adept:adept /etc/adept