diff --git a/Cargo.toml b/Cargo.toml index 36f480a..8b04360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,6 @@ readme = "README.md" license = "BSD 2-Clause" authors = ["Gregory Ballantine "] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] toml = "0.5" serde = "1.0" @@ -17,7 +15,7 @@ shellexpand = "2.1" [package.metadata.deb] license-file = "LICENSE" -maintainer-scripts = "build/debian/service" +maintainer-scripts = "build/debian/scripts" depends = "ffmpeg (>= 4)" section = "video" assets = [ @@ -26,6 +24,7 @@ assets = [ ["README.md", "usr/share/doc/adept/README", "644"] ] [package.metadata.deb.systemd-units] +unit-scripts = "build/debian/service" unit-name = "adept.service" enable = true start = true @@ -36,5 +35,6 @@ assets = [ { source = "build/etc/example.toml", dest = "/etc/adept/example.toml", mode = "755"}, { source = "README.md", dest = "/usr/share/doc/adept/README", mode = "644"} ] +post_install_script = "build/script/postinst" [package.metadata.generate-rpm.requires] ffmpeg = ">= 4" diff --git a/build/debian/service/adept.service b/build/debian/service/adept.service new file mode 100644 index 0000000..9d8c946 --- /dev/null +++ b/build/debian/service/adept.service @@ -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 \ No newline at end of file diff --git a/build/scripts/postinst b/build/scripts/postinst new file mode 100755 index 0000000..6bed4e1 --- /dev/null +++ b/build/scripts/postinst @@ -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