Add install and uninstall recipes

This commit is contained in:
Jordan Bancino 2022-11-06 22:01:59 +00:00
parent d8005ef6c2
commit 2c65f4925c
2 changed files with 36 additions and 0 deletions

11
contrib/telodendria.rc Executable file
View file

@ -0,0 +1,11 @@
#!/bin/ksh
daemon="/usr/local/bin/telodendria"
daemon_timeout=5
. /etc/rc.d/rc.subr
rc_bg=YES
rc_stop_signal=INT
rc_cmd $1

View file

@ -30,6 +30,8 @@
: "${LDFLAGS:=-lm -pthread -static -flto -fdata-sections -ffunction-sections -s -Wl,-static -Wl,-gc-sections}" : "${LDFLAGS:=-lm -pthread -static -flto -fdata-sections -ffunction-sections -s -Wl,-static -Wl,-gc-sections}"
: "${PROG:=telodendria}" : "${PROG:=telodendria}"
: "${PREFIX:=/usr/local}"
# If a .env file exists in the current directory, we load it. # If a .env file exists in the current directory, we load it.
# As Telodendria's build infrastructure relies heavily on # As Telodendria's build infrastructure relies heavily on
# environment variables, we allow users to specify their # environment variables, we allow users to specify their
@ -98,6 +100,29 @@ recipe_build() {
fi fi
} }
recipe_install() {
cp -v "build/$PROG" "$PREFIX/bin/$PROG"
cp -v "contrib/production.conf" "/etc/telodendria.conf"
cp -v "contrib/telodendria.rc" "/etc/rc.d/telodendria"
mkdir "/var/telodendria"
useradd _telodendria
chown "_telodendria:_telodendria" "/var/telodendria"
find man -name 'telodendria*\.[1-8]' -exec cp -v {} "$PREFIX/{}" \;
}
recipe_uninstall() {
rm -v "$PREFIX/bin/$PROG"
rm -v "/etc/telodendria.conf"
rm -v "/etc/rc.d/telodendria"
userdel "_telodendria"
groupdel "_telodendria"
find "$PREFIX/man" -name 'telodendria*\.[1-8]' -delete
}
recipe_run() { recipe_run() {
if [ -f "build/$PROG" ]; then if [ -f "build/$PROG" ]; then
"build/$PROG" -f contrib/development.conf "build/$PROG" -f contrib/development.conf