forked from Telodendria/Telodendria
Add install and uninstall recipes
This commit is contained in:
parent
d8005ef6c2
commit
2c65f4925c
2 changed files with 36 additions and 0 deletions
11
contrib/telodendria.rc
Executable file
11
contrib/telodendria.rc
Executable 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
|
25
tools/bin/td
25
tools/bin/td
|
@ -30,6 +30,8 @@
|
|||
: "${LDFLAGS:=-lm -pthread -static -flto -fdata-sections -ffunction-sections -s -Wl,-static -Wl,-gc-sections}"
|
||||
: "${PROG:=telodendria}"
|
||||
|
||||
: "${PREFIX:=/usr/local}"
|
||||
|
||||
# If a .env file exists in the current directory, we load it.
|
||||
# As Telodendria's build infrastructure relies heavily on
|
||||
# environment variables, we allow users to specify their
|
||||
|
@ -98,6 +100,29 @@ recipe_build() {
|
|||
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() {
|
||||
if [ -f "build/$PROG" ]; then
|
||||
"build/$PROG" -f contrib/development.conf
|
||||
|
|
Loading…
Reference in a new issue