diff --git a/dnsmasq-config/centos/build_srpm.data b/dnsmasq-config/centos/build_srpm.data new file mode 100644 index 0000000..2c3b2cb --- /dev/null +++ b/dnsmasq-config/centos/build_srpm.data @@ -0,0 +1,2 @@ +SRC_DIR="files" +TIS_PATCH_VER=1 diff --git a/dnsmasq-config/centos/dnsmasq-config.spec b/dnsmasq-config/centos/dnsmasq-config.spec new file mode 100644 index 0000000..fde260c --- /dev/null +++ b/dnsmasq-config/centos/dnsmasq-config.spec @@ -0,0 +1,30 @@ +Summary: dnsmasq-config +Name: dnsmasq-config +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: base +Packager: StarlingX +URL: unknown +BuildArch: noarch +Source: %name-%version.tar.gz + +Requires: dnsmasq +Summary: package StarlingX configuration files of dnsmasq to system folder. + +%description +package StarlingX configuration files of dnsmasq to system folder. + +%prep +%setup + +%build + +%install +mkdir -p %{buildroot}%{_sysconfdir}/init.d +install -m 755 init %{buildroot}%{_sysconfdir}/init.d/dnsmasq + +%post + +%files +%{_sysconfdir}/init.d/dnsmasq diff --git a/dnsmasq-config/files/init b/dnsmasq-config/files/init new file mode 100644 index 0000000..1517197 --- /dev/null +++ b/dnsmasq-config/files/init @@ -0,0 +1,59 @@ +#!/bin/sh +if [ -f /etc/centos-release ]; then + DAEMON=/usr/sbin/dnsmasq +else + DAEMON=/usr/bin/dnsmasq +fi +NAME=dnsmasq +DESC="DNS forwarder and DHCP server" +PIDFILE="/var/run/dnsmasq.pid" + +test -f $DAEMON || exit 0 + +case "$1" in + start) + echo -n "starting $DESC: $NAME... " + test -d /var/lib/misc/ || mkdir /var/lib/misc/ + start-stop-daemon -S -x $DAEMON --pidfile $PIDFILE -- $ARGS + echo "done." + echo -n "Refresh hosts cache" + nscd -i hosts + echo "done." + ;; + stop) + echo -n "stopping $DESC: $NAME... " + start-stop-daemon -K -x $DAEMON --pidfile $PIDFILE + rm -f $PIDFILE + echo "done." + ;; + status) + echo -n "dnsmasq " + start-stop-daemon -q -K -t -x $DAEMON --pidfile $PIDFILE + RET=$? + if [ "$RET" = "0" ]; then + PID=`cat $PIDFILE` + echo "($PID) is running" + else + echo "is not running" + # For lsb compliance return 3 if process not running + exit 3 + fi + ;; + restart) + echo "restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + reload) + echo -n "reloading $DESC: $NAME... " + killall -HUP $(basename ${DAEMON}) + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|status|restart|reload}" + exit 1 + ;; +esac + +exit 0