forked from finley/SystemImager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
848 lines (763 loc) · 42.3 KB
/
Makefile
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
#
# "SystemImager"
#
# Copyright (C) 2015-2019 Olivier Lahaye
# Copyright (C) 1999-2015 Brian Elliott Finley
# Copyright (C) 2001-2004 Hewlett-Packard Company <[email protected]>
#
# Others who have contributed to this code:
# Sean Dague <[email protected]>
#
# $Id$
# vi: set filetype=make:
#
# 2012.03.09 Brian Elliott Finley
# * Fix egrep regex so that e2fsprogs targets show with 'make show_all_targets'
#
#
# This program 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# ERRORS when running make:
# If you encounter errors when running "make", because make couldn't find
# certain things that it needs, and you are fortunate enough to be building
# on a Debian system, you can issue the following command to ensure that
# all of the proper tools are installed.
#
# On Debian, "apt-get build-dep systemimager ; apt-get install wget libssl-dev", will
# install all the right tools. Note that you need the deb-src entries in
# your /etc/apt/sources.list file.
#
#
# SystemImager file location standards:
# o images will be stored in: /var/lib/systemimager/images/
# o pre-install scripts: /var/lib/systemimager/scripts/pre-install/
# o autoinstall scripts: /var/lib/systemimager/scripts/main-install/
# o post-install scripts: /var/lib/systemimager/scripts/post-install/
# o tarball files for BT: /var/lib/systemimager/tarballs/
# o torrent files: /var/lib/systemimager/torrents/
# o override directories: /var/lib/systemimager/overrides/
# o images config files /var/lib/systemimager/configs/
#
# o web gui pages: /usr/share/systemimager/web-gui/
#
# o kernels: /usr/share/systemimager/boot/`arch`/flavor/
# o initrd.img: /usr/share/systemimager/boot/`arch`/flavor/
# o boel_binaries.tar.gz: /usr/share/systemimager/boot/`arch`/flavor/
#
# o perl libraries: /%{perl_vendorlib}
#
# o docs: Use distribution appropriate location.
# Defaults to /usr/share/doc/systemimager/
# for installs from tarball or source.
#
# o man pages: /usr/share/man/man8/
#
# o log files: /var/log/systemimager/
#
# o configuration files: /etc/systemimager/
# o rsyncd.conf: /etc/systemimager/rsyncd.conf
# o rsyncd init script: /etc/init.d/systemimager
# o netbootmond init script: /etc/init.d/netbootmond
#
# o tftp files will be copied to the appropriate destination (as determined
# by the local SysAdmin when running "mkbootserver".
#
# o user visible binaries: /usr/bin
# (si_lsimage, si_mkautoinstalldisk, si_mkautoinstallcd)
# o sysadmin binaries: /usr/sbin
# (all other binaries)
#
#
# Standards for pre-defined rsync modules:
# o boot (directory that holds architecture specific directories with
# boot files for clients)
# o overrides
# o scripts
# o torrents
#
#
DESTDIR :=
VERSION := $(shell cat VERSION)
DRACUT_MODULE_INDEX = 51
## is this an unstable release?
MINOR = $(shell echo $(VERSION) | cut -d "." -f 2)
UNSTABLE = 0
ifeq ($(shell echo "$(MINOR) % 2" | bc),1)
UNSTABLE = 1
endif
FLAVOR = $(shell cat FLAVOR)
TOPDIR := $(CURDIR)
# RELEASE_DOCS are toplevel files that should be included with all posted
# tarballs, but aren't installed onto the destination machine by default
RELEASE_DOCS = CHANGE.LOG COPYING CREDITS README VERSION
ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
TAR = $(shell gtar --version >/dev/null >&2 && echo gtar || echo tar)
# Follows is a set of arch manipulations to distinguish between ppc types
ifeq ($(ARCH),ppc64)
# Check if machine is Playstation 3
IS_PS3 = $(shell grep -q PS3 /proc/cpuinfo && echo 1)
ifeq ($(IS_PS3),1)
ARCH = ppc64-ps3
else
IS_PPC64 := 1
ifneq ($(shell ls /proc/iSeries 2>/dev/null),)
ARCH = ppc64-iSeries
endif
endif
endif
# is userspace 64bit
USERSPACE64 := 0
ifeq ($(ARCH),ia64)
USERSPACE64 := 1
endif
ifeq ($(ARCH),x86_64)
USERSPACE64 := 1
endif
ifneq ($(BUILD_ARCH),)
ARCH := $(BUILD_ARCH)
endif
#
# To be used by "make" for rules that can take it!
ifneq ($(shell ls -d /proc/cpuinfo 2>/dev/null),)
NCPUS := $(shell egrep -c '^processor' /proc/cpuinfo )
else
NCPUS := 1
endif
$(info Using $(NCPUS) CPU(s) for this task)
MANUAL_DIR = $(TOPDIR)/doc/manual_source
MANPAGE_DIR = $(TOPDIR)/doc/man
LIB_SRC = $(TOPDIR)/lib
SRC_DIR = $(TOPDIR)/src
BINARY_SRC = $(TOPDIR)/sbin
# destination directories
PREFIX = /usr
USR = $(DESTDIR)$(PREFIX)
ETC = $(DESTDIR)/etc
INITD = $(ETC)/init.d
ifneq ($(wildcard /usr/lib/systemd/system/systemd-halt.service),)
SYSTEMD_OS_UNIT_DIR = /usr/lib/systemd/system
else ifneq ($(wildcard /lib/systemd/system/systemd-halt.service),)
SYSTEMD_OS_UNIT_DIR = /lib/systemd/system
else
SYSTEMD_OS_UNIT_DIR = ""
endif
ifneq ("$(SYSTEMD_OS_UNIT_DIR)","")
SYSTEMD_UNIT_DIR = $(DESTDIR)$(SYSTEMD_OS_UNIT_DIR)
else
SYSTEMD_UNIT_DIR = "$(USR)/lib/systemd/system"
endif
SYSTEMD_SRC = $(TOPDIR)/etc/systemd/system
INITD_SRC = $(TOPDIR)/etc/init.d
DOC = $(USR)/share/doc/systemimager-doc
BIN = $(USR)/bin
SBIN = $(USR)/sbin
MAN8 = $(USR)/share/man/man8
#LIBEXEC_DEST = $(USR)/libexec/systemimager
LIBEXEC_DEST = $(USR)/lib/systemimager
LIB_DEST = $(DESTDIR)$(shell perl -V:vendorlib | sed s/vendorlib=\'// | sed s/\'\;//)
#LIB_DEST = $(USR)/lib/systemimager/perl
LOG_DIR = $(DESTDIR)/var/log/systemimager
LOCK_DIR = $(DESTDIR)/var/lock/systemimager
INITRD_DIR = $(TOPDIR)/initrd_source
INITRD_BUILD_DIR = $(INITRD_DIR)/build_dir
DRACUT_BASEDIR = $(shell test -d /usr/lib/dracut && echo "/lib/dracut" || echo "/share/dracut")
DRACUT_SYSDIR = /usr$(DRACUT_BASEDIR)
DRACUT_MODULES = $(USR)$(DRACUT_BASEDIR)/modules.d
CONF_SRC = $(TOPDIR)/conf/
CONF_DEST = $(USR)/share/systemimager/conf/
WEB_CONF_SRC = $(TOPDIR)/etc/
ifneq ($(shell ls -d /etc/apache2/sites-available 2>/dev/null),)
WEB_CONF_DEST = $(ETC)/apache2/sites-available
WEB_CONF_DIR = /etc/apache2/sites-available
else ifneq ($(shell ls -d /etc/apache2/vhosts.d 2>/dev/null),)
WEB_CONF_DEST = $(ETC)/apache2/vhosts.d
WEB_CONF_DIR = /etc/apache2/vhosts.d
else ifneq ($(shell ls -d /etc/httpd/conf.d/ 2>/dev/null),)
WEB_CONF_DEST = $(ETC)/httpd/conf.d
WEB_CONF_DIR = /etc/httpd/conf.d
else ifeq ($(WEB_CONF_DIR),)
WEB_CONF_DEST =
else ifeq ($(shell ls -d $(WEB_CONF_DIR)),)
$(error WEB_CONF_DIR=$(WEB_CONF_DIR) directory does not exists)
else
WEB_CONF_DEST = $(ETC)/$(WEB_CONF_DIR)
endif
WEB_GUI_SRC = $(TOPDIR)/webgui
WEB_GUI_DEST = $(USR)/share/systemimager/webgui
BOOT_BIN_DEST = $(USR)/share/systemimager/boot/$(ARCH)/$(FLAVOR)
BOOT_BIN_PATH = $(PREFIX)/share/systemimager/boot/$(ARCH)/$(FLAVOR)
BOOT_NOARCH_DEST = $(USR)/share/systemimager/boot
BOOT_NOARCH_PATH = $(PREFIX)/share/systemimager/boot
PXE_CONF_SRC = etc/pxelinux.cfg
PXE_CONF_DEST = $(ETC)/systemimager/pxelinux.cfg
KBOOT_CONF_SRC = etc/kboot.cfg
KBOOT_CONF_DEST = $(ETC)/systemimager/kboot.cfg
BINARIES := si_mkautoinstallcd si_mkautoinstalldisk si_psh si_pcp si_pushoverrides si_clusterconfig
SBINARIES := si_addclients si_cpimage si_getimage si_lint si_mkdhcpserver si_mkdhcpstatic si_mkautoinstallscript si_mvimage si_pushupdate si_pushinstall si_rmimage si_mkrsyncd_conf si_mkclientnetboot si_netbootmond
BT_SBINARIES := si_installbtimage
CLIENT_SBINARIES := si_updateclient si_prepareclient
COMMON_BINARIES := si_lsimage si_mkbootpackage
WEB_SRC := index.php edit_clusters.php manage_netboot.php edit_dhcp.php health_console.php client_console.php client_list.php edit_config.php services.json statuses.json functions.js functions.php push_client_defs.php push_client_logs.php css/Background.png css/SystemImagerBanner.png css/flex_table.css css/screen.css css/sliders.css images/Alecive-Flatwoken-Apps-Dialog-Apply.svg images/Alecive-Flatwoken-Apps-Dialog-Close.svg images/Alecive-Flatwoken-Apps-Dialog-Logout.svg images/Alecive-Flatwoken-Apps-Dialog-Refresh.svg images/Alecive-Flatwoken-Apps-Settings.svg images/yes.svg images/no.svg images/client_list.png images/edit_clusters.png images/edit_config.png images/edit_dhcp.png images/health_console.png images/manage_netboot.png COPYRIGHTS
IMAGESRC = $(TOPDIR)/var/lib/systemimager/images
IMAGEDEST = $(DESTDIR)/var/lib/systemimager/images
WARNING_FILES = $(IMAGESRC)/README $(IMAGESRC)/CUIDADO $(IMAGESRC)/ACHTUNG
AUTOINSTALL_SCRIPT_DIR = $(DESTDIR)/var/lib/systemimager/scripts
AUTOINSTALL_TORRENT_DIR = $(DESTDIR)/var/lib/systemimager/torrents
AUTOINSTALL_TARBALL_DIR = $(DESTDIR)/var/lib/systemimager/tarballs
OVERRIDES_DIR = $(DESTDIR)/var/lib/systemimager/overrides
OVERRIDES_README = $(TOPDIR)/var/lib/systemimager/overrides/README
FLAMETHROWER_STATE_DIR = $(DESTDIR)/var/run/systemimager/flamethrower
RSYNC_STUB_DIR = $(ETC)/systemimager/rsync_stubs
SI_INSTALL = $(TOPDIR)/tools/si_install --si-prefix=$(PREFIX)
# Some root tools are probably needed to build SystemImager packages, so
# explicitly add the right paths here. -AR-
PATH := $(PATH):/sbin:/usr/sbin:/usr/local/sbin
########################################################################
#
# BEGIN Give friendly config and packages help. -BEF-
#
IS_CONFIGURED = $(shell test -e config.inc && echo 1 || echo 0)
ifeq ($(IS_CONFIGURED),0)
.PHONY: all
all: show_build_deps
else
include config.inc
# build everything, install nothing
.PHONY: all
all: install_initrd_template manpages
endif
#
# END Give friendly config and packages help. -BEF-
#
########################################################################
include $(TOPDIR)/initrd_source/initrd.rul
binaries: $(BOEL_BINARIES_TARBALL) $(INITRD_BOOTFILES_DIR).build
# a full install (usefull for packaging)
.PHONY: install_all
install_all: install_server_all install_client install_initrd_template
# a complete server install
.PHONY: install_server_all
install_server_all: install_server install_server_bittorrent install_server_flamethrower install_common install_binaries install_dracut install_webgui
# a complete client install
.PHONY: install_client_all
install_client_all: install_client install_common install_initrd_template
# install server-only architecture independent files
.PHONY: install_server
install_server: install_server_man \
install_configs \
install_server_libs
$(SI_INSTALL) -d $(BIN)
$(SI_INSTALL) -d $(SBIN)
$(foreach binary, $(BINARIES), \
$(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(BIN);)
$(foreach binary, $(SBINARIES), \
$(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(SBIN);)
ifneq ("$(SYSTEMD_OS_UNIT_DIR)","")
$(SI_INSTALL) -m 755 $(BINARY_SRC)/si_mkbootserver.systemd $(SBIN)/si_mkbootserver
else
$(SI_INSTALL) -m 755 $(BINARY_SRC)/si_mkbootserver.sysvinit $(SBIN)/si_mkbootserver
endif
$(SI_INSTALL) -d -m 755 $(LOG_DIR)
$(SI_INSTALL) -d -m 755 $(LOCK_DIR)
$(SI_INSTALL) -d -m 755 $(BOOT_BIN_DEST)
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/configs
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/disks-layouts
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/network-configs
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/main-install
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/pre-install
$(SI_INSTALL) -m 644 --backup --text \
$(TOPDIR)/var/lib/systemimager/scripts/pre-install/99all.harmless_example_script \
$(AUTOINSTALL_SCRIPT_DIR)/pre-install/
$(SI_INSTALL) -m 644 --backup --text \
$(TOPDIR)/var/lib/systemimager/scripts/pre-install/README \
$(AUTOINSTALL_SCRIPT_DIR)/pre-install/
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_SCRIPT_DIR)/post-install
$(SI_INSTALL) -m 644 --backup --text \
$(TOPDIR)/var/lib/systemimager/scripts/post-install/99all.harmless_example_script \
$(TOPDIR)/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids\
$(TOPDIR)/var/lib/systemimager/scripts/post-install/11all.replace_byid_device\
$(AUTOINSTALL_SCRIPT_DIR)/post-install/
$(SI_INSTALL) -m 644 --backup --text \
$(TOPDIR)/var/lib/systemimager/scripts/post-install/README \
$(AUTOINSTALL_SCRIPT_DIR)/post-install/
$(SI_INSTALL) -d -m 755 $(OVERRIDES_DIR)
$(SI_INSTALL) -m 644 $(OVERRIDES_README) $(OVERRIDES_DIR)
$(SI_INSTALL) -d -m 755 $(PXE_CONF_DEST)
$(SI_INSTALL) -m 644 --backup --text $(PXE_CONF_SRC)/message.txt \
$(PXE_CONF_DEST)/message.txt
$(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg \
$(PXE_CONF_DEST)/syslinux.cfg
$(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg.gfxboot \
$(PXE_CONF_DEST)/syslinux.cfg.gfxboot
$(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/systemimager.png \
$(PXE_CONF_DEST)/systemimager.png
$(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg.localboot \
$(PXE_CONF_DEST)/syslinux.cfg.localboot
$(SI_INSTALL) -m 644 --backup $(PXE_CONF_SRC)/syslinux.cfg.localboot \
$(PXE_CONF_DEST)/default
$(SI_INSTALL) -d -m 755 $(KBOOT_CONF_DEST)
# $(SI_INSTALL) -m 644 --backup --text $(KBOOT_CONF_SRC)/message.txt \
# $(KBOOT_CONF_DEST)/message.txt
$(SI_INSTALL) -m 644 --backup $(KBOOT_CONF_SRC)/localboot \
$(KBOOT_CONF_DEST)/
$(SI_INSTALL) -m 644 --backup $(KBOOT_CONF_SRC)/default \
$(KBOOT_CONF_DEST)/
$(SI_INSTALL) -d -m 755 $(IMAGEDEST)
$(SI_INSTALL) -m 644 $(WARNING_FILES) $(IMAGEDEST)
cp -a $(IMAGEDEST)/README $(IMAGEDEST)/DO_NOT_TOUCH_THESE_DIRECTORIES
# Install server service files
ifneq ($(wildcard $(SYSTEMD_OS_UNIT_DIR)),)
@echo "Installing systemd service files for systemimager."
mkdir -p $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-monitord.service $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-netbootmond.service $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-rsyncd.service $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/[email protected] $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-rsyncd.socket $(SYSTEMD_UNIT_DIR)
else
[ "$(INITD)" != "" ] || exit 1
@echo "Installing init.d service files for systemimager."
mkdir -p $(INITD)
$(SI_INSTALL) -b -m 755 $(INITD_SRC)/systemimager-server-rsyncd $(INITD)
$(SI_INSTALL) -b -m 755 $(INITD_SRC)/systemimager-server-netbootmond $(INITD)
$(SI_INSTALL) -b -m 755 $(INITD_SRC)/systemimager-server-monitord $(INITD)
endif
.PHONY: install_server_bittorrent
install_server_bittorrent: install_bittorrent_man
$(SI_INSTALL) -d $(SBIN)
$(SI_INSTALL) -d $(ETC)/systemimager
$(SI_INSTALL) -m 644 --backup etc/bittorrent.conf $(ETC)/systemimager/
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_TARBALL_DIR)
$(SI_INSTALL) -d -m 755 $(AUTOINSTALL_TORRENT_DIR)
$(foreach binary, $(BT_SBINARIES), \
$(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(SBIN);)
ifneq ($(wildcard $(SYSTEMD_OS_UNIT_DIR)),)
@echo "Installing systemd service files for bittorrent."
mkdir -p $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-bittorrent-seeder.service $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-bittorrent.service $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-bittorrent-tracker.service $(SYSTEMD_UNIT_DIR)
else
[ "$(INITD)" != "" ] || exit 1
@echo "Installing init.d service files for bittorrent."
mkdir -p $(INITD)
$(SI_INSTALL) -b -m 755 $(INITD_SRC)/systemimager-server-bittorrent $(INITD)
endif
.PHONY: install_server_flamethrower
install_server_flamethrower:
$(SI_INSTALL) -d $(ETC)/systemimager
$(SI_INSTALL) -m 644 etc/flamethrower.conf $(ETC)/systemimager/
$(SI_INSTALL) -d -m 755 $(FLAMETHROWER_STATE_DIR)
ifneq ($(wildcard $(SYSTEMD_OS_UNIT_DIR)),)
@echo "Installing systemd service files for flamethrower."
mkdir -p $(SYSTEMD_UNIT_DIR)
$(SI_INSTALL) -b -m 644 $(SYSTEMD_SRC)/systemimager-server-flamethrowerd.service $(SYSTEMD_UNIT_DIR)
else
[ "$(INITD)" != "" ] || exit 1
@echo "Installing init.d service files for flamethrower."
mkdir -p $(INITD)
$(SI_INSTALL) -b -m 755 $(INITD_SRC)/systemimager-server-flamethrowerd $(INITD)
endif
.PHONY: install_webgui
install_webgui:
ifeq ($(WEB_CONF_DEST),)
$(error Can't guess apache web sites configuration dir. Please set WEB_CONF_DIR)
endif
$(info Using distro WEB_CONF_DIR = $(WEB_CONF_DIR))
mkdir -p $(WEB_CONF_DEST)
$(SI_INSTALL) -b -m 644 $(WEB_CONF_SRC)/httpd.conf $(WEB_CONF_DEST)/systemimager.conf
mkdir -p $(WEB_GUI_DEST) $(WEB_GUI_DEST)/css $(WEB_GUI_DEST)/images
$(foreach file, $(WEB_SRC), \
$(SI_INSTALL) -m 755 $(WEB_GUI_SRC)/$(file) $(WEB_GUI_DEST)/$(file);)
mkdir -p $(LIBEXEC_DEST)
$(SI_INSTALL) -m 755 $(LIB_SRC)/web_helpers/get-networks-helper $(LIBEXEC_DEST)
$(SI_INSTALL) -m 755 $(LIB_SRC)/web_helpers/clients-statuses-helper $(LIBEXEC_DEST)
$(SI_INSTALL) -m 644 $(LIB_SRC)/web_helpers/init_systemimager_config.php $(LIBEXEC_DEST)
# install client-only files
.PHONY: install_client
install_client: install_client_man install_client_libs
mkdir -p $(ETC)/systemimager
$(SI_INSTALL) -b -m 644 etc/updateclient.local.exclude \
$(ETC)/systemimager
$(SI_INSTALL) -b -m 644 etc/client.conf \
$(ETC)/systemimager
mkdir -p $(SBIN)
$(foreach binary, $(CLIENT_SBINARIES), \
$(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(SBIN);)
# install files common to both the server and client
.PHONY: install_common
install_common: install_common_man install_common_libs
mkdir -p $(ETC)/systemimager
$(SI_INSTALL) -b -m 644 etc/UYOK.modules_to_exclude $(ETC)/systemimager
$(SI_INSTALL) -b -m 644 etc/UYOK.modules_to_include $(ETC)/systemimager
mkdir -p $(BIN)
$(foreach binary, $(COMMON_BINARIES), \
$(SI_INSTALL) -m 755 $(BINARY_SRC)/$(binary) $(BIN);)
# install files for dracut-systemimager module.
.PHONY: install_dracut
install_dracut:
mkdir -p $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/
ifneq (,$(wildcard /usr/*/dracut/modules.d/99base/install)) # if "" not equals second argument (not empty, thus found), we're using an old dracut)
########## Old dracut ('check' and 'install' in charge of module install)
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/check $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/parse-systemimager-old.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/parse-systemimager.sh
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-genrules.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-start-old.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-netstart-old.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-sysroot-helper.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/install $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
sed -i -e "s|@@SIS_INITRD_TEMPLATE@@|$(BOOT_NOARCH_PATH)/initrd_template/|g" $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/install
else
########## New dracut ('module-setup.sh' in charge of module install)
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-start.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/parse-systemimager.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-sysroot.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/module-setup.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
sed -i -e "s|@@SIS_INITRD_TEMPLATE@@|$(BOOT_NOARCH_PATH)/initrd_template/|g" $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/module-setup.sh
endif
########## Files common to all dracut versions
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/autoinstall-lib.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/disks-layout.xsd $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/disksmgt-lib.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/files-to-exclude-from-image.txt $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/do_partitions.xsl $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/netmgt-lib.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/network.debian.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/network.rhel.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/network.suse.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/network-config.xsd $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/parse-local-cfg.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/si_inspect_client.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-check-ifaces.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-check-kernel.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-cleanup.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-deploy-client.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-log-dispatcher.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-log-dispatcher-old.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-init.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-install-rebooted-script.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-lib.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-load-network-infos.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-load-scripts-ecosystem.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-monitor-server.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-pingtest.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-timeout.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-wait-imaging.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-docker.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-flamethrower.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-nfs.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-rsync.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-ssh.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-template.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/systemimager-xmit-torrent.sh $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/README $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager
mkdir -p $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/Background.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/COPYRIGHTS $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/README $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/hide_box.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_bootloader.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_format.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_init.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_partition.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_postinstall.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_preinstall.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/icon_writeimage.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/no.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/action.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/dialog_bgnd.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/box.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/progress_gauge.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/README $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/SystemImagerBanner.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/systemimager.plymouth $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/systemimager.script $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
$(SI_INSTALL) -b -m 755 $(LIB_SRC)/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme/yes.png $(DRACUT_MODULES)/$(DRACUT_MODULE_INDEX)systemimager/plymouth_theme
# install server-only libraries
.PHONY: install_server_libs
install_server_libs:
mkdir -p $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Server.pm $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/HostRange.pm $(LIB_DEST)/SystemImager
mkdir -p $(USR)/share/systemimager/icons
$(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverinit.gif $(USR)/share/systemimager/icons
$(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverinst.gif $(USR)/share/systemimager/icons
$(SI_INSTALL) -m 644 $(LIB_SRC)/icons/serverok.gif $(USR)/share/systemimager/icons
$(SI_INSTALL) -m 644 $(LIB_SRC)/icons/servererror.gif $(USR)/share/systemimager/icons
mkdir -p $(USR)/share/systemimager/conf
$(SI_INSTALL) -m 644 $(CONF_SRC)/config_scheme.json $(CONF_DEST)
# mkdir -p $(LIB_DEST)/BootMedia
# mkdir -p $(LIB_DEST)/BootGen/Dev
# mkdir -p $(LIB_DEST)/BootGen/InitrdFS
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/BootMedia.pm $(LIB_DEST)/BootMedia
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/MediaLib.pm $(LIB_DEST)/BootMedia
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/alpha.pm $(LIB_DEST)/BootMedia
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootMedia/i386.pm $(LIB_DEST)/BootMedia
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/Dev.pm $(LIB_DEST)/BootGen/
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/Dev/Devfs.pm $(LIB_DEST)/BootGen/Dev/
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/Dev/Static.pm $(LIB_DEST)/BootGen/Dev/
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/InitrdFS.pm $(LIB_DEST)/BootGen/
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/InitrdFS/Cramfs.pm $(LIB_DEST)/BootGen/InitrdFS/
# $(SI_INSTALL) -m 644 $(LIB_SRC)/BootGen/InitrdFS/Ext2.pm $(LIB_DEST)/BootGen/InitrdFS/
# install client-only libraries
.PHONY: install_client_libs
install_client_libs:
mkdir -p $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Client.pm $(LIB_DEST)/SystemImager
# install common libraries
.PHONY: install_common_libs
install_common_libs:
mkdir -p $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/JConfig.pm $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Common.pm $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/Options.pm $(LIB_DEST)/SystemImager
$(SI_INSTALL) -m 644 $(LIB_SRC)/SystemImager/UseYourOwnKernel.pm $(LIB_DEST)/SystemImager
mkdir -p $(LIBEXEC_DEST)
#$(SI_INSTALL) -m 755 $(LIB_SRC)/confedit $(LIBEXEC_DEST)
# install the initscript & config files for the server
.PHONY: install_configs
install_configs:
$(SI_INSTALL) -d $(ETC)/systemimager
$(SI_INSTALL) -m 644 etc/systemimager.conf $(ETC)/systemimager/
$(SI_INSTALL) -m 644 --backup etc/cluster.xml $(ETC)/systemimager/
$(SI_INSTALL) -m 644 etc/autoinstallscript.template $(ETC)/systemimager/
$(SI_INSTALL) -m 644 etc/autoinstallconf.template $(ETC)/systemimager/
$(SI_INSTALL) -m 644 etc/getimage.exclude $(ETC)/systemimager/
mkdir -p $(RSYNC_STUB_DIR)
$(SI_INSTALL) -b -m 644 etc/rsync_stubs/10header $(RSYNC_STUB_DIR)
[ -f $(RSYNC_STUB_DIR)/99local ] \
&& $(SI_INSTALL) -b -m 644 etc/rsync_stubs/99local $(RSYNC_STUB_DIR)/99local.dist~ \
|| $(SI_INSTALL) -b -m 644 etc/rsync_stubs/99local $(RSYNC_STUB_DIR)
$(SI_INSTALL) -b -m 644 etc/rsync_stubs/README $(RSYNC_STUB_DIR)
########## END service files ##########
########## BEGIN man pages ##########
# build all of the manpages
.PHONY: manpages install_server_man install_client_man install_common_man install_bittorrent_man install_docs docs
ifeq ($(SI_BUILD_DOCS),1)
manpages:
$(MAKE) -C $(MANPAGE_DIR) TOPDIR=$(TOPDIR)
# install the manpages for the server
install_server_man: manpages
cd $(MANPAGE_DIR) && $(MAKE) install_server_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
# install the manpages for the client
install_client_man: manpages
cd $(MANPAGE_DIR) && $(MAKE) install_client_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
# install manpages common to the server and client
install_common_man: manpages
cd $(MANPAGE_DIR) && $(MAKE) install_common_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
install_bittorrent_man: manpages
cd $(MANPAGE_DIR) && $(MAKE) install_bittorrent_man TOPDIR=$(TOPDIR) PREFIX=$(PREFIX) $@
########## END man pages ##########
# installs the manual and some examples
install_docs: docs
mkdir -p $(DOC)
cp -a $(MANUAL_DIR)/html $(DOC)
#cp $(MANUAL_DIR)/*.ps $(MANUAL_DIR)/*.pdf $(DOC)
rsync -av --exclude 'CVS/' --exclude '.svn/' doc/examples/ $(DOC)/examples/
#XXX $(SI_INSTALL) -m 644 doc/media-api.txt $(DOC)/
# builds the manual from SGML source
docs:
#$(MAKE) -C $(MANUAL_DIR) html ps pdf
$(MAKE) -C $(MANUAL_DIR) html
endif
.PHONY: install
install:
@echo ''
@echo 'Try "make help", and/or read README for installation details.'
@echo ''
.PHONY: install_binaries
install_binaries: install_boot_files
.PHONY: source_tarball
source_tarball: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2.sign
$(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2.sign: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
cd $(TOPDIR)/tmp && gpg --detach-sign -a --output systemimager-$(VERSION).tar.bz2.sign systemimager-$(VERSION).tar.bz2
cd $(TOPDIR)/tmp && gpg --verify systemimager-$(VERSION).tar.bz2.sign
$(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2: $(TOPDIR)/systemimager.spec
rm -fr $(TOPDIR)/tmp
if [ -d $(TOPDIR)/.svn ]; then \
mkdir -p $(TOPDIR)/tmp; \
svn export . $(TOPDIR)/tmp/systemimager-$(VERSION); \
else \
make distclean && mkdir -p $(TOPDIR)/tmp/systemimager-$(VERSION); \
(cd $(TOPDIR) && $(TAR) --exclude=tmp --exclude=.git -cvf - .) | (cd $(TOPDIR)/tmp/systemimager-$(VERSION) && $(TAR) -xvf -); \
fi
ifeq ($(UNSTABLE), 1)
if [ -f README.unstable ]; then \
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cp README README.tmp; \
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cp README.unstable README; \
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && cat README.tmp >> README; \
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && rm README.tmp; \
fi
PKG_REL=`test -d .git && git show --pretty='format:%ci'|head -1|sed -e 's/ .*//g' -e 's/-//g' -e 's/$$/git/' -e 's/^/0./' || echo 1`; \
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && \
sed -i -e "s/##PKG_REL##/$${PKG_REL}/g" \
systemimager.spec \
lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/module-setup.sh \
lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/install && \
sed -i -e "s/##PKG_REL##/~$${PKG_REL}-1/g" \
debian/changelog
else
cd $(TOPDIR)/tmp/systemimager-$(VERSION) && \
sed -i -e "s/##PKG_REL##/1/g" \
systemimager.spec \
lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/module-setup.sh \
lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/install && \
sed -i -e "s/##PKG_REL##/-1/g" \
debian/changelog
endif
rm -f $(TOPDIR)/tmp/systemimager-$(VERSION)/README.unstable
perl -pi -e "s/^%define\s+ver\s+\d+\.\d+\.\d+.*/%define ver $(VERSION)/" \
$(TOPDIR)/tmp/systemimager-$(VERSION)/systemimager.spec
sed -i -e "s/##VERSION##/$(VERSION)/g" \
$(TOPDIR)/tmp/systemimager-$(VERSION)/lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/module-setup.sh \
$(TOPDIR)/tmp/systemimager-$(VERSION)/lib/dracut/modules.d/$(DRACUT_MODULE_INDEX)systemimager/install
find $(TOPDIR)/tmp/systemimager-$(VERSION) -type f -exec chmod ug+r {} \;
find $(TOPDIR)/tmp/systemimager-$(VERSION) -type d -exec chmod ug+rx {} \;
cd $(TOPDIR)/tmp && $(TAR) -ch systemimager-$(VERSION) | bzip2 > systemimager-$(VERSION).tar.bz2
@echo
@echo "source tarball has been created in $(TOPDIR)/tmp"
@echo
# make the srpms for systemimager
.PHONY: srpm
srpm: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2 $(TOPDIR)/systemimager.spec
rpmbuild --define '%dist %{nil}' -ts $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
# make the rpms for systemimager
.PHONY: rpm rpms
rpms: rpm
rpm: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2 $(TOPDIR)/systemimager.spec
rpmbuild -tb $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
# make the debs for systemimager
#
# I wonder if installing libpam-dev would eliminate the need for
# "--disable-login --disable-su" in initrd_source/make.d/util-linux.rul
# ?? -BEF- If so, we should add libpam-dev to UBUNTU_PRECISE_BUILD_DEPS
# in initrd_source/make.d/util-linux.rul.
#
UBUNTU_PRECISE_BUILD_DEPS += dos2unix docbook-utils libncurses-dev
.PHONY: deb debs
debs: deb
deb: $(TOPDIR)/tmp/systemimager-$(VERSION).tar.bz2
# Check package version.
@(if [ ! "`dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2`" = $(VERSION) ]; then \
echo "ERROR: versions in debian/changelog doesn't match with version specified into the file VERSION"; \
echo "Please fix it."; \
exit 1; \
else \
exit 0; \
fi)
@cd $(TOPDIR)/tmp && $(TAR) xvjf systemimager-$(VERSION).tar.bz2
@cd $(TOPDIR)/tmp/systemimager-$(VERSION) && make -f debian/rules debian/control
@cd $(TOPDIR)/tmp/systemimager-$(VERSION) && dpkg-buildpackage -rfakeroot -uc -us
@echo "=== deb packages for systemimager ==="
@ls -l $(TOPDIR)/tmp/*.deb
@echo "====================================="
# removes object files, docs, editor backup files, etc.
.PHONY: clean
clean: initrd_clean
-$(MAKE) -C $(MANPAGE_DIR) clean
-$(MAKE) -C $(MANUAL_DIR) clean
## where the tarballs are built
-rm -rf tmp
## editor backups
-find . -name "*~" -exec rm -f {} \;
-find . -name "#*#" -exec rm -f {} \;
-find . -name ".#*" -exec rm -f {} \;
rm -f config.inc config.log config.status
# same as clean, but also removes downloaded source, stamp files, etc.
.PHONY: distclean
distclean: clean initrd_distclean
-rm -rf $(SRC_DIR)
.PHONY: help
help: show_build_deps
#
#
# Show me a list of all targets in this entire build heirarchy
.PHONY: show_targets
show_targets:
@echo
@echo Makefile targets you are probably most interested in:
@echo ---------------------------------------------------------------------
@echo "all"
@echo " Build everything you need for your machine's architecture."
@echo " "
@echo "install_client_all"
@echo " Install all files needed by a client."
@echo " "
@echo "install_server_all"
@echo " Install all files needed by a server."
@echo " "
@echo "install_dracut"
@echo " Install all files needed by dracut (dracut module)."
@echo " "
@echo "source_tarball"
@echo " Make a source tarball for distribution."
@echo " "
@echo " Includes SystemImager source only. Source for all"
@echo " the tools SystemImager depends on will be found in /usr/src "
@echo " or will be automatically downloaded at build time."
@echo " "
@echo "rpm"
@echo " Build all of the RPMs that can be build on your platform."
@echo ""
@echo "srpm"
@echo " Build yourself a source RPM."
@echo ""
@echo "deb"
@echo " Build all of the debs that can be build on your platform."
@echo ""
@echo "show_build_deps"
@echo " Shows the list of packages necessary for building on"
@echo " various distributions and releases."
@echo
@echo "show_all_targets"
@echo " Show all available targets."
@echo
.PHONY: show_build_deps
show_build_deps:
@echo "Before you can build SystemImager, you'll need to do the following:"
@echo
@echo "1) Install the appropriate build dependencies for your distribution."
@echo " The easiest path is to cut and paste the command below that is"
@echo " appropriate for your distribution."
@echo
@echo " Ubuntu 12.04 and newer:"
@echo " apt-get install build-essential rpm flex $(UBUNTU_PRECISE_BUILD_DEPS)"
@echo
@echo " Ubuntu 6.06:"
@echo " apt-get install build-essential flex $(UBUNTU_DAPPER_BUILD_DEPS)"
@echo
@echo " RHEL6, CentOS6, and friends:"
@echo " yum install rpm-build wget flex bc docbook-utils dos2unix lzop PyXML $(RHEL6_BUILD_DEPS)"
@echo
@echo " Debian Stable:"
@echo " apt-get install build-essential flex $(DEBIAN_STABLE_BUILD_DEPS)"
@echo
@echo " NOTE: Other distro versions may build fine, and are simply untested by"
@echo " the SystemImage dev team."
@echo
@echo "2) Run './configure'"
@echo
@echo "3) Run 'make show_targets' to see a list of make targets from which you can"
@echo " choose."
@echo
.PHONY: show_all_targets
SHOW_TARGETS_ALL_MAKEFILES = $(shell find . make.d/ initrd_source/ initrd_source/make.d/ -maxdepth 1 -name 'Makefile' -or -name '*.rul' )
show_all_targets:
@echo All Available Targets Include:
@echo ---------------------------------------------------------------------
@cat $(SHOW_TARGETS_ALL_MAKEFILES) | egrep '^[a-zA-Z0-9_]+:' | sed 's/:.*//' | sort -u
@echo