pxe-bootserver/settings.sh

69 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2023-04-15 16:05:21 +02:00
#!/bin/sh
#
# Global Settings
#
# The location of all the TFTP stuff
D_TFTP=/srv/tftp
# Full path of this project:
D_ROOTDIR=/root/pxe-bootserver
D_RESRC=${D_ROOTDIR}/resrc.d
2023-04-15 16:05:21 +02:00
# the ip and FQDN for this server
HOST_IP=192.168.75.3
HOST_FQDN=tftp.ostrach.tld
2023-04-18 13:41:50 +02:00
#
# Functions
#
fservice (){
# $1 is enabled yes/no
# $2 is the command
# $3 is the program name
# $4 is a list of packages
if [ "$1" = "yes" ] || [ "$1" = "YES" ]; then
echo "$3 is enabled:"
2023-04-18 13:41:50 +02:00
case $2 in
# INIT
# Install needed Debian Packages:
init)
echo " installing: $4"
2023-04-18 13:41:50 +02:00
apt install -y $4
;;
start)
if ! [ "$3" = "none" ]; then
echo " starting $3 ..."
2023-04-18 13:41:50 +02:00
systemctl start $3
fi
;;
stop)
if ! [ "$3" = "none" ]; then
echo " stopping $3 ..."
2023-04-18 13:41:50 +02:00
systemctl stop $3
fi
;;
restart)
if ! [ "$3" = "none" ]; then
echo " restarting $3 ..."
2023-04-18 13:41:50 +02:00
systemctl restart $3
fi
;;
esac
else
echo "$3 is disabled. "
if ! [ "$3" = "none" ]; then
systemctl stop $3
fi
2023-04-18 13:41:50 +02:00
fi
}