forked from faiproject/fai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (94 loc) · 5.05 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
include VERSION
SHELL=/bin/bash
DESTDIR=$(shell pwd)/debian/tmp
export DOCDIR = $(shell pwd)/debian/fai-doc/usr/share/doc/fai-doc
LIBDIR = $(DESTDIR)/usr/lib/fai
SHAREDIR = $(DESTDIR)/usr/share/fai
USRSBIN_SCRIPTS = fai-make-nfsroot fai-setup fcopy ftar install_packages fai-chboot fai-monitor fai-cd fai faireboot fai-statoverride setup-storage dhcp-edit fai-new-mac fai-diskimage
USRBIN_SCRIPTS = fai-class fai-do-scripts fai-mirror fai-debconf device2grub policy-rc.d.fai ainsl fai-link fai-sed fai-monitor-gui fai-deps fai-mk-configspace
# for syntax checks
BASH_SCRIPTS = bin/fai bin/fai-cd bin/fai-class bin/fai-debconf bin/fai-do-scripts bin/fai-make-nfsroot bin/fai-mirror bin/fai-setup bin/fai-diskimage bin/fai-statoverride bin/faireboot bin/ftar bin/fai-link bin/fai-sed dev-utils/fai-kvm dev-utils/fai-mk-network examples/simple/basefiles/mk-basefile examples/simple/class/*.sh examples/simple/class/[0-9]* examples/simple/files/etc/rc.local/FAISERVER examples/simple/hooks/* examples/simple/scripts/*/* lib/fai-divert lib/fai-mount-disk lib/fai-savelog lib/fetch-basefile lib/get-boot-info lib/get-config-dir* lib/mkramdisk lib/mount2dir lib/prcopyleft lib/subroutines lib/task_* lib/updatebase lib/dracut/*/* bin/fai-mk-configspace lib/check-cross-arch
SHELL_SCRIPTS = bin/dhclient-fai-script bin/policy-rc.d.fai lib/check_status lib/create_resolv_conf lib/fai-abort lib/fai-disk-info lib/load_keymap_consolechars utils/mkdebmirror
PERL_SCRIPTS = lib/setup-storage/*.pm bin/ainsl bin/device2grub bin/dhcp-edit bin/fai-chboot bin/fai-deps bin/fai-monitor bin/fai-monitor-gui bin/fai-new-mac bin/fcopy bin/install_packages bin/setup-storage dev-utils/setup-storage_deps-graph.pl examples/simple/tests/Faitest.pm lib/dhclient-perl lib/fai-savelog-ftp
# do not include setup-storage and dracut subdir
EXCL=lib/dracut lib/setup-storage
libfiles=$(filter-out $(EXCL),$(wildcard lib/[a-z]*))
all:
$(MAKE) syntaxcheck
$(MAKE) -C doc all
syntaxcheck: bashismcheck shellcheck perlcheck
bashismcheck:
@if [ -x "$$(which checkbashisms 2>/dev/null)" ]; then \
echo -n "Checking for bashisms"; \
for SCRIPT in $(SHELL_SCRIPTS); do \
test -r $${SCRIPT} || continue ; \
ec=0 ; \
checkbashisms -x $${SCRIPT} || ec=$$? ; \
if [ $${ec} -ne 0 ] && [ $${ec} -ne 2 ] ; then exit $${ec} ; fi ; \
echo -n "."; \
done; \
echo " done."; \
else \
echo "W: checkbashisms - command not found"; \
echo "I: checkbashisms can be optained from: "; \
echo "I: http://git.debian.org/?p=devscripts/devscripts.git"; \
echo "I: On Debian systems, checkbashisms can be installed with:"; \
echo "I: apt-get install devscripts"; \
fi
shellcheck:
@echo -n "Checking for shell syntax errors"; \
for SCRIPT in $(BASH_SCRIPTS) $(SHELL_SCRIPTS); do \
test -r $${SCRIPT} || continue ; \
bash -n $${SCRIPT} || exit ; \
echo -n "."; \
done; \
echo " done."; \
perlcheck:
@echo "Checking for perl syntax errors:"; \
mkdir -p perl-dummy/Linux perl-dummy/File perl-dummy/Tk ; \
for f in File/lchown.pm Linux/LVM.pm Tk.pm Tk/HList.pm Tk/ItemStyle.pm; do \
echo '1;' > perl-dummy/$$f ; \
done; \
for SCRIPT in $(PERL_SCRIPTS); do \
test -r $${SCRIPT} || continue ; \
perl -Iperl-dummy/ -Ilib/setup-storage/ -w -c $${SCRIPT} || exit ; \
done; \
rm -r perl-dummy ; \
echo "-> perl check done."; \
clean:
rm -rf perl-dummy
$(MAKE) -C doc clean
veryclean: clean
$(MAKE) -f debian/rules clean
install:
mkdir -p $(DESTDIR)/{sbin,man} $(DESTDIR)/etc/{modutils,apt/apt.conf.d}
mkdir -p $(DESTDIR)/usr/{sbin,bin} $(DESTDIR)/usr/lib/fai $(DESTDIR)/etc/fai/apt/trusted.gpg.d
mkdir -p $(DESTDIR)/etc/{init,init.d} $(DESTDIR)/usr/share/fai/{pixmaps/small,setup-storage}
mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d
install man/* $(DESTDIR)/man
pod2man -c '' -r '' -s8 bin/dhcp-edit > $(DESTDIR)/man/dhcp-edit.8
pod2man -c '' -r '' -s8 bin/fai-deps > $(DESTDIR)/man/fai-deps.8
$(MAKE) -C doc install
-install $(libfiles) $(LIBDIR)
cp -a lib/dracut/80fai-autodiscover $(DESTDIR)/usr/lib/dracut/modules.d
install lib/setup-storage/* $(SHAREDIR)/setup-storage
cd bin ; install $(USRSBIN_SCRIPTS) $(DESTDIR)/usr/sbin
cd bin ; install $(USRBIN_SCRIPTS) $(DESTDIR)/usr/bin
install dev-utils/fai-kvm $(DESTDIR)/usr/bin
install dev-utils/fai-mk-network $(DESTDIR)/usr/sbin
install bin/dhclient-fai-script $(DESTDIR)/usr/share/fai
install -m644 conf/dhclient-fai.conf $(DESTDIR)/usr/share/fai
install -m644 conf/apt.conf $(DESTDIR)/etc/apt/apt.conf.d/90fai
cd conf ; install -m644 fai.conf grub.cfg grub.cfg.autodiscover $(DESTDIR)/etc/fai/
install -m644 conf/nfsroot.conf $(DESTDIR)/etc/fai/
install -m644 conf/sources.list $(DESTDIR)/etc/fai/apt/
install -m644 conf/fai-project.gpg $(DESTDIR)/etc/fai/apt/trusted.gpg.d/
install -m644 conf/NFSROOT $(DESTDIR)/etc/fai
install -m755 lib/fai-abort $(DESTDIR)/etc/init.d
cp -a pixmaps/*.gif $(DESTDIR)/usr/share/fai/pixmaps
cp -a pixmaps/small/*.gif $(DESTDIR)/usr/share/fai/pixmaps/small
sed -i 's/FAIVERSIONSTRING/$(VERSIONSTRING)/' $(DESTDIR)/usr/sbin/fai
cp -a examples $(DOCDIR)
rm -f $(DOCDIR)/examples/simple/.git
cp -a utils $(DOCDIR)/examples
.PHONY: clean veryclean