source: soft/build_system/build_system/mkcd/tags/V4_1_2_1mdk/mkcd.sh @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 6.6 KB
Line 
1#!/bin/sh
2# Linux-Mandrake ISO CD Creation Script (thanks to Kenny Graunke for this one!)
3# Fixes and modifications to handle using a preexisting mirror (without
4#      messing up that mirror) added by Guy T. Rice
5# Fixes and modifications to handle burning the main CD automatically plus adding
6#      most of the commentaries below  --  by Daniel Hammer (dhammer@cybercable.fr)
7#
8#       20000904 warly <warly@mandrakesoft.com>: support for last rpmtools tools
9#
10# Before You Start:
11#   o  Check all variables and insert a CD-R/RW into you CD-writer
12#   o  In most settings you must run this script as "root"
13#   o  It makes sense to get rid of lots of useless files which you
14#      get during the download but which you don't need for the CD's
15#      - these are for example lots of ".listing" files and some forgotten
16#      junk-files like "locale.dir~", etc.
17#      Cleaning them off is easily made by the following (perhaps not most
18#      elegant) procedure:
19#        * change into the appropriate directory of your mirror
20#        * type "find . -name .listing > rmdotlisting&&chmod +x rmdotlisting"
21#        * using "sed" or just by eding the rmdotlisting file replace "./"
22#          at the beginning of each line by "rm "
23#        * then run "rmdotlisting" by typing "./rmdotlisting"
24
25#   o check if you don't have any two versions of any package in the RPMS/RPMS2
26#     directories; this can happen if you use "wget -rm" since you get all newer
27#     versions of the packages and the outdated ones remain in your mirror
28#     directory
29#     Example: you've already downloaded certainpackage-1.2.3mdk.rpm and when
30#              updating you get the newer certainpackage-1.2.5mdk.rpm now you'll
31#              have both packages in the RPMS directory of your local mirror & when
32#              later creating deplists this produces "depslist.ordered does not match ..."
33
34# Preferably run this script by typing: "sh isomake.sh 2>&1 | tee -a ~/.isomake.log"
35#    since if you get any errors you'll have a log-file to check what went wrong
36
37
38# You MUST change these variables for your particular configuration:
39
40shopt -s extglob
41
42# Set this to the location of where you want to download Linux-Mandrake to.
43mdkLOCALROOT=/tmp
44# Set these to the location where you want your ISO images to be created.
45mdkISO1DIR=/tmp/mdkiso1
46mdkISO2DIR=/tmp/mdkiso2
47# Set this to 1 to download Linux-Mandrake.
48mdkMIRROR=0
49# Set these to your FTP mirror and directory, respectively:
50mdkFTPSITE=sunsite.uio.no
51mdkFTPDIR=/pub/unix/Linux/Mandrake-devel/cooker
52# Set this to a non-empty string to copy an already existing local mirror
53mdkPREEXISTING=/mnt/z-olinux/sunsite.uio.no/pub/unix/Linux/Mandrake-devel/cooker
54
55# You should not have to change anything below this point.
56
57# If there's a preexisting mirror, copy it to our build location
58if [ -n "$mdkPREEXISTING" ]; then
59  rm -f $mdkLOCALROOT/mirror
60  cp -a $mdkPREEXISTING $mdkLOCALROOT/mirror
61fi
62
63# mirror from ftp preserving permissions and symlinks
64# Be careful altering the download-method, e.g. using
65# "wget -rm $mdkFTPSITE$mdkFTPDIR 2>&1 | tee -a ~/.wget.log"
66#   If you do so and if you had an existing mirror before, you can get
67#   a list of all updated packages by "grep RETR ~/.wget.log"
68#   You MUST kick off their outdated versions since otherwise it will produce a
69#   wrong Installation-CD (see commentaries above). Therefore, to manage the
70#   cleaning this script should be cut in two after having finished the download.
71#
72if [ "$mdkMIRROR" = "1" ]; then
73  mkdir $mdkLOCALROOT/mirror
74  cd $mdkLOCALROOT/mirror
75  lftp -c "open $mdkFTPSITE\; cd $mdkFTPDIR\; mirror"
76fi
77
78# make sure tools needed by this script are available and up to date
79# rpm complains that other packages depend on these for no apparent reason
80# (we're not removing them) so I've added --nodeps to stop it from complaining
81#rpm -Uvh --nodeps $mdkLOCALROOT/mirror/Mandrake/RPMS/popt-* # needed by rpm
82#rpm -Uvh --nodeps $mdkLOCALROOT/mirror/Mandrake/RPMS/rpm-* # needed by rpmtools
83#rpm -Uvh --nodeps $mdkLOCALROOT/mirror/Mandrake/RPMS/rpmtools-* # we need these
84
85# create new directory to place the rpms for the second CD
86mkdir -p $mdkLOCALROOT/cd2/Mandrake/RPMS2
87
88# move all files in the directory for CD2
89mv $mdkLOCALROOT/mirror/Mandrake/RPMS/* $mdkLOCALROOT/cd2/Mandrake/RPMS2
90mv $mdkLOCALROOT/mirror $mdkLOCALROOT/cd1
91
92# move the apropriate files in the directory for first CD
93for i in `cat $mdkLOCALROOT/cd1/Mandrake/base/rpmslist`
94do
95mv $mdkLOCALROOT/cd2/Mandrake/RPMS2/$i-!(*-*)-!(*-*)mdk*.rpm $mdkLOCALROOT/cd1/Mandrake/RPMS
96done       
97
98# put the image in a separate dir to be sure the CD will boot everywhere
99mkdir -p $mdkLOCALROOT/images
100mv $mdkLOCALROOT/cd1/images $mdkLOCALROOT/images
101
102# change to directory of main CD
103cd $mdkLOCALROOT/cd1
104
105# the utilities in misc don't work unless they're in the PATH
106export PATH=$mdkLOCALROOT/cd1/misc:$PATH
107
108# generate the dependance files
109
110rm -f $mdkLOCALROOT/cd1/Mandrake/base/{hdlists,hdlist.cz2}
111./misc/genhdlist_cz2 -o $mdkLOCALROOT/cd1/Mandrake/base/hdlist1.cz $mdkLOCALROOT/cd1/Mandrake/RPMS
112echo "hdlist1.cz     Mandrake/RPMS  CD1 Installation CD" > $mdkLOCALROOT/cd1/Mandrake/base/hdlists
113
114rm -f $mdkLOCALROOT/cd1/Mandrake/base/hdlist2.cz2
115./misc/genhdlist_cz2 -o $mdkLOCALROOT/cd1/Mandrake/base/hdlist2.cz $mdkLOCALROOT/cd2/Mandrake/RPMS2
116echo "hdlist2.cz     Mandrake/RPMS2  CD2 Extension CD" >> $mdkLOCALROOT/cd1/Mandrake/base/hdlists
117
118rm -f $mdkLOCALROOT/cd1/Mandrake/base/{depslist,deplist.ordered,filelist}
119./misc/genbasefiles $mdkLOCALROOT/cd1/Mandrake/base/ $mdkLOCALROOT/cd1/Mandrake/base/hdlist1.cz $mdkLOCALROOT/cd1/Mandrake/base/hdlist2.cz
120./misc/usr/bin/genfilelist $mdkLOCALROOT/cd1/Mandrake/RPMS $mdkLOCALROOT/cd2/Mandrake/RPMS2 > $mdkLOCALROOT/cd1/Mandrake/base/filelist
121
122# order the hdlist with the depslist to get faster accesses
123./misc/genhdlist_cz2 --noclean --ordered-depslist Mandrake/base/depslist.ordered \
124        -o Mandrake/base/hdlist1.cz $mdkLOCALROOT/cd1/Mandrake/RPMS \
125        -o $mdkLOCALROOT/cd2/Mandrake/base/hdlist2.cz Mandrake/RPMS2
126
127# create the first iso image (Main Installation CD)
128mkisofs -J -r \
129  -o $mdkISO1DIR/Cooker-CD1.iso \
130  -b images/all.img \
131  -c images/boot.cat \
132  $mdkLOCALROOT/images \
133  $mdkLOCALROOT/cd1
134
135# create the second iso image (Extensions CD)
136mkisofs -J -r \
137  -o $mdkISO2DIR/Cooker-CD2.iso \
138  $mdkLOCALROOT/cd2
139
140# burn the main CD
141# the values for cd-writer speed and the scsi-bus target/lun must be set
142# according to your local settings
143cd $mdkISO1DIR
144cdrecord -eject -v -data speed=4 dev=4,0 Cooker-CD1.iso
145
146# the first CD comes out the CD-writer and the script comes out at the
147# place where your second image file is - ready to perform
148# 'cdrecor
149cd $mdkISO2DIR
150cdrecord -eject -v -data speed=4 dev=4,0 Cooker-CD2.iso
Note: See TracBrowser for help on using the repository browser.