forked from cobbler/cobbler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
152 lines (132 loc) · 4.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
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
#MESSAGESPOT=po/messages.pot
TOP_DIR:=$(shell pwd)
prefix=devinstall
statepath=/tmp/cobbler_settings/$(prefix)
all: clean build
clean:
-rm -rf build rpm-build
-rm -f *~
-rm -f cobbler/*.pyc
-rm -rf dist
-rm -rf buildiso
-rm MANIFEST
-rm -f koan/*.pyc
-rm -f config/version
-rm -f docs/*.1.gz
-rm *.tmp
-rm *.log
test:
make savestate prefix=test
make rpms
make install
make eraseconfig
/sbin/service cobblerd restart
-(make nosetests)
make restorestate prefix=test
nosetests:
nosetests cobbler/*.py -v | tee test.log
build:
python setup.py build -f
# Assume we're on RedHat by default ('apache' user),
# otherwise Debian / Ubuntu ('www-data' user)
install: build
python setup.py install -f
if [ -n "`getent passwd apache`" ] ; then \
chown -R apache /usr/share/cobbler/web; \
else \
chown -R www-data /usr/share/cobbler/web; \
fi
debinstall:
python setup.py install -f --root $(DESTDIR)
devinstall:
-rm -rf /usr/share/cobbler
make savestate
make install
make restorestate
savestate:
mkdir -p $(statepath)
cp -a /var/lib/cobbler/config $(statepath)
cp /etc/cobbler/settings $(statepath)/settings
cp /etc/cobbler/modules.conf $(statepath)/modules.conf
@if [ -d /etc/httpd ] ; then \
cp /etc/httpd/conf.d/cobbler.conf $(statepath)/http.conf; \
cp /etc/httpd/conf.d/cobbler_web.conf $(statepath)/cobbler_web.conf; \
else \
cp /etc/apache2/conf.d/cobbler.conf $(statepath)/http.conf; \
cp /etc/apache2/conf.d/cobbler_web.conf $(statepath)/cobbler_web.conf; \
fi
cp /etc/cobbler/users.conf $(statepath)/users.conf
cp /etc/cobbler/users.digest $(statepath)/users.digest
cp /etc/cobbler/dhcp.template $(statepath)/dhcp.template
cp /etc/cobbler/rsync.template $(statepath)/rsync.template
# Assume we're on RedHat by default, otherwise Debian / Ubuntu
restorestate:
cp -a $(statepath)/config /var/lib/cobbler
cp $(statepath)/settings /etc/cobbler/settings
cp $(statepath)/modules.conf /etc/cobbler/modules.conf
cp $(statepath)/users.conf /etc/cobbler/users.conf
cp $(statepath)/users.digest /etc/cobbler/users.digest
if [ -d /etc/httpd ] ; then \
cp $(statepath)/http.conf /etc/httpd/conf.d/cobbler.conf; \
cp $(statepath)/cobbler_web.conf /etc/httpd/conf.d/cobbler_web.conf; \
else \
cp $(statepath)/http.conf /etc/apache2/conf.d/cobbler.conf; \
cp $(statepath)/cobbler_web.conf /etc/apache2/conf.d/cobbler_web.conf; \
fi
cp $(statepath)/dhcp.template /etc/cobbler/dhcp.template
cp $(statepath)/rsync.template /etc/cobbler/rsync.template
find /var/lib/cobbler/triggers | xargs chmod +x
if [ -n "`getent passwd apache`" ] ; then \
chown -R apache /var/www/cobbler; \
else \
chown -R www-data /var/www/cobbler; \
fi
if [ -d /var/www/cobbler/web ] ; then \
chmod -R +x /var/www/cobbler/web; \
fi
if [ -d /var/www/cobbler/svc ] ; then \
chmod -R +x /var/www/cobbler/svc; \
fi
rm -rf $(statepath)
completion:
python mkbash.py
webtest: devinstall
make clean
make devinstall
make restartservices
# Assume we're on RedHat by default, otherwise Debian / Ubuntu
restartservices:
if [ -x /sbin/service ] ; then \
/sbin/service cobblerd restart; \
/sbin/service httpd restart; \
else \
/usr/sbin/service cobblerd restart; \
/usr/sbin/service apache2 restart; \
fi
sdist: clean
python setup.py sdist
rpms: clean sdist
mkdir -p rpm-build
cp dist/*.gz rpm-build/
rpmbuild --define "_topdir %(pwd)/rpm-build" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir %{_topdir}" \
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
--define "_sourcedir %{_topdir}" \
-ba cobbler.spec
eraseconfig:
-rm /var/lib/cobbler/distros*
-rm /var/lib/cobbler/profiles*
-rm /var/lib/cobbler/systems*
-rm /var/lib/cobbler/repos*
-rm /var/lib/cobbler/networks*
-rm /var/lib/cobbler/config/distros.d/*
-rm /var/lib/cobbler/config/images.d/*
-rm /var/lib/cobbler/config/profiles.d/*
-rm /var/lib/cobbler/config/systems.d/*
-rm /var/lib/cobbler/config/repos.d/*
-rm /var/lib/cobbler/config/networks.d/*
tags:
find . -type f -name '*.py' | xargs etags -c TAGS