Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Make install deploys systemd service file #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,38 @@ install:
@install -v -o root -g root -m 644 -p fw1-loggrabber.conf ${INSTALL_ETC_DIR}/fw1-loggrabber.conf-sample
@install -v -o root -g root -m 644 -p lea.conf ${INSTALL_ETC_DIR}/lea.conf-sample
@install -v -o root -g root -m 644 -t ${INSTALL_LIB_DIR} ${OPSEC_LIB_DIR}/*.so
ifeq ($(shell test -d /etc/ld.so.conf.d && echo -n yes),yes)
@echo
@echo "** ldconfig detected, adding ${INSTALL_LIB_DIR}."
@install -v -o root -g root -m 644 -p install/ldconfig/fw1-loggrabber.conf /etc/ld.so.conf.d/fw1-loggrabber.conf
rm /etc/ld.so.cache
ldconfig
@echo
endif
ifeq ($(shell test -d /etc/systemd/system && echo -n yes),yes)
@install -v -o root -g root -m 644 -p install/systemd/fw1-loggrabber.service /etc/systemd/system/fw1-loggrabber.service
systemctl daemon-reload
systemctl enable fw1-loggrabber
@echo
@echo
@echo "Installation complete! After configuration files are set you may start the service with the following command;"
@echo
@echo " systemctl start fw1-loggrabber"
else
@echo
@echo
@echo "Installation complete! Please declare the following environment variables in your shell configuration file:"
@echo
@echo " LD_LIBRARY_PATH=\$$LD_LIBRARY_PATH:${INSTALL_LIB_DIR}"
@echo " export LD_LIBRARY_PATH"
@echo " LOGGRABBER_CONFIG_PATH=${INSTALL_ETC_DIR}"
@echo " export LOGGRABBER_CONFIG_PATH"
@echo " LOGGRABBER_TEMP_PATH=${TEMP_DIR}"
@echo " export LOGGRABBER_TEMP_PATH"
endif
ifneq ($(shell test -d /etc/ld.so.conf.d && echo -n yes),yes)
@echo " LD_LIBRARY_PATH=\$$LD_LIBRARY_PATH:${INSTALL_LIB_DIR}"
@echo " export LD_LIBRARY_PATH"
endif
@echo
@echo

clean:
Expand Down
1 change: 1 addition & 0 deletions install/ldconfig/fw1-loggrabber.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/usr/local/fw1-loggrabber/lib
16 changes: 16 additions & 0 deletions install/systemd/fw1-loggrabber.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=fw1-loggrabber
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Environment=LOGGRABBER_CONFIG_PATH=/usr/local/fw1-loggrabber/etc
WorkingDirectory=/usr/local/fw1-loggrabber
ExecStart=/usr/local/fw1-loggrabber/bin/fw1-loggrabber
Restart=always
RestartSec=5
TimeoutSec=5min

[Install]
WantedBy=multi-user.target