forked from finley/SystemImager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
systemimager.spec
1567 lines (1354 loc) · 58.9 KB
/
systemimager.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# This file is part of SystemImager.
#
# SystemImager is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# SystemImager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SystemImager. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2012-2019 Olivier LAHAYE <[email protected]>
#
# Purpose:
# This is the spec file that describez the build of the systemimager
# RPM package.
#
%define name systemimager
#
# "ver" below, is automatically set to the current version (as defined
# by the VERSION file) when "make source_tarball" is executed.
# Therefore, it can be set to any three digit number here.
#
%define ver 0.0.0
# Set rel to 1 when is is a final release otherwise, set it to a 0.x number
# This is convenient when final release need to upgrade "beta" releases.
%define rel ##PKG_REL##%{?dist}
%define dracut_module_index 51
%define packager Olivier Lahaye <[email protected]>
#define prefix /usr
%define _build_all 1
%define _boot_flavor standard
# Set this to 1 to build only the boot rpm
# it can also be done in the .rpmmacros file
#define _build_only_boot 1
%{?_build_only_boot:%{expand: %%define _build_all 0}}
# Since Fedora 20, %doc macro will store doc in unversionned directory.
# If this macro doesn't exists, then we have to define it to versionned
# directory. If it's defined, it's correct (F18 and 19 uses versionned dirs
# and Fedora 20 and upward will use unversionned version.
# Source: http://fedoraproject.org/wiki/Changes/UnversionedDocdirs
# OL: BUG => Missing "-server" before version
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
%define _unpackaged_files_terminate_build 0
# Allow initrd_template binaries ion a noarch package.
# indeed, x86_64 initrd template should be installable on another arch as "data"
# in order to generate initrd for this arch.
%define _binaries_in_noarch_packages_terminate_build 0
# prevent RPM from stripping files (eg. bittorrent binaries)
%define __spec_install_post /usr/lib/rpm/brp-compress
# prevent RPM files to be changed by prelink
%{?__prelink_undo_cmd:%undefine __prelink_undo_cmd}
# define _dracutbase
%define _dracutbase %(test -d /usr/lib/dracut && echo '/lib/dracut' || echo '/share/dracut')
%define is_suse %(grep -E "(suse)" /etc/os-release > /dev/null 2>&1 && echo 1 || echo 0)
#define is_suse %(test -f /etc/SuSE-release && echo 1 || echo 0)
%define is_ppc64 %([ "`uname -m`" = "ppc64" ] && echo 1 || echo 0)
%define is_ps3 %([ `grep PS3 /proc/cpuinfo >& /dev/null; echo $?` -eq 0 ] && echo 1 || echo 0)
%if %is_ppc64
%define _arch ppc64
%endif
%if %is_ps3
%define _arch ppc64-ps3
%endif
# Packages definitions
%if 0%{?rhel} == 6
%define pkg_ipcalc initscripts
%define pkg_sshd openssh-server
%define pkg_btrfs_progs btrfs-progs
%define pkg_ntfsprogs ntfsprogs
%define pkg_dejavu_font dejavu-serif-fonts, dejavu-sans-fonts
%define pkg_docbook_utils docbook-utils, docbook-utils-pdf
%define pkg_mkisofs mkisofs
%define pkg_ncat nmap
%define pkg_pidof sysvinit-tools
%define pkg_dhcpd dhcp
%define web_vhosts_dir %{_sysconfdir}/httpd/conf.d
%endif
%if 0%{?rhel} == 7
%define pkg_ipcalc initscripts
%define pkg_sshd openssh-server
%define pkg_btrfs_progs btrfs-progs
%define pkg_ntfsprogs ntfsprogs
%define pkg_dejavu_font dejavu-serif-fonts, dejavu-sans-fonts
%define pkg_docbook_utils docbook-utils, docbook-utils-pdf
%define pkg_mkisofs mkisofs
%define pkg_ncat nmap-ncat
%define pkg_pidof sysvinit-tools
%define pkg_dhcpd dhcp
%define web_vhosts_dir %{_sysconfdir}/httpd/conf.d
%endif
%%if 0%{?rhel} >= 8
%define pkg_ipcalc ipcalc
%define pkg_sshd openssh-server
#define pkg_btrfs_progs
#define pkg_ntfsprogs
%define pkg_dejavu_font dejavu-serif-fonts, dejavu-sans-fonts
%define pkg_docbook_utils docbook-utils
%define pkg_mkisofs genisoimage
%define pkg_ncat nmap-ncat
%define pkg_pidof procps-ng
%define pkg_dhcpd dhcp-server
%define web_vhosts_dir %{_sysconfdir}/httpd/conf.d
%endif
%if 0%{?fedora} > 26
%define pkg_ipcalc ipcalc
%define pkg_sshd openssh-server
%define pkg_btrfs_progs btrfs-progs
%define pkg_ntfsprogs ntfsprogs
%define pkg_dejavu_font dejavu-serif-fonts, dejavu-sans-fonts
%define pkg_docbook_utils docbook-utils, docbook-utils-pdf
%define pkg_mkisofs mkisofs
%define pkg_ncat nmap-ncat
%define pkg_pidof procps-ng
%define pkg_dhcpd dhcp-server
%define web_vhosts_dir %{_sysconfdir}/httpd/conf.d
%endif
%if %is_suse%{?is_opensuse}
%define pkg_ipcalc ipcalc
%define pkg_sshd openssh
%define pkg_btrfs_progs btrfsprogs
%define pkg_ntfsprogs ntfsprogs
%define pkg_dejavu_font dejavu-fonts
%define pkg_docbook_utils docbook-utils
%define pkg_mkisofs cdrtools
%define pkg_ncat ncat
%define pkg_pidof sysvinit-tools
%define pkg_dhcpd dhcp-server
%define web_vhosts_dir %{_sysconfdir}/apache2/vhosts.d
%endif
# Still use the correct lib even on fc-18+ where --target noarch sets _libdir to /usr/lib even on x86_64 arch.
%define static_libcrypt_a /usr/lib/libcrypt.a
%if "%(arch)" == "x86_64" || "%(arch)" == "aarch64"
%define static_libcrypt_a /usr/lib64/libcrypt.a
%endif
Summary: Software that automates Linux installs, software distribution, and production deployment.
Name: %name
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
Source0: http://download.sourceforge.net/systemimager/%{name}-%{ver}.tar.bz2
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
BuildRequires: bc, rsync >= 2.4.6, coreutils, dracut
Requires: rsync >= 2.4.6, syslinux >= 1.48, libappconfig-perl, dosfstools, /usr/bin/perl
#AutoReqProv: no
%description
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
%if %{_build_all}
%package server
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: rsync >= 2.4.6, systemimager-common = %{version}, dracut-systemimager = %{version}, perl-AppConfig, perl, perl(XML::Simple) >= 2.14
Requires: %pkg_dhcpd
Requires(post): systemimager-common = %{version}
Requires: %pkg_mkisofs
# If systemd
%if 0%{?_unitdir:1}
%systemd_requires
%else
Requires: /sbin/chkconfig
%endif
#AutoReqProv: no
%description server
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The server package contains those files needed to run a SystemImager
server.
%package doc
Summary: Systemimager manual and other documentation
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
BuildRequires: dos2unix
BuildRequires: %pkg_docbook_utils
Distribution: System Installation Suite
%description doc
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The doc package provides End-User and Administrator guides for setting up
and use Systemimager. It also includes many configuration examples.
%package server-flamethrower
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Obsoletes: systemimager-flamethrower
Requires: systemimager-server = %{version}, perl, flamethrower >= 0.1.6
# If systemd
%if 0%{?_unitdir:1}
%systemd_requires
%else
Requires: /sbin/chkconfig
%endif
#AutoReqProv: no
%description server-flamethrower
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The flamethrower package allows you to use the flamethrower utility to perform
installations over multicast.
%package common
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: perl, perl-JSON
Requires: systemimager-webgui
# systemimager-webgui is requred by JConfig.pm for the config_scheme.json file.
%description common
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The common package contains files common to SystemImager clients
and servers.
%package client
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: systemimager-common = %{version}, perl-AppConfig, rsync >= 2.4.6, perl
#AutoReqProv: no
%description client
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The client package contains the files needed on a machine for it to
be imaged by a SystemImager server.
%endif
%package %{_arch}boot-%{_boot_flavor}
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Obsoletes: systemimager-%{_arch}boot
# SuSE includes dracut-netwok in main package
%if ! %is_suse%{?is_opensuse}
BuildRequires: dracut-network
%endif
# SuSE has separate package for plymouth in dracut
%if %is_suse%{?is_opensuse}
BuildRequires: plymouth-dracut
%endif
BuildRequires: perl-JSON
BuildRequires: dracut
BuildRequires: plymouth-plugin-script, plymouth-plugin-label
BuildRequires: psmisc, kexec-tools, bind-utils, net-tools, ethtool, lsscsi, usbutils, pciutils, lshw, hwdata, iputils, dmidecode
BuildRequires: xmlstarlet, jq
BuildRequires: parted, mdadm, util-linux, lvm2, gdisk
BuildRequires: xfsprogs, e2fsprogs, dosfstools
%if 0%{?pkg_btrfs_progs:1}
BuildRequires: %pkg_btrfs_progs
%endif
%if 0%{?pkg_ntfsprogs:1}
BuildRequires: %pkg_ntfsprogs
%endif
BuildRequires: %pkg_ipcalc
BuildRequires: %pkg_dejavu_font
BuildRequires: %pkg_ncat
BuildRequires: %pkg_sshd
BuildRequires: ncurses, /usr/bin/awk, kbd
BuildRequires: gettext, bc
BuildRequires: kernel, coreutils
BuildRequires: rtorrent
BuildRequires: cryptsetup
BuildRequires: udpcast, flamethrower
%if 0%{?rhel} == 6
BuildRequires: udev
%else
BuildRequires: systemd
%endif
# CentOS-7 plymouth ask-for-password is buggy
# https://bugzilla.redhat.com/show_bug.cgi?id=1600990
BuildRequires: socat
# Debug tools (for scripts)
BuildRequires: strace, lsof
BuildRequires: %{pkg_pidof}
%if %is_ps3
BuildRequires: dtc
%endif
Requires: systemimager-server >= %{version}
Requires: %{name}-initrd_template = %{version}
Provides: %{name}-boot-%{_boot_flavor} = %{version}
AutoReqProv: no
%description %{_arch}boot-%{_boot_flavor}
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The %{_arch}boot package provides specific kernel, ramdisk, and fs utilities
to boot and install %{_arch} Linux machines during the SystemImager autoinstall
process.
%package initrd_template
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: %{name}-%{_arch}boot-%{_boot_flavor} = %{version}
Obsoletes: %{name}-%{_arch}initrd_template = %{version}
AutoReqProv: no
%description initrd_template
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The initrd_template package provides initrd template files for creating custom
ramdisk that works with a specific kernel by using UYOK (Use Your Own Kernel). The custom
ramdisk can then be used to boot and install Linux machines during the
SystemImager autoinstall process.
%package server-bittorrent
Summary: Software that automates Linux installs, software distribution, and production deployment.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
Obsoletes: systemimager-bittorrent
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: systemimager-server = %{version}, perl, perl(Getopt::Long)
#BuildRequires: cx_Freeze
# If systemd
%if 0%{?_unitdir:1}
%systemd_requires
%else
Requires: /sbin/chkconfig
%endif
#AutoReqProv: no
%description server-bittorrent
SystemImager is software that automates Linux installs, software
distribution, and production deployment. SystemImager makes it easy to
do installs, software distribution, content or data distribution,
configuration changes, and operating system updates to your network of
Linux machines. You can even update from one Linux release version to
another! It can also be used to ensure safe production deployments.
By saving your current production image before updating to your new
production image, you have a highly reliable contingency mechanism. If
the new production environment is found to be flawed, simply roll-back
to the last production image with a simple update command! Some
typical environments include: Internet server farms, database server
farms, high performance clusters, computer labs, and corporate desktop
environments.
The bittorrent package allows you to use the BitTorrent protocol to perform
installations.
%package -n dracut-%{name}
Summary: dracut modules to build a dracut initramfs with systemimager support
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: systemimager-server = %{version}
# SuSE includes dracut-netwok in main package
%if ! %is_suse%{?is_opensuse}
requires: dracut-network
%endif
# SuSE has separate package for plymouth in dracut
%if %is_suse%{?is_opensuse}
Requires: plymouth-dracut
%endif
Requires: dracut
Requires: plymouth-plugin-script, plymouth-plugin-label
Requires: psmisc, kexec-tools, bind-utils, net-tools, ethtool, lsscsi, usbutils, pciutils, lshw, hwdata, iputils, dmidecode
Requires: xmlstarlet, jq
Requires: parted, mdadm, util-linux, lvm2, gdisk
Requires: xfsprogs, e2fsprogs, dosfstools
%if 0%{?pkg_btrfs_progs:1}
Requires: %pkg_btrfs_progs
%endif
%if 0%{?pkg_ntfsprogs:1}
Requires: %pkg_ntfsprogs
%endif
Requires: %pkg_ipcalc
Requires: %pkg_dejavu_font
Requires: %pkg_ncat
Requires: %pkg_sshd
Requires: ncurses, /usr/bin/awk, kbd
Requires: gettext, bc
Requires: kernel, coreutils
Requires: rtorrent
Requires: systemimager-initrd_template
Requires: cryptsetup
Requires: udpcast, flamethrower
%if 0%{?rhel} == 6
Requires: udev
%else
Requires: systemd
%endif
# CentOS-7 plymouth ask-for-password is buggy
# https://bugzilla.redhat.com/show_bug.cgi?id=1600990
Requires: socat
# Debug tools (for scripts)
Requires: strace, lsof
Requires: %{pkg_pidof}
#AutoReqProv: no
%description -n dracut-%{name}
This package is a dracut modules that automates the systeimager initramfs creation.
%package webgui
Summary: SystemImager admin web interface.
Version: %ver
Release: %rel
License: GPL
Group: Applications/System
BuildRoot: /tmp/%{name}-%{ver}-root
BuildArch: noarch
Packager: %packager
URL: http://wiki.systemimager.org/
Distribution: System Installation Suite
Requires: systemimager-server = %{version}
Requires: httpd php php-json
# Need common package to be installed so config_scheme.json is avalable for %post
Requires(post): systemimager-common = %{version}
BuildRequires: httpd
%description webgui
SystemImager admin web interface.
%prep
# Prepare source tree
%setup -q
%build
cd $RPM_BUILD_DIR/%{name}-%{version}/
# Make sure we can fin system utils like mkfs.cramfs (when building as non-root)
export PATH=/sbin:/usr/sbin:$PATH
# Build against installed libs, not our system lib which may not be the same version.
export LD_FLAGS=-L$RPM_BUILD_DIR/%{name}-%{version}/initrd_source/build_dir/lib
# Make sure we build the docs
./configure SI_BUILD_DOCS=1
# Only build everything if on x86, this helps with PPC build issues
%if %{_build_all}
#%{__make} %{?_smp_mflags} all
%{__make} -j1 all DESTDIR=%{buildroot} PREFIX=%_prefix DRACUT_BASEDIR=%_dracutbase
%{__make} -C doc/manual_source html
%else
%{__make} binaries DESTDIR=%{buildroot} PREFIX=%_prefix DRACUT_BASEDIR=%_dracutbase
%endif
# Fix docdir in ./sbin/si_* commands when usage() will refere to this path.
for FILE in ./sbin/si_mkbootpackage ./README
do
sed -i -e 's|SYSTEMIMAGER_DOC_DIR|%{_pkgdocdir}|g' $FILE
done
# Build an initrd.img for current kernel.
# 1st: recreate a full dracut local basedir so --local option can be used.
echo "Creating local dracut environment"
LOCAL_DRACUT_BASEDIR=./tmp/dracutbase
test -d $LOCAL_DRACUT_BASEDIR && /bin/rm -rf $LOCAL_DRACUT_BASEDIR
mkdir -p $LOCAL_DRACUT_BASEDIR
test -d $LOCAL_DRACUT_BASEDIR || exit 1
cp -r %_usr%_dracutbase/* $LOCAL_DRACUT_BASEDIR/
# Remove old systemimager parasit version that we could have copied.
rm -rf $LOCAL_DRACUT_BASEDIR/modules.d/*systemimager
# Copy our module locally while doing correct STRINGS replacement.
make install_dracut DRACUT_MODULES=$LOCAL_DRACUT_BASEDIR/modules.d
#mkdir -p $LOCAL_DRACUT_BASEDIR/modules.d/%{dracut_module_index}systemimager
#for FILE in ./lib/dracut/modules.d/%{dracut_module_index}systemimager/{check,install,*.sh}
#do
# ./tools/si_install -b -m 755 $FILE $LOCAL_DRACUT_BASEDIR/modules.d/%{dracut_module_index}systemimager/
#done
#cp -r ./lib/dracut/modules.d/%{dracut_module_index}systemimager/plymouth_theme $LOCAL_DRACUT_BASEDIR/modules.d/%{dracut_module_index}systemimager/
test -x /usr/bin/lsinitrd && ln -s /usr/bin/lsinitrd $LOCAL_DRACUT_BASEDIR/lsinitrd.sh # only required in newer dracut versions.
# move to local modules dir so we can use dracut --local
cd $LOCAL_DRACUT_BASEDIR/
SIS_DATAROOTDIR=$RPM_BUILD_DIR/%{name}-%{version}/conf SIS_CONFDIR=$RPM_BUILD_DIR/%{name}-%{version}/etc dracutbasedir=$(pwd) SI_INITRD_TEMPLATE=../../initrd_source/skel perl -I ../../lib ../../sbin/si_mkbootpackage --dracut-opts="--local" --destination ../..
#dracut --force --local --add systemimager --no-hostonly --no-hostonly-cmdline --no-hostonly-i18n ../../../initrd.img $(uname -r)
%install
cd $RPM_BUILD_DIR/%{name}-%{version}/
%if %{_build_all}
make install_all DESTDIR=%{buildroot} PREFIX=%_prefix DRACUT_BASEDIR=%_dracutbase # DOC=%{buildroot}%{_pkgdocdir}
cp ./initrd.img %{buildroot}/%{_datarootdir}/systemimager/boot/%{_arch}/standard/initrd.img
cp ./kernel %{buildroot}/%{_datarootdir}/systemimager/boot/%{_arch}/standard/kernel
test -f ./config && cp ./config %{buildroot}/%{_datarootdir}/systemimager/boot/%{_arch}/standard/config
cp version.txt %{buildroot}/%{_datarootdir}/systemimager/boot/%{_arch}/standard/version.txt
%else
%{__make} install_binaries DESTDIR=%{buildroot} PREFIX=%_prefix DRACUT_BASEDIR=%_dracutbase
%endif
# Some things that get duplicated because there are multiple calls to
# the make install_* phases.
find %{buildroot} -name \*~ -exec rm -f '{}' \;
%clean
#__rm -rf $RPM_BUILD_DIR/%{name}-%{version}/
%__rm -rf %{buildroot}
%if %{_build_all}
%pre -n dracut-%{name}
test -x /usr/sbin/mkfs.jfs || echo "WARNING: /usr/sbin/mkfs.jfs mot present. JFS support not available."
test -x /usr/sbin/mkfs.reiserfs || echo "WARNING: /usr/sbin/mkfs.reiserfs mot present. ReiserFS support not available."
%pre server
# /etc/systemimager/rsyncd.conf is now generated from stubs stored
# in /etc/systemimager/rsync_stubs. if upgrading from an early
# version, we need to create stub files for all image entries
if [ -f %{_sysconfdir}/systemimager/rsyncd.conf -a \
! -d %{_sysconfdir}/systemimager/rsync_stubs ]; then
echo "You appear to be upgrading from a pre-rsync stubs release."
echo "%{_sysconfdir}/systemimager/rsyncd.conf is now auto-generated from stub"
echo "files stored in %{_sysconfdir}/systemimager/rsync_stubs."
echo "Backing up %{_sysconfdir}/systemimager/rsyncd.conf to:"
echo -n " %{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs... "
mv %{_sysconfdir}/systemimager/rsyncd.conf \
%{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs
## leave an extra copy around so the postinst knows to make stub files from it
cp %{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs \
%{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs.tmp
echo "done."
fi
%post server
# First we check for rsync service under xinetd and get rid of it
# also note the use of DURING_INSTALL, which is used to
# support using this package in Image building without affecting
# processes running on the parrent
# If systemd
%if 0%{?_unitdir:1}
systemctl disable rsyncd.socket
%else
if [[ -a %{_sysconfdir}/xinetd.d/rsync ]]; then
mv %{_sysconfdir}/xinetd.d/rsync %{_sysconfdir}/xinetd.d/rsync.presis~
`pidof xinetd > /dev/null`
if [[ $? == 0 ]]; then
if [ -z $DURING_INSTALL ]; then
%{_sysconfdir}/init.d/xinetd restart
fi
fi
fi
%endif
# Then we make sure that a config file exists and is accessible by webgui.
perl - << EOF
use SystemImager::JConfig;
EOF
chmod 644 /etc/systemimager/systemimager.json
chown apache /etc/systemimager/systemimager.json
# If we are upgrading from a pre-rsync-stubs release, the preinst script
# will have left behind a copy of the old rsyncd.conf file. we need to parse
# it and make stubs files for each image.
# This assumes that this file has been managed by systemimager, and
# that there is nothing besides images entries that need to be carried
# forward.
in_image_section=0
current_image=""
if [ -f %{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs.tmp ]; then
echo "Migrating image entries from existing %{_sysconfdir}/systemimager/rsyncd.conf to"
echo "individual files in the %{_sysconfdir}/systemimager/rsync_stubs/ directory..."
while read line; do
## Ignore all lines until we get to the image section
if [ $in_image_section -eq 0 ]; then
echo $line | grep -q "^# only image entries below this line"
if [ $? -eq 0 ]; then
in_image_section=1
fi
else
echo $line | grep -q "^\[.*]$"
if [ $? -eq 0 ]; then
current_image=$(echo $line | sed 's/^\[//' | sed 's/\]$//')
echo -e "\tMigrating entry for $current_image"
if [ -e "%{_sysconfdir}/systemimager/rsync_stubs/40$current_image" ]; then
echo -e "\t%{_sysconfdir}/systemimager/rsync_stubs/40$current_image already exists."
echo -e "\tI'm not going to overwrite it with the value from"
echo -e "\t%{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs.tmp"
current_image=""
fi
fi
if [ "$current_image" != "" ]; then
echo "$line" >> %{_sysconfdir}/systemimager/rsync_stubs/40$current_image
fi
fi
done < %{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs.tmp
rm -f %{_sysconfdir}/systemimager/rsyncd.conf-before-rsync-stubs.tmp
echo "Migration complete - please make sure to migrate any configuration you have"
echo " made in %{_sysconfdir}/systemimager/rsyncd.conf outside of the image section."
fi
## END make stubs from pre-stub %{_sysconfdir}/systemimager/rsyncd.conf file
/usr/sbin/si_mkrsyncd_conf
# If systemd
%if 0%{?_unitdir:1}
%systemd_post systemimager-server-rsyncd
%systemd_post systemimager-server-netbootmond
%systemd_post systemimager-server-monitord
# else not systemd
%else
if [[ -a /usr/lib/lsb/install_initd ]]; then
/usr/lib/lsb/install_initd %{_sysconfdir}/init.d/systemimager-server-rsyncd
/usr/lib/lsb/install_initd %{_sysconfdir}/init.d/systemimager-server-netbootmond
/usr/lib/lsb/install_initd %{_sysconfdir}/init.d/systemimager-server-monitord
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --add systemimager-server-rsyncd
/sbin/chkconfig --add systemimager-server-netbootmond
/sbin/chkconfig --add systemimager-server-monitord
fi
# endif systemd
%endif
%preun server
if [ $1 != 0 ]; then
echo
echo "WARNING: this seems to be an upgrade!"
echo
echo "Remember that this operation does not touch the following objects:"
echo " - master, pre-install, post-install scripts"
echo " - images"
echo " - overrides"
echo
fi
# if systemd
%if 0%{?_unitdir:1}
%systemd_preun systemimager-server-rsyncd
%systemd_preun systemimager-server-netbootmond
%systemd_preun systemimager-server-monitord
# else not systemd
%else
if [ $1 = 0 ]; then
%{_sysconfdir}/init.d/systemimager-server-rsyncd stop
%{_sysconfdir}/init.d/systemimager-server-netbootmond stop
%{_sysconfdir}/init.d/systemimager-server-monitord stop
if [[ -a /usr/lib/lsb/remove_initd ]]; then
/usr/lib/lsb/remove_initd %{_sysconfdir}/init.d/systemimager-server-rsyncd
/usr/lib/lsb/remove_initd %{_sysconfdir}/init.d/systemimager-server-netbootmond
/usr/lib/lsb/remove_initd %{_sysconfdir}/init.d/systemimager-server-monitord
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --del systemimager-server-rsyncd
/sbin/chkconfig --del systemimager-server-netbootmond
/sbin/chkconfig --del systemimager-server-monitord
fi
if [[ -a %{_sysconfdir}/xinetd.d/rsync.presis~ ]]; then
mv %{_sysconfdir}/xinetd.d/rsync.presis~ %{_sysconfdir}/xinetd.d/rsync
`pidof xinetd > /dev/null`
if [[ $? == 0 ]]; then
%{_sysconfdir}/init.d/xinetd restart
fi
fi
else
# This is an upgrade: restart the daemons.
echo "Restarting services..."
(%{_sysconfdir}/init.d/systemimager-server-rsyncd status >/dev/null 2>&1 && \
%{_sysconfdir}/init.d/systemimager-server-rsyncd restart) || true
(%{_sysconfdir}/init.d/systemimager-server-netbootmond status >/dev/null 2>&1 && \
%{_sysconfdir}/init.d/systemimager-server-netbootmond restart) || true
(%{_sysconfdir}/init.d/systemimager-server-monitord status >/dev/null 2>&1 && \
%{_sysconfdir}/init.d/systemimager-server-monitord restart) || true
fi
# endif systemd/not systemd
%endif
%post server-flamethrower
# if systemd
%if 0%{?_unitdir:1}
%systemd_post systemimager-server-flamethrowerd
# else not systemd
%else
if [[ -a /usr/lib/lsb/install_initd ]]; then
/usr/lib/lsb/install_initd %{_sysconfdir}/init.d/systemimager-server-flamethrowerd
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --add systemimager-server-flamethrowerd
/sbin/chkconfig systemimager-server-flamethrowerd off
fi
# endif systemd/not systemd
%endif
%preun server-flamethrower
# if systemd
%if 0%{?_unitdir:1}
%systemd_preun systemimager-server-flamethrowerd
# else not systemd
%else
if [ $1 = 0 ]; then
%{_sysconfdir}/init.d/systemimager-server-flamethrowerd stop
if [[ -a /usr/lib/lsb/remove_initd ]]; then
/usr/lib/lsb/remove_initd %{_sysconfdir}/init.d/systemimager-server-flamethrowerd
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --del systemimager-server-flamethrowerd
fi
else
# This is an upgrade: restart the daemon.
(%{_sysconfdir}/init.d/systemimager-server-flamethrowerd status >/dev/null 2>&1 && \
%{_sysconfdir}/init.d/systemimager-server-flamethrowerd restart) || true
fi
# endif systemd/not systemd
%endif
%post webgui
# Make sure systemcimager configuration file is initalized.
php %{_exec_prefix}/lib/systemimager/init_systemimager_config.php > /dev/null
%post server-bittorrent
# if systemd
%if 0%{?_unitdir:1}
%systemd_post systemimager-server-bittorrent
# else not systemd
%else
if [[ -a /usr/lib/lsb/install_initd ]]; then
/usr/lib/lsb/install_initd %{_sysconfdir}/init.d/systemimager-server-bittorrent
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --add systemimager-server-bittorrent
/sbin/chkconfig systemimager-server-bittorrent off
fi
# endif systemd/not systemd
%endif
%pre server-bittorrent
echo "checking for a tracker binary..."
BT_TRACKER_BIN=`(which bittorrent-tracker || which bttrack) 2>/dev/null`
if [ -z $BT_TRACKER_BIN ]; then
echo "WARNING: couldn't find a valid tracker binary!"
echo "--> Install the BitTorrent package (bittorrent for RH)."
echo "--> For details, please see http://wiki.systemimager.org/index.php/Quick_Start_HOWTO"
else
echo done
fi
echo "checking for a maketorrent binary..."
BT_MAKETORRENT_BIN=`(which maketorrent-console || which btmaketorrent) 2>/dev/null`
if [ -z $BT_MAKETORRENT_BIN ]; then
echo "WARNING: couldn't find a valid maketorrent binary!"
echo "--> Install the BitTorrent package (bittorrent for RH)."
echo "--> For details, please see http://wiki.systemimager.org/index.php/Quick_Start_HOWTO"
else
echo done
fi
echo "checking for a bittorrent binary..."
BT_BITTORRENT_BIN=`(which launchmany-console || which btlaunchmany) 2>/dev/null`
if [ -z $BT_BITTORRENT_BIN ]; then
echo "WARNING: couldn't find a valid bittorrent binary!"
echo "--> Install the BitTorrent package (bittorrent for RH)."
echo "--> For details, please see http://wiki.systemimager.org/index.php/Quick_Start_HOWTO"
else
echo done
fi
%preun server-bittorrent
# if systemd
%if 0%{?_unitdir:1}
%systemd_preun systemimager-server-bittorrent
# else not systemd
%else
if [ $1 = 0 ]; then
%{_sysconfdir}/init.d/systemimager-server-bittorrent stop
if [[ -a /usr/lib/lsb/remove_initd ]]; then
/usr/lib/lsb/remove_initd %{_sysconfdir}/init.d/systemimager-server-bittorrent
fi
if [[ -a /sbin/chkconfig ]]; then
/sbin/chkconfig --del systemimager-server-bittorrent
fi
else
# This is an upgrade: restart the daemon.
(%{_sysconfdir}/init.d/systemimager-server-bittorrent status >/dev/null 2>&1 && \
%{_sysconfdir}/init.d/systemimager-server-bittorrent restart) || true
fi
# endif systemd/not systemd
%endif
%files common
%defattr(-, root, root)
%{_bindir}/si_lsimage
%{_mandir}/man8/si_lsimage*
%{_mandir}/man7/autoinstall*
%dir %{perl_vendorlib}/SystemImager
%{perl_vendorlib}/SystemImager/Common.pm
%{perl_vendorlib}/SystemImager/Options.pm
%{perl_vendorlib}/SystemImager/UseYourOwnKernel.pm
%{perl_vendorlib}/SystemImager/JConfig.pm
%dir %{_datarootdir}/systemimager
%dir %{_datarootdir}/systemimager/conf
%{_datarootdir}/systemimager/conf/config_scheme.json
%dir %{_sysconfdir}/systemimager
%config %{_sysconfdir}/systemimager/UYOK.modules_to_exclude
%config %{_sysconfdir}/systemimager/UYOK.modules_to_include
%files server
%defattr(-, root, root)
%doc CHANGE.LOG COPYING CREDITS README TODO VERSION
%doc README.SystemImager_DHCP_options
%dir /var/lock/systemimager
%dir /var/log/systemimager