-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcd-daemon.spec.in
155 lines (137 loc) · 4.12 KB
/
lcd-daemon.spec.in
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
%if %{defined _project}
# define if building on openSUSE build service
%global build_on_obs 1
%global reconfigure_mode 0
%else
%define _project local
%global build_on_obs 0
%global reconfigure_mode 0
%global _hardened_build 1
%endif
%if %{defined nodebug}
%global debug_package %{nil}
%endif
%global _prefix @prefix@
%global mandir @prefix@/share/man
%global _libexecdir @prefix@/libexec
%if %build_on_obs == 1
%global packager Manvendra Bhangui <@email@>
%endif
%define see_base For a description of lcd-daemon visit https://github.com/mbhangui/lcd-daemon
%define servicedir /service
Name: lcd-daemon
Version: @version@
Release: @release@%{?dist}
Summary: LCD Daemon for Character LCD with Hitachi 44780 controller
License: LGPLv3+
Group: Applications/Multimedia
URL: https://github.com/mbhangui/lcd-daemon
BuildRequires: gcc gcc-c++ make autoconf automake libtool
BuildRequires: glibc glibc-devel
# only for raspberry pi distributions
# TODO: need to find a variable name instead of raspberry_version
%if 0%{?raspbian_version}
BuildRequires: libwiringpi-devel libwiringpidev-devel
%endif
Source0: %{name}-%{version}.tar.gz
Requires: coreutils
%description
lcd-daemon is server application that accepts text from clients to be
printed on character LCD Display with Hitachi 44780 controller. It uses the
libwiringPi and libwiringPiDev library at
https://github.com/mbhangui/wiringPi
notify-daemon is server application that accepts text from clients to be
sent as desktop notifications
The libraries were originally written by Gordon Henderson. The version of
libwiringpi used here is an unofficial fork of wiringPi at
https://github.com/WiringPi/WiringPi.
%{see_base}
%prep
%setup -q
%build
%configure --prefix=%{_prefix} --mandir=%{_prefix}/share/man --libexecdir=%{_prefix}/libexec
%install
%{__make} -s %{?_smp_mflags}
%{__make} -s DESTDIR=%{buildroot} install-strip
find %{buildroot}%{_mandir} -type f -exec gzip -q {} \;
%files
%defattr (-,root,root)
%doc LICENSE README.md
%dir %attr(755,root,root) %{_libexecdir}/%{name}
%{_sbindir}/lcd-daemon
%{_sbindir}/notify-daemon
%{_bindir}/pilcd
%{_bindir}/pinotify
%{_libexecdir}/%{name}/create_service
%ghost /var/log/svc/lcd-daemon
%docdir %{_mandir}
%{_mandir}/man1/pilcd.1.gz
%{_mandir}/man1/pinotify.1.gz
%{_mandir}/man8/lcd-daemon.8.gz
%{_mandir}/man8/notify-daemon.8.gz
%pretrans
if [ ! -x %{_prefix}/sbin/minisvc ] ; then
exit 0
fi
# stop lcd-daemon services before upgrade
if [ -d /run ] ; then
rundir=/run/svscan
elif [ -d /var/run ] ; then
rundir=/var/run/svscan
else
rundir=%{servicedir}
fi
%{_prefix}/bin/svstat %{servicedir}/lcd-daemon >/dev/null 2>&1
if [ $? -eq 0 ] ; then
%{__mkdir_p} ${rundir}/lcd-daemon
%{_prefix}/bin/svc -d %{servicedir}/lcd-daemon
touch ${rundir}/lcd-daemon/.down
fi
%post
argv1=$1
if [ $argv1 -eq 2 ] ; then # upgrade
if [ ! -x %{_prefix}/sbin/minisvc ] ; then
exit 0
fi
if [ -d /run ] ; then
rundir=/run/svscan
elif [ -d /var/run ] ; then
rundir=/var/run/svscan
else
rundir=%{servicedir}
fi
for j in lcd-daemon notify-desktop
do
%{_prefix}/sbin/minisvc --servicedir=%{servicedir} --refreshsvc="%{servicedir}/$j" --silent
%{_prefix}/bin/svok %{servicedir}/$j >/dev/null 2>&1
if [ $? -eq 0 -a -f ${rundir}/$j/.down ] ; then
%{_prefix}/bin/svc -u %{servicedir}/$j
fi
%{__rm} -f ${rundir}/$j/.down
done
exit 0
fi
if [ ! -x %{_prefix}/sbin/minisvc ] ; then
exit 0
fi
for j in lcd-daemon notify-desktop
do
# create lcd-daemon, notify-desktop service in down state
%{_libexecdir}/%{name}/create_service --servicedir=%{servicedir} --"$j"
%{_prefix}/sbin/minisvc --servicedir=%{servicedir} --service-name="$j" \
--export-variables=%{servicedir}/"$j"/variables/.variables --force --silent
touch %{servicedir}/"$j"/down
if [ -x /usr/bin/svps ] ; then
/usr/bin/svps -h >/dev/null 2>&1
fi
done
%preun
if [ ! -x %{_prefix}/sbin/minisvc ] ; then
exit 0
fi
if [ -x %{_prefix}/sbin/minisvc ] ; then
%{_prefix}/sbin/minisvc --rmsvc=%{servicedir}/lcd-daemon
%{_prefix}/sbin/minisvc --rmsvc=%{servicedir}/notify-desktop
sleep 5
fi
%changelog