From a8a46df87f03e80ca413f04b5607bffae52c96af Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Fri, 2 Sep 2022 13:43:32 -0400 Subject: [PATCH] Updated the Makefile to add commands for installing and uninstalling the software on Linux - this will make up for not having native packaging for the time being --- Makefile | 20 ++++++++++++++++++++ build/etc/systemd/system/adept.service | 11 +++++++++++ 2 files changed, 31 insertions(+) create mode 100644 build/etc/systemd/system/adept.service diff --git a/Makefile b/Makefile index 71932c5..387d858 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,26 @@ test: run: go build -o ${BINARY_NAME} adept.go ./${BINARY_NAME} + +install: + useradd ${BINARY_NAME} + usermod -aG ${BINARY_NAME} ${BINARY_NAME} + cp ./${BINARY_NAME} /usr/bin/${BINARY_NAME} + chown root:root /usr/bin/${BINARY_NAME} + chmod 755 /usr/bin/${BINARY_NAME} + cp ./build/etc/systemd/system/${BINARY_NAME}.service /etc/systemd/system/${BINARY_NAME}.service + chown root:root /etc/systemd/system/${BINARY_NAME}.service + chmod 644 /etc/systemd/system/${BINARY_NAME}.service + mkdir /etc/${BINARY_NAME} + cp ./build/etc/${BINARY_NAME}/${BINARY_NAME}.toml /etc/${BINARY_NAME}/ + chown -R ${BINARY_NAME}:${BINARY_NAME} /etc/${BINARY_NAME} + chmod 644 /etc/${BINARY_NAME}/${BINARY_NAME}.toml + +uninstall: + userdel ${BINARY_NAME} + rm /usr/bin/${BINARY_NAME} + rm /etc/systemd/system/${BINARY_NAME}.service + rm -rf /etc/${BINARY_NAME} clean: go clean diff --git a/build/etc/systemd/system/adept.service b/build/etc/systemd/system/adept.service new file mode 100644 index 0000000..9d8c946 --- /dev/null +++ b/build/etc/systemd/system/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