I am running Raspbian on my raspberry pi.
I downloaded and installed the custom drivers from Realtek for my wifi dongle
After compiling and moving the binary created to /usr/sbin/ I saw that I could not call service hostapd start as it returned **hostapd: unrecognized service **
I was told that I must create a init.d script for this and place it in the /etc/init.d/ folder
I decided to look at another init.d script for a program called dhcpd, the file contents are
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcpcd
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: IPv4 DHCP client with IPv4LL support
# Description:
### END INIT INFO
PATH=/sbin:/bin
DHCPCD=/sbin/dhcpcd
NAME=dhcpcd
PIDFILE=/var/run/dhcpcd.pid
test -x $DHCPCD || exit 0
INTERFACES=/etc/network/interfaces
. /lib/lsb/init-functions
sanity()
{
local x=
case "$($DHCPCD --version)" in
[1234].*)
log_failure_msg "Not running $NAME because an older version" \
"is currently preferred"
exit 6
esac
for x in /var/run/dhcpcd-*.pid; do
[ -f "$x" ] || continue
log_failure_msg "Not running $NAME because there is aleady an" \
"interface specific instance"
log_failure_msg "$x"
exit 6
done
if grep -q "^[[:space:]]*iface[[:space:]]*.*[[:space:]]*inet[[:space:]]*dhcp" \
$INTERFACES; then
log_failure_msg "Not running $NAME because $INTERFACES"
log_failure_msg "defines some interfaces that will use a" \
"DHCP client"
exit 6
fi
}
case "$1" in
start)
sanity
if pidofproc -p $PIDFILE $DHCPCD >/dev/null; then
log_warning_msg "$NAME is already running"
exit 0
fi
$DHCPCD
;;
stop)
sanity
$DHCPCD -x
;;
restart|force-reload)
sanity
$DHCPCD -x
$DHCPCD
;;
try-restart)
if ! pidofproc -p $PIDFILE $DHCPCD >/dev/null; then
log_warning_msg "$NAME is not running"
else
sanity
$DHCPCD -x
$DHCPCD
fi
;;
reload)
if ! pidofproc -p $PIDFILE $DHCPCD >/dev/null; then
log_failure_msg "$NAME is not running"
exit 7
fi
sanity
$DHCPCD -n
;;
status)
status_of_proc -p $PIDFILE $DHCPCD "$NAME" || exit $?
;;
*)
log_failure_msg "Usage: /etc/init.d/dhcpcd {start|stop|restart|try-restart|force-reload|status}"
exit 1
;;
esac
It SURELY cannot be the case that the user is expected to create a init.d file for a binary just compiled? And even if they do what are the chances of the integrity of all the if statments and msg outputs being accurate?
Have I missed something here? is there a common filename/location for init.d scripts within the package.zip file prior to calling make?
A file that specific should be written by somebody who has a good understanding of the binary...