-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddns-update.spec
141 lines (121 loc) · 3.91 KB
/
ddns-update.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Summary: Client to update dynamic DNS host entries
Name: ddns-update
Version: 1.5
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: https://github.com/lfarkas/%{name}
Source0: https://github.com/lfarkas/%{name}/releases/%{name}-%{version}.tar.gz
BuildArch: noarch
Requires(pre): shadow-utils
Requires: bind-utils
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service, /sbin/chkconfig
Requires(postun): /sbin/service
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
ddns-update is a shell client used to update dynamic DNS entries with nsupdate
Features include: Operating as a daemon, manual and automatic updates, static
and dynamic updates, optimized updates and sending update status to syslog or logfile.
%prep
%setup -q
%build
%install
install -D -p -m 755 ddns-update $RPM_BUILD_ROOT%{_bindir}/ddns-update
install -D -p -m 755 ddns-dbus-daemon $RPM_BUILD_ROOT%{_bindir}/ddns-dbus-daemon
install -D -p -m 755 functions $RPM_BUILD_ROOT%{_libexecdir}/%{name}/functions
install -D -p -m 755 50-%{name} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name}
install -D -p -m 600 ddns-update.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/ddns-update.conf
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
install -D -p -m 644 %{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
install -D -p -m 644 tmpfiles-ddns-update.conf $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}.conf
%else
install -D -p -m 755 %{name}.initscript $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}
%endif
mkdir -p $RPM_BUILD_ROOT%{_rundir}/%{name}/lfarkas
%clean
rm -rf $RPM_BUILD_ROOT
%pre
getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -d / -s /sbin/nologin -c "Dynamic DNS Updater" %{name}
exit 0
%post
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%if 0%{?fedora} >= 18
%systemd_post %{name}.service
%else
if [ $1 -eq 1 ]; then
# Package install, not upgrade
/bin/systemctl daemon-reload > /dev/null 2>&1 || :
fi
%endif
%else
/sbin/chkconfig --add %{name}
%endif
%preun
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%if 0%{?fedora} >= 18
%systemd_preun %{name}.service
%else
# Work around RHBZ #655116
if [ $1 -eq 0 ]; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi
%endif
%else
if [ $1 -eq 0 ]; then
/sbin/service %{name} stop > /dev/null 2>&1 || :
/sbin/chkconfig --del %{name}
fi
%endif
%postun
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%if 0%{?fedora} >= 18
%systemd_postun_with_restart %{name}.service
%else
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# Package upgrade, not uninstall
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%endif
%else
if [ $1 -ne 0 ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
%endif
%files
%defattr(-,root,root,-)
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%license LICENSE
%else
%doc LICENSE
%endif
%doc README* sample/*
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%else
%{_sysconfdir}/rc.d/init.d/%{name}
%endif
%if 0%{?fedora}%{?rhel} > 4
%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name}
%endif
%attr(700,%{name},%{name}) %dir %{_sysconfdir}/%{name}
%attr(644,%{name},%{name}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_bindir}/*
%{_libexecdir}/%{name}/functions
%attr(0755,%{name},%{name}) %dir %{_rundir}/%{name}/
%ghost %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name}.log
%changelog
* Sat Oct 29 2016 Levente Farkas <[email protected]>
- initial release