Таки собрал.
Изменено имя файла скрипта как Источника1
$ cp ~/RPM/SOURCES/earlyoom.init ~/RPM/SOURCES/earlyoom
В спэке:
- Изменена строка 13 с earlyoom.init на earlyoom
- Добавлены строки: 40, 41, 42, 54
$ cat -n ~/RPM/SPECS/earlyoom.spec
1 Name: earlyoom
2 Version: 1.2
3 Release: alt2
4
5 Summary: Early OOM Daemon for Linux
6 License: MIT
7 Group: Other
8 Url: http://github.com/rfjakob/earlyoom
9
10 Packager: Anton Midyukov <antohami@altlinux.org>
11
12 Source: %name-%version.tar
13 Source1: %name
14
15 %ifarch %ix86 x86_64
16 BuildRequires: pandoc
17 %endif
18
19 %description
20 The oom-killer generally has a bad reputation among Linux users.
21 This may be part of the reason Linux invokes it only when it has
22 absolutely no other choice. It will swap out the desktop
23 environment, drop the whole page cache and empty every buffer
24 before it will ultimately kill a process. At least that's what
25 I think what it will do. I have yet to be patient enough to wait
26 for it, sitting in front of an unresponsive system.
27
28 %prep
29 %setup
30 sed -e '/systemctl/d' -i Makefile
31
32 %build
33 %make_build
34
35 %install
36 %makeinstall_std \
37 PREFIX=%_prefix \
38 SYSCONFDIR=%_sysconfdir \
39 SYSTEMDUNITDIR=%_unitdir
40
41 mkdir -p %buildroot%_initdir
42 install -pm755 %SOURCE1 %buildroot%_initdir
43
44 %post
45 %post_service %name
46
47 %preun
48 %preun_service %name
49
50 %files
51 %doc README.md LICENSE
52 %_bindir/%name
53 %_unitdir/%name.service
54 %_initdir/%name
55
56
57 %ifarch %ix86 x86_64
58 %_man1dir/%name.*
59 %endif
60
61 %config(noreplace) %_sysconfdir/default/%name
62
63 %changelog
64 * Fri Jan 25 2019 Anton Midyukov <antohami@altlinux.org> 1.2-alt2
65 - Added init script (Thanks Specyfighter)
66
67 * Sun Jan 20 2019 Anton Midyukov <antohami@altlinux.org> 1.2-alt1
68 - Initial build (Closes: 35924)
Листинг спэка:
Name: earlyoom
Version: 1.2
Release: alt2
Summary: Early OOM Daemon for Linux
License: MIT
Group: Other
Url: http://github.com/rfjakob/earlyoom
Packager: Anton Midyukov <antohami@altlinux.org>
Source: %name-%version.tar
Source1: %name
%ifarch %ix86 x86_64
BuildRequires: pandoc
%endif
%description
The oom-killer generally has a bad reputation among Linux users.
This may be part of the reason Linux invokes it only when it has
absolutely no other choice. It will swap out the desktop
environment, drop the whole page cache and empty every buffer
before it will ultimately kill a process. At least that's what
I think what it will do. I have yet to be patient enough to wait
for it, sitting in front of an unresponsive system.
%prep
%setup
sed -e '/systemctl/d' -i Makefile
%build
%make_build
%install
%makeinstall_std \
PREFIX=%_prefix \
SYSCONFDIR=%_sysconfdir \
SYSTEMDUNITDIR=%_unitdir
mkdir -p %buildroot%_initdir
install -pm755 %SOURCE1 %buildroot%_initdir
%post
%post_service %name
%preun
%preun_service %name
%files
%doc README.md LICENSE
%_bindir/%name
%_unitdir/%name.service
%_initdir/%name
%ifarch %ix86 x86_64
%_man1dir/%name.*
%endif
%config(noreplace) %_sysconfdir/default/%name
%changelog
* Fri Jan 25 2019 Anton Midyukov <antohami@altlinux.org> 1.2-alt2
- Added init script (Thanks Specyfighter)
* Sun Jan 20 2019 Anton Midyukov <antohami@altlinux.org> 1.2-alt1
- Initial build (Closes: 35924)
После сборки
$ rpm -ba --target i586 ~/RPM/SPECS/earlyoom.spec
пакет получился таким, каким и должен быть, - с sysv init-файлом:
$ rpm -qpl /home/user/RPM/SRPMS/earlyoom-1.2-alt2.src.rpm
earlyoom
earlyoom-1.2.tar
earlyoom.spec
$ rpm -qpvl /home/user/RPM/RPMS/i586/earlyoom-1.2-alt2.i586.rpm
-rw-r--r-- 1 root root 562 янв 26 02:02 /etc/default/earlyoom
-rwxr-xr-x 1 root root 1412 янв 26 02:01 /etc/rc.d/init.d/earlyoom
-rw-r--r-- 1 root root 233 янв 26 02:02 /lib/systemd/system/earlyoom.service
-rwxr-xr-x 1 root root 22108 янв 26 02:02 /usr/bin/earlyoom
drwxr-xr-x 2 root root 0 янв 26 02:02 /usr/share/doc/earlyoom-1.2
-rw-r--r-- 1 root root 1087 окт 28 18:32 /usr/share/doc/earlyoom-1.2/LICENSE
-rw-r--r-- 1 root root 11756 окт 28 18:32 /usr/share/doc/earlyoom-1.2/README.md
-rw-r--r-- 1 root root 2160 янв 26 02:02 /usr/share/man/man1/earlyoom.1.xz