summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 441609f097208a366af497d8e6442b853fb3260a (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
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
ARCH := $(patsubst i%86,i386,$(shell uname -m))
ARCH := $(patsubst sparc%,sparc,$(ARCH))

RELEASE_BOOT_IMG = cdrom.img hd.img network.img usbnet.img
ifeq (i386,$(ARCH))
RELEASE_BOOT_IMG += blank.img pcmcia.img other.img
endif
ifeq (sparc,$(ARCH))
BOOT_IMG = live.img tftp.img tftprd.img live64.img tftp64.img tftprd64.img
RELEASE_BOOT_IMG += hd64.img cdrom64.img network64.img
endif
ifeq (ppc,$(ARCH))
BOOT_IMG = 
RELEASE_BOOT_IMG = all.img
endif
ifeq (ia64,$(ARCH))
BOOT_IMG =
RELEASE_BOOT_IMG = all.img
endif
BOOT_IMG += $(RELEASE_BOOT_IMG)

FRELEASE_BOOT_IMG = $(BOOT_IMG:%=images/%)
FBOOT_IMG = $(BOOT_IMG:%=images/%)
FBOOT_RDZ = $(FBOOT_IMG:%.img=%.rdz) images/all.rdz

BINS = mdk-stage1/init mdk-stage1/stage1-full mdk-stage1/stage1-cdrom mdk-stage1/stage1-network mdk-stage/stage1-usbnet
ifeq (ppc,$(ARCH))
BINS = mdk-stage1/init mdk-stage1/stage1-full 
endif
DIRS = tools mdk-stage1 perl-install

ROOTDEST = /export
UPLOAD_DEST_ = ~/cooker
UPLOAD_DEST = $(UPLOAD_DEST_)/cooker
UPLOAD_DEST_CONTRIB = $(UPLOAD_DEST_)/contrib
UPLOAD_SPARC_DEST = /mnt/BIG/distrib/sparc

.PHONY: dirs perl-install $(FLOPPY_IMG) install

install: all.modules build rescue
	for i in images misc Mandrake Mandrake/base; do install -d $(ROOTDEST)/$$i ; done
ifneq (ppc,$(ARCH))
	for i in $(FRELEASE_BOOT_IMG); do cp -f $${i}* $(ROOTDEST)/images; done
endif
ifeq (alpha,$(ARCH))
	for i in $(FBOOT_RDZ); do cp -f $${i}* $(ROOTDEST)/boot; done
	cp -f vmlinux.gz $(ROOTDEST)/boot/instboot.gz
	make -C tools/$(ARCH)/cd install ROOTDEST=$(ROOTDEST)
endif
	cd $(ROOTDEST)/images; rm -rf alternatives 
	if [ `ls $(ROOTDEST)/images/*.img-* 2>/dev/null | wc -l` -gt 0 ]; then	\
	  cd $(ROOTDEST)/images; mkdir alternatives; cd alternatives; mv ../*.img-* .; md5sum *.img-* > MD5SUM; \
	fi
	cd $(ROOTDEST)/images; md5sum *.img* > MD5SUM

	install live_update $(ROOTDEST)/live_update
	make -C perl-install full_stage2

build: $(FBOOT_IMG)

dirs:
	@for n in . $(DIRS); do \
		[ "$$n" = "." ] || $(MAKE) -C $$n all ;\
	done

rescue: all.modules
	make -C $@

$(FBOOT_RDZ): dirs all.modules
	./make_boot_img $@ `basename $(@:%.rdz=%)`

$(FBOOT_IMG): %.img: %.rdz
	./make_boot_img $@ `basename $(@:%.img=%)`

tar: clean
	rpm -qa > needed_rpms.lst
	cd .. ; tar cfj gi.tar.bz2 gi
	rm needed_rpms.lst

perl-install:
	make -C perl-install all

mdk-stage1/mar/mar:
	make -C mdk-stage1/mar

all.modules: mdk-stage1/mar/mar perl-install/auto/c/stuff/stuff.so update_kernel perl-install/modules.pm
	`./tools/specific_arch ./update_kernel`

perl-install/auto/c/stuff/stuff.so: perl-install


$(FBOOT_IMG:%=%f): %f: %
	dd if=$< of=/dev/fd0
	xmessage "Floppy done"

clean:
	rm -rf $(BINS) images all.modules all.modules64 install_pcmcia_modules
	for i in $(DIRS) rescue; do make -C $$i clean; done
	find . -name "*~" -o -name ".#*" | xargs rm -f

check:
	@badrights=`find $(ROOTDEST)/Mandrake/mdkinst | perl -lne 'print if !((stat)[2] & 4)'`; [ -z "$$badrights" ] || { echo "bad rights for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$badrights" ; echo "bad rights for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; }
	@missing_kb=`find -name "Entries" | xargs perl -F/ -alne 'print $$ARGV =~ m|(.*)/CVS|, "/$$F[1]" if $$F[1] =~ /\.(png|gif|bmp|xcf|gz|bz2|tar|rdz|so|a|o|mar|img|exe)$$/ && $$F[4] ne "-kb"'` ; [ -z "$$missing_kb" ] || { echo "missing -kb in CVS for files vvvvvvvvvvvvvvvvvvvvvvvvvv" ; echo "$$missing_kb" ; echo "missing -kb in CVS for files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; exit 1; }
	$(MAKE) -C perl-install check

upload: 
	$(MAKE) clean

#	# done before make install to increment ChangeLog version
	tools/addchangelog.pl tools/cvslog2changelog.pl | tools/mailchangelog.pl &

	$(MAKE) install
	$(MAKE) check

	function upload() { rsync -qSavz --verbose --exclude '*~' -e ssh --delete $(ROOTDEST)/$$1/$$2 mandrake@kenobi:/c/cooker/$$1; } ;\
	upload Mandrake/mdkinst '' ;\
	upload Mandrake/base compssUsers ;\
	upload Mandrake/base rpmsrate ;\
	upload Mandrake/base *_stage2.bz2 ;\
	upload misc gendistrib ;\
	upload misc make_mdkinst_stage2 ;\
	upload misc packdrake ;\
	upload misc packdrake.pm ;\
	upload misc rpmtools.pm ;\
	upload misc auto ;\
	upload '' live_update ;\
	upload images MD5SUM ;\
	upload images *.img* ;\
	upload images/alternatives '' ;\
	echo

upload_sparc:
	touch /tmp/mdkinst_done
	cp -a $(ROOTDEST)/images/* $(UPLOAD_SPARC_DEST)/images ; true
	cp -a $(ROOTDEST)/boot/* $(UPLOAD_SPARC_DEST)/boot; true
	cp -a $(ROOTDEST)/misc/* $(UPLOAD_SPARC_DEST)/misc; true
	rm -rf $(UPLOAD_SPARC_DEST)/Mandrake/mdkinst
	cp -a $(ROOTDEST)/Mandrake/mdkinst $(UPLOAD_SPARC_DEST)/Mandrake/mdkinst; true
	( cd $(ROOTDEST)/Mandrake/base; cp mdkinst_stage2.bz2 rescue_stage2.bz2 compss compssList compssUsers compssUsers.desktop $(UPLOAD_SPARC_DEST)/Mandrake/base ); true
	rm -f /tmp/mdkinst_done

# mkisofs -r -J -b images/cdrom.img -c images/boot.cat /tmp/r /mnt/disk/ | cdrecord -v -eject speed=6 dev=1,0 -
# as distrib: mv ~/oxygen/oxygen/images ~/tmp/r
# as mandrake: ~distrib/bin/mkisofs -r -b images/cdrom.img -c images/boot.cat -o /home/ftp/linux-mandrake/pub/mirror/oxyiso/oxygen-3.iso ~distrib/tmp/r ~distrib/oxygen/oxygen
# as mandrake: remove old iso in /home/ftp/linux-mandrake/pub/mirror/oxyiso
# as mandrake: cd /home/ftp/linux-mandrake/pub/mirror/oxyiso ; md5sum *.iso > md5sum
# as distrib: mv ~/tmp/r/images ~/oxygen/oxygen
class="hl slc">#-##################################################################################### =head2 Imports =cut #-##################################################################################### use Data::Dumper; #-##################################################################################### =head2 pixel imports =cut use commands; #-##################################################################################### #-##################################################################################### =head2 Examples and types =over 4 =item * an entry in the 'printerdb' file, which describes each type of supported printer: StartEntry: DeskJet550 GSDriver: cdj550 Description: {HP DeskJet 550C/560C/6xxC series} About: { \ This driver supports the HP inkjet printers which have \ color capability using both black and color cartridges \ simultaneously. Known to work with the 682C and the 694C. \ Other 600 and 800 series printers may work \ if they have this feature. \ If your printer seems to be saturating the paper with ink, \ try added an extra GS option of '-dDepletion=2'. \ Ghostscript supports several optional parameters for \ this driver: see the document 'devices.doc' \ in the ghostscript directory under /usr/doc. \ } Resolution: {300} {300} {} BitsPerPixel: {3} {Normal color printing with color cartridge} BitsPerPixel: {8} {Floyd-Steinberg B & W printing for better greys} BitsPerPixel: {24} {Floyd-Steinberg Color printing (best, but slow)} BitsPerPixel: {32} {Sometimes provides better output than 24} EndEntry Example of data-struct: my %ex_printerdb_entry = ( ENTRY => "DeskJet550", #-Human-readable name of the entry GSDRIVER => "cdj550", #-gs driver used by this printer DESCR => "HP DeskJet 550C/560C/6xxC series", #-Single line description of printer ABOUT => " This driver supports the HP inkjet printers which have color capability using both black and color cartridges ...", #-Lengthy description of printer RESOLUTION => [ #-List of resolutions supported { XDPI => 300, YDPI => 300, DESCR => "commentaire", }, ], BITSPERPIXEL => [ #-List of color depths supported { DEPTH => 3, DESCR => "Normal color printing with color cartridge", }, ], ) ; =item * A printcap entry only represents a subset of possible options available Sufficient for the simple configuration we are interested in there is also some text in the template (.in) file in the spooldir # /etc/printcap # # Please don't edit this file directly unless you know what you are doing # Be warned that the control-panel printtool requires a very strict forma # Look at the printcap(5) man page for more info. # # This file can be edited with the printtool in the control-panel. ##PRINTTOOL3## LOCAL uniprint NAxNA letter {} U_NECPrinwriter2X necp2x6 1 lpname:\ :sd=/var/spool/lpd/lpnamespool:\ :mx#45:\ :sh:\ :lp=/dev/device:\ :if=/var/spool/lpd/lpnamespool/filter: ##PRINTTOOL3## REMOTE st800 360x180 a4 {} EpsonStylus800 Default 1 remote:\ :sd=/var/spool/lpd/remotespool:\ :mx#47:\ :sh:\ :rm=remotehost:\ :rp=remotequeue:\ :if=/var/spool/lpd/remotespool/filter: ##PRINTTOOL3## SMB la75plus 180x180 letter {} DECLA75P Default {} smb:\ :sd=/var/spool/lpd/smbspool:\ :mx#46:\ :sh:\ :if=/var/spool/lpd/smbspool/filter:\ :af=/var/spool/lpd/smbspool/acct:\ :lp=/dev/null: ##PRINTTOOL3## NCP ap3250 180x180 letter {} EpsonAP3250 Default {} ncp:\ :sd=/var/spool/lpd/ncpspool:\ :mx#46:\ :sh:\ :if=/var/spool/lpd/ncpspool/filter:\ :af=/var/spool/lpd/ncpspool/acct:\ :lp=/dev/null: Example of data-struct: my %ex_printcap_entry = ( QUEUE => "lpname", #-Queue name, can have multi separated by '|' #-if you want something different from the default SPOOLDIR => "/var/spool/lpd/lpnamespool/", #-Spool directory IF => "/var/spool/lpd/lpnamespool/filter", #-input filter #- commentaire inserer dans le printcap pour que printtool retrouve ses petits DBENTRY => "DeskJet670", #-entry in printer database for this printer RESOLUTION => "NAxNA", #-ghostscript resolution to use PAPERSIZE => "letter", #-Papersize BITSPERPIXEL => "necp2x6", #-ghostscript color option CRLF => 1 , #-Whether or not to do CR/LF xlation TYPE => "LOCAL", #- LOCAL DEVICE => "/dev/device", #-Print device #- REMOTE (lpd) printers only REMOTEHOST => "remotehost", #-Remote host (not used for all entries) REMOTEQUEUE => "remotequeue", #-Queue on the remote machine #-SMB (LAN Manager) only #- in spooldir/.config #-share='\\hostname\printername' #-hostip=1.2.3.4 #-user='user' #-password='passowrd' #-workgroup='AS3' SMBHOST => "hostname", #-Server name (NMB name, can have spaces) SMBHOSTIP => "1.2.3.4", #-Can optional specify and IP address for host SMBSHARE => "printername", #-Name of share on the SMB server SMBUSER => "user", #-User to log in as on SMB server SMBPASSWD => "passowrd", #-Corresponding password SMBWORKGROUP => "AS3", #-SMB workgroup name AF => "/var/spool/lpd/smbspool/acct", #-accounting filter (needed for smbprint) #- NCP (NetWare) only #- in spooldir/.config #-server=printerservername #-queue=queuename #-user=user #-password=pass NCPHOST => "printerservername", #-Server name (NCP name) NCPQUEUE => "queuename", #-Queue on server NCPUSER => "user", #-User to log in as on NCP server NCPPASSWD => "pass", #-Corresponding password ) ; =cut #-##################################################################################### =head2 Intern constant =cut #-##################################################################################### #-if we are in an panoramix config my $prefix = ""; #-location of the printer database in an installed system my $PRINTER_DB_FILE = "/usr/lib/rhs/rhs-printfilters/printerdb"; my $PRINTER_FILTER_DIR = "/usr/lib/rhs/rhs-printfilters"; #-##################################################################################### =head2 Exported constant =cut #-##################################################################################### %printer_type = ( "local" => "LOCAL", "Remote lpd" => "REMOTE", "SMB/Windows 95/NT" => "SMB", "NetWare" => "NCP", ); %printer_type_inv = reverse %printer_type; %fields = ( STANDARD => [qw(QUEUE SPOOLDIR IF)], SPEC => [qw(DBENTRY RESOLUTION PAPERSIZE BITSPERPIXEL CRLF)], LOCAL => [qw(DEVICE)], REMOTE => [qw(REMOTEHOST REMOTEQUEUE)], SMB => [qw(SMBHOST SMBHOSTIP SMBSHARE SMBUSER SMBPASSWD SMBWORKGROUP AF)], NCP => [qw(NCPHOST NCPQUEUE NCPUSER NCPPASSWD)], ); @papersize_type = qw(letter legal ledger a3 a4); $spooldir = "/var/spool/lpd"; #-##################################################################################### =head2 Functions =cut #-##################################################################################### sub set_prefix($) { ($prefix) = @_; } #-***************************************************************************** #- read function #-***************************************************************************** #------------------------------------------------------------------------------ #- Read the printer database from dbpath into memory #------------------------------------------------------------------------------ sub read_printer_db(;$) { my ($dbpath) = @_; $dbpath = $prefix . ($dbpath || $PRINTER_DB_FILE); %thedb and return; local *DBPATH; #-don't have to do close open DBPATH, "<$dbpath" or die "An error has occurred on $dbpath : $!"; while (<DBPATH>) { if (/^StartEntry:\s(\w*)/) { my $entryname = $1; my $entry = {}; $entry->{ENTRY} = $entryname; WHILE : while (<DBPATH>) { SWITCH: { /GSDriver:\s*(\w*)/ and do { $entry->{GSDRIVER} = $1; last SWITCH }; /Description:\s*{(.*)}/ and do { $entry->{DESCR} = $1; last SWITCH }; /About:\s*{(.*)}/ and do { $entry->{ABOUT} = $1; last SWITCH }; /About:\s*{(.*)/ and do { my $string = "$1\n"; while (<DBPATH>) { /(.*)}/ and do { $entry->{ABOUT} = $string; last SWITCH }; $string .= $_; } }; /Resolution:\s*{(.*)}\s*{(.*)}\s*{(.*)}/ and do { push @{$entry->{RESOLUTION}}, { XDPI => $1, YDPI => $2, DESCR => $3 }; last SWITCH }; /BitsPerPixel:\s*{(.*)}\s*{(.*)}/ and do { push @{$entry->{BITSPERPIXEL}}, {DEPTH => $1, DESCR => $2}; last SWITCH }; /EndEntry/ and last WHILE; } } $thedb{$entryname} = $entry; } } } #-****************************************************************************** #- write functions #-****************************************************************************** #------------------------------------------------------------------------------ #- given the path queue_path, we create all the required spool directory #------------------------------------------------------------------------------ sub create_spool_dir($) { my ($queue_path) = @_; my $complete_path = "$prefix/$queue_path"; unless (-d $complete_path) { mkdir "$complete_path", 0755 or die "An error has occurred - can't create $complete_path : $!"; } #-redhat want that "drwxr-xr-x root lp" my $gid_lp = (getpwnam("lp"))[3]; chown 0, $gid_lp, $complete_path or die "An error has occurred - can't chgrp $complete_path to lp $!"; } #------------------------------------------------------------------------------ #-given the input spec file 'input', and the target output file 'output' #-we set the fields specified by fieldname to the values in fieldval #-nval is the number of fields to set #-Doesnt currently catch error exec'ing sed yet #------------------------------------------------------------------------------ sub create_config_file($$%) { my ($inputfile, $outpufile, %toreplace) = @_; my ($in, $out) = ("$prefix/$inputfile", "$prefix/$outpufile"); local *OUT; local *IN; #-TODO my $oldmask = umask 0755; open IN , "<$in" or die "Can't open $in $!"; if ($::testing) { *OUT = *STDOUT } else { open OUT, ">$out" or die "Can't open $out $!"; } while (<IN>) { if (/@@@(.*)@@@/) { my $r = $toreplace{$1}; s/@@@(.*)@@@/$r/g; } print OUT; } } #------------------------------------------------------------------------------ #-copy master filter to the spool dir #------------------------------------------------------------------------------ sub copy_master_filter($) { my ($queue_path) = @_; my $complete_path = "$prefix/$queue_path/filter"; my $master_filter = "$prefix/$PRINTER_FILTER_DIR/master-filter"; eval { commands::cp($master_filter, $complete_path) }; $@ and die "Can't copy $master_filter to $complete_path $!"; } #------------------------------------------------------------------------------ #- given a PrintCap Entry, create the spool dir and special #- rhs-printfilters related config files which are required #------------------------------------------------------------------------------ my $intro_printcap_test=" # # Please don't edit this file directly unless you know what you are doing! # Look at the printcap(5) man page for more info. # Be warned that the control-panel printtool requires a very strict format! # Look at the printcap(5) man page for more info. # # This file can be edited with the printtool in the control-panel. # "; sub configure_queue($) { my ($entry) = @_; $entry->{SPOOLDIR} ||= "$spooldir"; $entry->{IF} ||= "$spooldir/$entry->{QUEUE}/filter"; $entry->{AF} ||= "$spooldir/$entry->{QUEUE}/acct"; my $queue_path = "$entry->{SPOOLDIR}"; create_spool_dir($queue_path); my $get_name_file = sub { my ($name) = @_; ("$PRINTER_FILTER_DIR/$name.in", "$entry->{SPOOLDIR}/$name") }; my ($filein, $file); my %fieldname = (); my $dbentry = $thedb{($entry->{DBENTRY})} or die "no dbentry"; ($filein, $file) = &$get_name_file("general.cfg"); $fieldname{ascps_trans} = ($dbentry->{GSDRIVER} eq "POSTSCRIPT") ? "NO" : "YES"; $fieldname{desiredto} = ($entry->{GSDRIVER} eq "TEXT") ? "ps" : "asc"; $fieldname{papersize} = $entry->{PAPERSIZES} ? $entry->{PAPERSIZES} : "letter"; $fieldname{printertype} = $entry->{TYPE}; create_config_file($filein, $file, %fieldname); #- successfully created general.cfg, now do postscript.cfg ($filein, $file) = &$get_name_file("postscript.cfg"); %fieldname = (); $fieldname{gsdevice} = $dbentry->{GSDRIVER}; $fieldname{papersize} = $entry->{PAPERSIZES} ? $entry->{PAPERSIZES} : "letter"; $fieldname{resolution} = ($entry->{RESOLUTION} eq "Default") ? "Default" : ""; $fieldname{color} = do { if ($dbentry->{GSDRIVER} eq "uniprint") { ($entry->{BITSPERPIXEL} eq "Default") ? "-dBitsPerPixel=Default" : ""; } else { $entry->{BITSPERPIXEL}; } }; $fieldname{reversepages} = "NO"; $fieldname{extragsoptions} = ""; $fieldname{pssendeof} = ($dbentry->{GSDRIVER} eq "POSTSCRIPT") ? "NO" : "YES"; $fieldname{nup} = "1"; $fieldname{rtlftmar} = "18"; $fieldname{topbotmar} = "18"; create_config_file($filein, $file, %fieldname); #- finally, make textonly.cfg ($filein, $file) = &$get_name_file("textonly.cfg"); %fieldname = (); $fieldname{textonlyoptions} = ""; $fieldname{crlftrans} = $entry->{CRLF} ? "YES" : ""; $fieldname{textsendeof} = "1"; create_config_file($filein, $file, %fieldname); if ($entry->{TYPE} eq "SMB") { #- simple config file required if SMB printer my $config_file = "$prefix$queue_path/.config"; local *F; open F, ">$config_file" or die "Can't create $config_file $!"; print F "share='\\\\$entry->{SMBHOST}\\$entry->{SMBSHARE}'\n"; print F "hostip=$entry->{SMBHOSTIP}\n"; print F "user='$entry->{SMBUSER}'\n"; print F "password='$entry->{SMBPASSWD}'\n"; print F "workgroup='$entry->{SMBWORKGROUP}'\n"; } elsif ($entry->{TYPE} eq "NCP") { #- same for NCP printer my $config_file = "$prefix$queue_path/.config"; local *F; open F, ">$config_file" or die "Can't create $config_file $!"; print F "server=$entry->{NCPHOST}\n"; print F "queue=$entry->{NCPQUEUE}\n"; print F "user=$entry->{NCPUSER}\n"; print F "password=$entry->{NCPPASSWD}\n"; } copy_master_filter($queue_path); #-now the printcap file local *PRINTCAP; if ($::testing) { *PRINTCAP = *STDOUT; } else { open PRINTCAP, ">$prefix/etc/printcap" or die "Can't open printcap file $!"; } print PRINTCAP $intro_printcap_test; printf PRINTCAP "##PRINTTOOL3## %s %s %s %s %s %s %s \n", $entry->{TYPE}, $dbentry->{GSDRIVER},