summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 420cfea94e840335d7db425baaabe01c16b923d8 (plain)
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
RPM=$(HOME)/rpm
NAME = drakwizard
VERSION := $(shell rpm --specfile $(NAME).spec -q | sed -n 's/^$(NAME)-\([^-]*\)-[^-]*$$/\1/p')
RELEASE := $(shell rpm --specfile $(NAME).spec -q | sed -n 's/^$(NAME)-[^-]*-\([^-]*\)$$/\1/p')
RELTAG := $(shell echo "V$(VERSION)_$(RELEASE)" | tr -- '-.' '__')
TAR = $(NAME)-$(VERSION).tar.bz2
SVNURL = $(shell dirname $(shell svn info | sed -n 's/^URL: \(.*\)/\1/p'))

# TODO: get WIZ_HOME take care of usr prefix 
WIZ_HOME=/usr/share/wizards/

PERL_VENDORLIB=$(shell eval "`perl -V:installvendorlib`"; installvendorlib=$${installvendorlib\#/usr}; echo $$installvendorlib)

WIZ =   dhcp_wizard\
	dns_wizard\
	postfix_wizard\
	samba_wizard\
	time_wizard\
	web_wizard\
	ftp_wizard\
	news_wizard\
	proxy_wizard\
	nisautofs_wizard \
	installsrv_wizard \
	nfs_wizard \
	sshd_wizard \
	kolab_wizard \
	ldap_wizard

OTHER = data\
        po

all:

# installs all the wizards...

install:
	mkdir -p ${prefix}/sbin
	mkdir -p ${prefix}/$(PERL_VENDORLIB)/MDK/Wizard/
	install -p drakwizard.pl ${prefix}/sbin/drakwizard
	perl -i -pe "s,(__WIZ_HOME__|\\\$$ENV{__WIZ_HOME__}),$(WIZ_HOME),g" ${prefix}/sbin/drakwizard 
	perl -i -pe "s|new IFCFG|new MDK::Wizard::IFCFG|g" common/Wizcommon.pm
	for l in $(OTHER); do \
	        $(MAKE) -C $$l $@; \
	done
	install --mode=u=rw,g=r,o=r -p common/*.pm ${prefix}/$(PERL_VENDORLIB)/MDK/Wizard/; \
	for l in $(WIZ); do \
	        install --mode=u=rw,g=r,o=r -p $$l/*.pm ${prefix}/$(PERL_VENDORLIB)/MDK/Wizard/; \
		if ls $$l/scripts/*.default &> /dev/null ; then \
	            install --mode=u=rwx,g=rx,o=rx -d ${prefix}/share/wizards/$$l/scripts/; \
	            install --mode=a=r -p $$l/scripts/*.default ${prefix}/share/wizards/$$l/scripts; \
		fi \
	done
	for l in $(WIZ); do \
		if ls $$l/images/*.png &> /dev/null ; then \
		install --mode=u=rwx,g=rx,o=rx -d ${prefix}/share/wizards/$$l/images/; \
		install --mode=a=r -p $$l/images/*.png ${prefix}/share/wizards/$$l/images/;\
		fi \
	done
	install --mode=a=r -p news_wizard/scripts/news.cron ${prefix}/share/wizards/news_wizard/scripts/; \
	find ${prefix}/$(PERL_VENDORLIB)/MDK/Wizard -type f -regex ".*.pm$$" \
		-exec perl -i -pe "s,(\\\$$ENV{__WIZ_HOME__}|__WIZ_HOME__),$(WIZ_HOME),g" \{\} \;

pitest:
	cp samba_wizard/Samba.pm .
	cp samba_wizard/Sambashare.pm .
	perl -i -pe "s,\\\$$ENV{__WIZ_HOME__},$(WIZ_HOME),g" Samba.pm
	grep defaultimage Samba.pm

clean:
	$(MAKE) -C po $@
	rm -f *~

dis: clean
	mkdir ../tmp_$(NAME)
	cp -rf . ../tmp_$(NAME)/$(NAME)
	cd ../tmp_$(NAME); tar cf - $(NAME) | bzip2 -9 > ../$(TAR)
	cd ..; rm -rf tmp_$(NAME)

changelog: ../common/username
	( svn2cl --authors=../../common/username --accum ; \
	rm -f ChangeLog.bak ; \
	svn commit -m "Generated by svn2cl the `date '+%c'`" ChangeLog ; \
	)

svntag:
	svn commit
	svn cp -m "Create tag $(RELTAG)" $(SVNURL)/trunk $(SVNURL)/tags/$(RELTAG)

localsrpm: dis ../$(TAR) $(RPM)
	cp -f ../$(TAR) $(RPM)/SOURCES
	cp -vf drakwizard.png $(RPM)/SOURCES
	-rpm -bs $(NAME).spec
	rm -f ../$(TAR)

localrpm: localsrpm
	-rpm -ba --clean $(NAME).spec

rpm: changelog svntag dis ../$(TAR) $(RPM)
	cp -f ../$(TAR) $(RPM)/SOURCES
	-rpm -ba --clean $(NAME).spec
	rm -f ../$(TAR)

oldlocalrpm: dis
	cp -f ../$(TAR) $(RPM)/SOURCES
	cp -f $(NAME).spec $(RPM)/SPECS/
	-rpm -ba $(NAME).spec
	rm -f ../$(TAR)

clean_test:
	rm -rf test

test:	clean_test
	@date
	mkdir test
	cp -r $(WIZ) test
	cp Wizard.dtd Makefile drakwizard.pl drakwizard.spec test.pl test
	find test -regex ".*\.wiz$$\|.*\.pm$$\|.*\.sh$$" -exec \
		perl -i -pe "s|__WIZ_HOME__|$(PWD)/test|g" \{\} \;
	perl -i -pe "s|__WIZ_HOME__|$(PWD)/test|g" test/drakwizard.pl