- Use properly tmpfiles-create
- Remove the systemd conditional - Fixup download url OBS-URL: https://build.opensuse.org/package/show/network/ddclient?expand=0&rev=54
This commit is contained in:
parent
9aadc6c6b4
commit
6c26aeb044
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 3 14:16:09 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Use properly tmpfiles-create
|
||||
- Remove the systemd conditional
|
||||
- Fixup download url
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Feb 2 08:26:42 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
|
@ -16,38 +16,25 @@
|
||||
#
|
||||
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir /var/adm/fillup-templates
|
||||
%endif
|
||||
|
||||
Name: ddclient
|
||||
Version: 3.9.1
|
||||
Release: 0
|
||||
Summary: A Perl Client to Update Dynamic DNS Entries
|
||||
License: GPL-2.0-or-later
|
||||
Group: Productivity/Networking/DNS/Utilities
|
||||
Version: 3.9.1
|
||||
Release: 0
|
||||
URL: http://ddclient.sourceforge.net/
|
||||
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
URL: https://github.com/ddclient/ddclient
|
||||
Source0: https://github.com/ddclient/ddclient/archive/v%{version}.tar.gz
|
||||
Source1: %{name}.service
|
||||
Source2: %{name}.sysconfig
|
||||
Source3: %{name}-tmpfiles.conf
|
||||
Source4: rc.%{name}
|
||||
Patch0: %{name}-3.8.1-config.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
Requires: perl >= 5.004
|
||||
Requires: perl-Data-Validate-IP
|
||||
Requires(pre): %fillup_prereq
|
||||
Requires(pre): shadow
|
||||
Requires: perl-Data-Validate-IP
|
||||
|
||||
%if 0%{?suse_version} >= 1230
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
%{?systemd_requires}
|
||||
%define has_systemd 1
|
||||
%endif
|
||||
|
||||
Requires: perl >= 5.004
|
||||
Recommends: perl-IO-Socket-SSL
|
||||
BuildArch: noarch
|
||||
%{?systemd_requires}
|
||||
|
||||
%description
|
||||
ddclient is a client requiring only Perl. Supported
|
||||
@ -62,7 +49,7 @@ DNS services. Comes with sample scripts for use with DHCP, PPP, and
|
||||
cron.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
%setup -q
|
||||
%patch0
|
||||
rm -f sample-etc_ddclient.conf.orig
|
||||
chmod a-x sample-*
|
||||
@ -70,84 +57,45 @@ mkdir examples
|
||||
mv sample-* examples
|
||||
|
||||
%build
|
||||
#%%configure
|
||||
#make
|
||||
# If the package provides automatic testing
|
||||
#make test
|
||||
# nothing to do here (yet)
|
||||
:
|
||||
|
||||
%install
|
||||
#%%make_install
|
||||
install -D -m 755 %{name} %{buildroot}%{_sbindir}/%{name}
|
||||
install -D -m 600 examples/sample-etc_ddclient.conf %{buildroot}%{_sysconfdir}/%{name}.conf
|
||||
%if 0%{?has_systemd}
|
||||
sed -i -e "s,/var/run/,/run/%{name}/," %{buildroot}%{_sysconfdir}/%{name}.conf
|
||||
%else
|
||||
sed -i -e "s,/var/run/,/var/run/%{name}/," %{buildroot}%{_sysconfdir}/%{name}.conf
|
||||
%endif
|
||||
# init script and config file
|
||||
%if 0%{?has_systemd}
|
||||
sed -i -e "s,%{_localstatedir}/run/,/run/%{name}/," %{buildroot}%{_sysconfdir}/%{name}.conf
|
||||
install -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service
|
||||
install -D -m 644 %{SOURCE3} %{buildroot}%{_libexecdir}/tmpfiles.d/%{name}.conf
|
||||
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
||||
%else
|
||||
install -D -m 755 %{SOURCE4} %{buildroot}%{_sysconfdir}/init.d/%{name}
|
||||
ln -s %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
|
||||
%endif
|
||||
install -D -m 644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
||||
ln -s service %{buildroot}%{_sbindir}/rc%{name}
|
||||
install -d -m 755 %{buildroot}%{_fillupdir}
|
||||
install -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.%{name}
|
||||
install -d -m 755 %{buildroot}/var/cache/%{name}
|
||||
%if 0%{?has_systemd}
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/cache/%{name}
|
||||
install -d -m 755 %{buildroot}/run/%{name}
|
||||
%else
|
||||
install -d -m 755 %{buildroot}%{_localstatedir}/run/%{name}
|
||||
%endif
|
||||
|
||||
%pre
|
||||
getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
|
||||
getent passwd %{name} >/dev/null || \
|
||||
%{_sbindir}/useradd -c "DDClient User" -d %{_localstatedir}/cache/%{name} \
|
||||
-g %{name} -r -s /bin/false %{name}
|
||||
%if 0%{?has_systemd}
|
||||
%service_add_pre %{name}.service
|
||||
install -d -m 755 -o %{name} -g root /run/%{name}
|
||||
%else
|
||||
install -d -m 755 -o %{name} -g root %{_localstatedir}/run/%{name}
|
||||
%endif
|
||||
|
||||
%post
|
||||
%{fillup_only}
|
||||
%if 0%{?has_systemd}
|
||||
%fillup_only
|
||||
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
|
||||
%service_add_post %{name}.service
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%if 0%{?has_systemd}
|
||||
%service_del_preun %{name}.service
|
||||
%else
|
||||
%stop_on_removal ddclient
|
||||
%endif
|
||||
|
||||
%postun
|
||||
%if 0%{?has_systemd}
|
||||
%service_del_postun %{name}.service
|
||||
%else
|
||||
%restart_on_update ddclient
|
||||
%insserv_cleanup
|
||||
%endif
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc COPY* README* examples
|
||||
%config(noreplace) %attr(600,%{name},root) %{_sysconfdir}/%{name}.conf
|
||||
%if 0%{?has_systemd}
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_libexecdir}/tmpfiles.d/ddclient.conf
|
||||
%ghost %dir %attr(755,%{name},%{name}) /run/%{name}
|
||||
%else
|
||||
/etc/init.d/%{name}
|
||||
%ghost %dir %attr(755,%{name},%{name}) %{_localstatedir}/run/%{name}
|
||||
%endif
|
||||
%{_sbindir}/%{name}
|
||||
%{_sbindir}/rc%{name}
|
||||
%{_fillupdir}/sysconfig.%{name}
|
||||
|
134
rc.ddclient
134
rc.ddclient
@ -1,134 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2005-2006 SUSE Linux AG, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Klaus Singvogel.
|
||||
# Please send feedback to http://www.suse.de/feedback
|
||||
#
|
||||
# ddclient This shell script takes care of starting and stopping
|
||||
# ddclient.
|
||||
#
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ddclient
|
||||
# Required-Start: $syslog $local_fs $network
|
||||
# Should-Start: $time ypbind sendmail $remote_fs rp-pppoe
|
||||
# Required-Stop: $syslog $local_fs
|
||||
# Should-Stop: $time ypbind sendmail $remote_fs rp-pppoe
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: ddclient a daemon to update dynamic DNS entries
|
||||
# Description: ddclient is a Perl client used to update dynamic DNS
|
||||
# entries for accounts on many dynamic DNS services and
|
||||
# can be used on many types of firewalls
|
||||
### END INIT INFO
|
||||
#
|
||||
|
||||
|
||||
DDCLIENT_BIN=/usr/sbin/ddclient
|
||||
DDCLIENT_CONFIG=/etc/ddclient.conf
|
||||
DDCLIENT_SYSCONFIG=/etc/sysconfig/ddclient
|
||||
|
||||
[ -x $DDCLIENT_BIN ] || exit 5
|
||||
[ -s $DDCLIENT_CONFIG ] || exit 6
|
||||
[ -s $DDCLIENT_SYSCONFIG ] && . $DDCLIENT_SYSCONFIG
|
||||
|
||||
# some defaults
|
||||
dd_intervall=${DDCLIENT_INTERVALL:-300}
|
||||
|
||||
# if no "use=" is set in ddclient.conf try 'ppp0' as a default
|
||||
if [ `/bin/cat $DDCLIENT_CONFIG | grep -e "^use=" >/dev/null; echo $?` -eq 0 ]; then
|
||||
dd_use=
|
||||
else
|
||||
dd_use="-use=if -if ppp0"
|
||||
fi
|
||||
# extract pid= from config, strip trailing comments and trailing whitespace...
|
||||
pid_file=`sed -n '/^pid=/{s@#.*$@@;s@[[:space:]]*$@@;s@^pid=@@;p}' /etc/ddclient.conf`
|
||||
# default is /var/run/ddclient.pid
|
||||
[ -z "$pid_file" ] && pid_file=/var/run/ddclient.pid
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
# rc_check check and set local and overall rc status
|
||||
# rc_status check and set local and overall rc status
|
||||
# rc_status -v ditto but be verbose in local rc status
|
||||
# rc_status -v -r ditto and clear the local rc status
|
||||
# rc_failed set local and overall rc status to failed
|
||||
# rc_failed <num> set local and overall rc status to <num><num>
|
||||
# rc_reset clear local rc status (overall remains)
|
||||
# rc_exit exit appropriate to overall rc status
|
||||
. /etc/rc.status
|
||||
|
||||
# First reset status of this service
|
||||
rc_reset
|
||||
|
||||
# Return values acc. to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - insufficient privilege
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
# Note that starting an already running service, stopping
|
||||
# or restarting a not-running service as well as the restart
|
||||
# with force-reload (in case signalling is not supported) are
|
||||
# considered a success.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting ddclient daemon :"
|
||||
# startproc does check the name of the binary, and this is "perl" in this case,
|
||||
# so better start it this way or systemd will not know it is running
|
||||
/sbin/startproc -p $pid_file /usr/bin/perl "$DDCLIENT_BIN" -daemon $dd_intervall "$dd_use" $DDCLIENT_OPTIONS -pid $pid_file
|
||||
|
||||
# remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down ddclient daemon :"
|
||||
/sbin/killproc -p $pid_file -TERM /usr/bin/perl
|
||||
|
||||
# remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
$0 status >/dev/null && $0 restart
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
# echo -n "Reload service ddclient"
|
||||
rc_failed 3
|
||||
|
||||
# remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
rc_failed 3
|
||||
|
||||
# remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service ddclient :"
|
||||
/sbin/checkproc -p $pid_file /usr/bin/perl
|
||||
|
||||
# remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ddclient {start|stop|try-restart|restart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
rc_exit
|
Loading…
x
Reference in New Issue
Block a user