diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile | 1 | ||||
-rwxr-xr-x | scripts/buildinstall | 4 | ||||
-rwxr-xr-x | scripts/mk-images | 23 | ||||
-rw-r--r-- | scripts/mk-images.alpha | 4 | ||||
-rw-r--r-- | scripts/mk-images.i386 | 17 | ||||
-rw-r--r-- | scripts/mk-images.ia64 | 6 | ||||
-rw-r--r-- | scripts/mk-images.sparc64 | 4 | ||||
-rwxr-xr-x | scripts/pkgorder | 102 | ||||
-rwxr-xr-x | scripts/splitdistro | 191 | ||||
-rwxr-xr-x | scripts/upd-instroot | 65 |
10 files changed, 297 insertions, 120 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index e92c216bc..ea829df7e 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -6,6 +6,7 @@ install: install -m 755 upd-instroot $(DESTDIR)/$(RUNTIMEDIR) install -m 755 mk-images* $(DESTDIR)/$(RUNTIMEDIR) install -m 755 buildinstall $(DESTDIR)/$(RUNTIMEDIR) + install -m 755 splitdistro $(DESTDIR)/$(RUNTIMEDIR) install -m 755 scrubtree $(DESTDIR)/$(RUNTIMEDIR) install -m 755 pythondeps $(DESTDIR)/$(RUNTIMEDIR) install -m 755 pkgorder $(DESTDIR)/$(RUNTIMEDIR) diff --git a/scripts/buildinstall b/scripts/buildinstall index 889aff8c8..bfddc3f2c 100755 --- a/scripts/buildinstall +++ b/scripts/buildinstall @@ -31,7 +31,7 @@ if [ -z "$DIR" ]; then usage fi -p=`cd $DIR; /bin/pwd` +p=`cd $DIR; /bin/pwd | sed 's,/md1/,/,g'` BUILDINSTDIR=$p/buildinstall.tree.$$ @@ -64,7 +64,7 @@ fi MK_IMAGES=$BUILDINSTDIR/mk-images echo "Building images..." -$UPD_INSTROOT $p/RedHat/RPMS $p/image-template $p/RedHat/instimage +$UPD_INSTROOT --comp $COMPNAME $p/RedHat/RPMS $p/image-template $p/RedHat/instimage # XXX hack - msw if [ $BUILDARCH = "sparc" ]; then diff --git a/scripts/mk-images b/scripts/mk-images index dabdc7642..7d45f6526 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -612,19 +612,6 @@ makeImage () { } makeinstimage () { - SIZE1=4096 - SIZE2="" - - while [ $(echo $1 | cut -c1-2) = "--" ]; do - if [ $1 = "--size1" ]; then - SIZE1=$2 - shift; shift - elif [ $1 = "--size2" ]; then - SIZE2=$2 - shift; shift - fi - done - imagename=$1 modlist=$(expandModuleSet "$2") tmpdir=/tmp/instimage.dir.$$ @@ -636,12 +623,10 @@ makeinstimage () { (cd $INSTIMGTEMPLATE; find . | cpio --quiet -p $tmpdir) makemoduleball $tmpdir/modules "$modlist" - if [ -n "$SIZE2" ]; then - makeImage $tmpdir/usr $SIZE2 $INSTIMGPATH/${imagename}2.img - rm -rf $tmpdir/usr - fi - - makeImage $tmpdir $SIZE1 $INSTIMGPATH/${imagename}1.img + mkcramfs $tmpdir $INSTIMGPATH/${imagename}1.img + size=$(ls -l $INSTIMGPATH/${imagename}1.img | awk '{print $5}') + size=$(expr $size / 1024) + echo "Wrote $INSTIMGPATH/${imagename}1.img (${size}k)..." rm -rf $tmpdir } diff --git a/scripts/mk-images.alpha b/scripts/mk-images.alpha index 4a0038874..eff7457c6 100644 --- a/scripts/mk-images.alpha +++ b/scripts/mk-images.alpha @@ -54,8 +54,8 @@ makebootdisk --bootdisksize 1440 --kernelto $TOPDESTPATH/kernels/vmlinux.gz \ --imagename generic.img makemainmodules "$SECSTAGE $SCSIMODULES" -makeinstimage --size1 6144 --size2 6144 "netstg" "$SECSTAGE $SCSIMODULES" -makeinstimage --size1 6144 --size2 6144 "hdstg" "$SECSTAGE $NETMODULES" +makeinstimage "netstg" "$SECSTAGE $SCSIMODULES" +makeinstimage "hdstg" "$SECSTAGE $NETMODULES" makemainimage "stage2" "cramfs" if [ -f $TOPDESTPATH/preview/RPMS/kernel-2.4.0-*.alpha.rpm ]; then diff --git a/scripts/mk-images.i386 b/scripts/mk-images.i386 index fa4944319..9ddf58863 100644 --- a/scripts/mk-images.i386 +++ b/scripts/mk-images.i386 @@ -46,16 +46,16 @@ prepareBootImage() { # LATEUSBMODS go in the second stage USBMODS="usb-ohci usb-uhci hid keybdev" LATEUSBMODS="mousedev" -IDEMODS="ide-cd" +IDEMODS="" SCSIMODS="sd_mod sr_mod" SECSTAGE="msdos vfat raid0 raid1 raid5 $IDEMODS $SCSIMODS $LATEUSBMODS" -COMMONMODULES="vfat $USBMODS agpgart" +COMMONMODULES="vfat $USBMODS agpgart cramfs ramfs ext3 jbd" LOCALMODULES="$COMMONMODULES BusLogic aic7xxx megaraid ncr53c8xx sym53c8xx $IDEMODS $SCSIMODS" -NETWORKMODULES="$COMMONMODULES nfs 3c59x ne2k-pci de4x5 - eepro100 e100 tulip pcnet32 hp100 +NETWORKMODULES="$COMMONMODULES nfs 3c59x + eepro100 sis900 " PCMCIAMAINMODULES="$COMMONMODULES nfs $IDEMODS $SCSIMODS" @@ -97,7 +97,8 @@ makeinitrd --initrdto $TOPDESTPATH/images/initrd-pcmcia.img \ --loaderbin loader-pcmcia \ --modules "$PCMCIAMAINMODULES" -for I in `find $BOOTDISKDIR -type d`; do +#for I in `find $BOOTDISKDIR -type d`; do +for I in $BOOTDISKDIR; do BOOTLANG=`basename $I` BOOTDIR=`basename $I | cut -d'_' -f1` @@ -188,6 +189,6 @@ makebootdisk --kernelto $TOPDESTPATH/dosutils/autoboot/vmlinuz \ makemainmodules "=scsi =net $SECSTAGE" -makeinstimage --size1 3300 --size2 4608 "netstg" "=scsi $SECSTAGE" -makeinstimage --size1 3300 --size2 4608 "hdstg" "=net $SECSTAGE" -makemainimage "stage2" "ext2" +makeinstimage "netstg" "=scsi $SECSTAGE" +makeinstimage "hdstg" "=net $SECSTAGE" +makemainimage "stage2" "cramfs" diff --git a/scripts/mk-images.ia64 b/scripts/mk-images.ia64 index 8dba580d5..18fbd96d5 100644 --- a/scripts/mk-images.ia64 +++ b/scripts/mk-images.ia64 @@ -33,7 +33,7 @@ makebootdisk --kernelto $TOPDESTPATH/kernels/vmlinuz \ --loaderbin loader \ --modules "nfs fat vfat $USBMODS $NETMODULES $SCSIMODULES $IDEMODULES"' -makeinstimage --size1 8192 --size2 8192 "netstg" "$SECSTAGE $SCSIMODULES $IDEMODULES" -makeinstimage --size1 8192 --size2 8192 "hdstg" "$SECSTAGE $NETMODULES $IDEMODULES" +makeinstimage "netstg" "$SECSTAGE $SCSIMODULES $IDEMODULES" +makeinstimage "hdstg" "$SECSTAGE $NETMODULES $IDEMODULES" makemainmodules "$SECSTAGE $NETMODULES $SCSIMODULES $IDEMODULES" -makemainimage "stage2" "ext2" +makemainimage "stage2" "cramfs" diff --git a/scripts/mk-images.sparc64 b/scripts/mk-images.sparc64 index dd4ed703e..af993e12e 100644 --- a/scripts/mk-images.sparc64 +++ b/scripts/mk-images.sparc64 @@ -93,6 +93,6 @@ makebootdisk --kernelto $TOPDESTPATH/boot/vmlinux64.gz \ makemainmodules "$SECSTAGE $NETMODULES $SCSIMODULES" modules64.cgz -makeinstimage --size1 3000 --size2 3000 "netstg" "$SCSIMOUDLES $SECSTAGE" -makeinstimage --size1 3000 --size2 3000 "hdstg" "$NETMODULES $SECSTAGE" +makeinstimage "netstg" "$SCSIMOUDLES $SECSTAGE" +makeinstimage "hdstg" "$NETMODULES $SECSTAGE" makemainimage "stage2" "ext2" diff --git a/scripts/pkgorder b/scripts/pkgorder index 8d7989b48..82ac840f5 100755 --- a/scripts/pkgorder +++ b/scripts/pkgorder @@ -1,22 +1,24 @@ #!/usr/bin/python import sys -#sys.path.append('/usr/lib/anaconda') import os import os.path import rpm import string -import comps -depcheck = None +rpmFD = None + +import comps def cmpHeaderByName(h1, h2): n1 = string.lower(h1['name']) n2 = string.lower(h2['name']) + if n1 < n2: return -1 elif n1 == n2: return 0; + return 1 if len(sys.argv) != 3: @@ -30,65 +32,87 @@ if not os.path.isdir(distDir): print "error: %s is not a directory" % distDir sys.exit(1) -hdlist = comps.HeaderListFromFile(distDir + "/RedHat/base/hdlist", noscore = 1) +disc1Dir = distDir + "-disc1" +disc1SrcDir = distDir + "-srpms" +disc2Dir = distDir + "-disc2" + +f = distDir + "/RedHat/base/hdlist" +try: + hdlist = comps.HeaderListFromFile(f, noscore = 1) +except rpm.error: + print "Failed to read header list", f + sys.exit(1) comps = comps.ComponentSet(distDir + "/RedHat/base/comps", hdlist, - arch = arch, matchAllLang = 1) + arch = arch, matchAllLang = 1) + +filenamesByPkgName = {} +for p in hdlist.hdlist: + n = p[rpm.RPMTAG_NAME] + if filenamesByPkgName.has_key(n): + filenamesByPkgName[n].append(p[1000000] ) + else: + filenamesByPkgName[n] = [ p[1000000] ] +# work out the order we'd like to install everything in pkgOrder = [] +list = [] pkgHash = {} -# add kernels -for p in hdlist.keys(): - if ((len(p) >= 7 and p[:7] == "kernel-") - and not (len(p) >= 10 and p[:10] == "kernel-doc") - and not (len(p) >= 13 and p[:13] == "kernel-source") - and not (len(p) >= 11 and p[:11] == "kernel-BOOT")): - hdlist[p].selected = 1 - pkgOrder.append(hdlist[p].h) - pkgHash[hdlist[p].h] = None - -# for each comp, starting with base, list the packages +for package in hdlist.keys(): + if ((len(package) >= 7 and package[:7] == "kernel-") + and not (len(package) >= 10 and package[:10] == "kernel-doc") + and not (len(package) >= 13 and package[:13] == "kernel-source") + and not (len(package) >= 11 and package[:11] == "kernel-BOOT")): + hdlist[package].selected = 1 + pkgOrder.append(hdlist[package].h) + pkgHash[hdlist[package].h] = None + +# for each comp, staring with base, list the packages # in alphabetical order. for comp in comps: list = [] if comp.name != 'Everything': - comp.select(1) + comp.select(1) for p in hdlist.selected(): - if not pkgHash.has_key (p.h): - list.append(p.h) + list.append(p.h) + list.sort(cmpHeaderByName) - for p in list: - pkgOrder.append(p) - pkgHash[p] = None + + for item in list: + if not pkgHash.has_key (item): + pkgOrder.append(item) + pkgHash[item] = None + comp.unselect(1) -# add all rpms not in the comps file at the end list = [] for p in hdlist.packages.values(): - if not pkgHash.has_key(p.h): + if not pkgHash.has_key (p.h): list.append(p.h) + list.sort(cmpHeaderByName) -for p in list: - pkgOrder.append(p) -# not needed anymore -pkgHash = {} +for item in list: + pkgOrder.append(item) -testpath = '/tmp/splitdistro-' + str(os.getpid()) +testpath = '/tmp/pkgorder-' + str (os.getpid ()) os.system ("mkdir -p " + testpath + "/var/lib/rpm") + db = rpm.opendb(1, testpath) + ts = rpm.TransactionSet(testpath, db) for h in pkgOrder: + #print h[1000000] ts.add(h, h, 'i') +pkgOrder = [] + ts.order() -if depcheck: - deps = ts.depcheck() - if deps: - print "unresolved dependencies:" - for dep in deps: - print dep - -for p in ts.getKeys(): - print p[1000000] -os.system ("rm -rf " + testpath) + +try: + pkgOrder = ts.getKeys() +except AttributeError: + print "you don't have the latest RPM!" + +for p in pkgOrder: + print "%s-%s-%s" % (p['name'], p['version'], p['release']) diff --git a/scripts/splitdistro b/scripts/splitdistro new file mode 100755 index 000000000..e6377c6b3 --- /dev/null +++ b/scripts/splitdistro @@ -0,0 +1,191 @@ +#!/usr/bin/python + +# These dirs, along with RPMS, make up disc 2 +disc2dirs = [ "preview" ] + +# These files appear on all binary CDs +jointfiles = [ "COPYING", "RPM-GPG-KEY", "README", "autorun" ] + +targetSize = 650 * 1024 * 1024 + +# Leave about 1.2MB of space on the disc +fudgeFactor = 1.2 * 1024 * 1024 + +#----------------- + +import sys +import os +import os.path +import string +import getopt +import time +import types + +def stamp(path, name, arch, startedAt): + f = open("%s/.%s-%s" % (path, name, arch), "w") + f.write("%f\n" % startedAt) + f.close() + +def moveFiles(srcDir, destDir, files): + for fn in files: + src = "%s/%s" % (srcDir, fn) + dest = "%s/%s" % (destDir, fn) + os.rename(src, dest) + +def excessFiles(path, fileList, maxSize): + total = 0 + moveList = [] + + for fns in fileList: + if type(fns) == types.StringType: + fns = [ fns ] + + size = 0 + for fn in fns: + thisSize = os.path.getsize(path + "/" + fn) + size = size + thisSize + ((thisSize + 2047) % 2048) + + if size + total < maxSize: + total = total + size + else: + # once we're done, we're done + total = maxSize + moveList.extend(fns) + + return moveList + +class DirectoryIterator: + def __init__(self): + self.inodes = {} + + def traverse (self, arg, dirname, names): + for name in names: + sb = os.lstat (dirname + "/" + name) + if not self.inodes.has_key(sb[1]): + self.inodes[sb[1]] = sb[6] + + def total(self): + total = 0 + for size in self.inodes.values(): + total = total + size + return total + +def spaceUsed(path): + foo = DirectoryIterator() + os.path.walk (path, foo.traverse, None) + return foo.total() + +startedAt = time.time() + +fns = {} + +(args, extra) = getopt.getopt(sys.argv[1:], '', [ 'fileorder=' ]) +if len(extra) != 2: + print "splitdistro --fileorder <file> <toppath> <arch>" + sys.exit(1) + +for n in args: + (str, arg) = n + if str == '--fileorder': + packageOrderFile = arg + +arch = extra[1] +distDir = os.path.normpath(extra[0] + "/" + arch) +srcDir = os.path.normpath(extra[0] + "/SRPMS") + +if not os.path.isdir(distDir): + print "error: %s is not a directory" % distDir + sys.exit(1) + +if not os.path.isdir(srcDir): + print "error: %s is not a directory" % srcDir + sys.exit(1) + +disc1Dir = distDir + "-disc1" +disc2Dir = distDir + "-disc2" +disc1SrcDir = distDir + "-srpms1" +disc2SrcDir = distDir + "-srpms2" + +id = 0 + +files = os.listdir(distDir + "/RedHat/RPMS") +files.sort() +packages = {} +for file in files: + l = string.split(file, ".") + pkg = string.join(l[:-2], ".") + if packages.has_key(pkg): + packages[pkg].append(file) + else: + packages[pkg] = [ file ] + +f = open(packageOrderFile, "r") +binPkgList = [] +for pkg in f.readlines(): + # chop + pkg = pkg[:len(pkg) - 1] + if pkg[0:8] != "warning:": + binPkgList.append(packages[pkg]) + +del f + +print "Splitting tree..." + +totalsize = spaceUsed(distDir) +rpmsize = spaceUsed(distDir + "/RedHat/RPMS") +dirsize = 0 +for dir in disc2dirs: + what = distDir + "/" + dir + if os.access(what, os.R_OK): + dirsize = dirsize + spaceUsed(distDir + "/" + dir) + +disc1used = totalsize - rpmsize - dirsize + +os.system("rm -rf %s %s %s %s" % ( disc1Dir, disc2Dir, disc1SrcDir, + disc2SrcDir)) +os.system("mkdir -p %s %s %s/SRPMS %s/RedHat/RPMS" % + (disc1Dir, disc1SrcDir, disc2SrcDir, disc2Dir)) + +print "Creating disc1..." + +os.system("cp -al %s/. %s" % (distDir, disc1Dir)) +stamp(disc1Dir, "disc1", arch, startedAt) + +print "Creating disc2..." +stamp(disc2Dir, "disc2", arch, startedAt) + +for file in jointfiles: + src = "%s/%s" % (disc1Dir, file) + dest = "%s/%s" %(disc2Dir, file) + try: + os.link(src, dest) + except OSError, (errno, msg): + print "**** WARNING linking %s to %s: %s" % (src, dest, msg) + +disc2pkgs = excessFiles(distDir + "/RedHat/RPMS", binPkgList, + targetSize - disc1used - fudgeFactor) + +moveFiles("%s/RedHat/RPMS" % disc1Dir, + "%s/RedHat/RPMS" % disc2Dir, + disc2pkgs); + +print "Creating first source disc..." +os.system("cp -al %s/. %s" % (srcDir, disc1SrcDir)) +stamp(disc1SrcDir, "disc1src", arch, startedAt) + +print "Creating second source disc..." +stamp(disc2SrcDir, "disc2src", arch, startedAt) + +srcPkgList = os.listdir("%s/SRPMS" % disc1SrcDir) +srcPkgList.sort() +disc2pkgs = excessFiles(disc1SrcDir + "/SRPMS", srcPkgList, + targetSize - fudgeFactor) +moveFiles("%s/SRPMS" % disc1SrcDir, + "%s/SRPMS" % disc2SrcDir, + disc2pkgs); + +sys.exit(0) + +sys.stdout.flush() + +os.system("du -sh %s %s %s" % (disc1Dir, disc2Dir, disc1SrcDir)) diff --git a/scripts/upd-instroot b/scripts/upd-instroot index c23b9c2b1..175bdb378 100755 --- a/scripts/upd-instroot +++ b/scripts/upd-instroot @@ -1,10 +1,16 @@ #!/bin/bash ORIGDIR=`pwd` +COMPONENT="" + +if [ "$1" == "--comp" ]; then + COMPONENT=$2 + shift; shift +fi if [ -z "$1" ]; then echo "upd-instroot: updates instimage from a Red Hat RPMS directory" - echo "usage: $0 <packagedir> [templatedir] [instroot]" + echo "usage: $0 --comp <comp> <packagedir> [templatedir] [instroot]" exit 1 fi @@ -88,7 +94,7 @@ mkdir -p $DESTGR PACKAGES="glibc glibc-common setup openssl python newt libtermcap zlib ash kon2 e2fsprogs util-linux raidtools popt mount procps rpm XFree86 Xconfigurator anaconda anaconda-runtime kudzu-devel - kudzu db3 rpm-python bzip2 dosfstools pciutils reiserfs-utils" + kudzu db3 rpm-python bzip2 dosfstools pciutils reiserfs-utils parted" if [ $ARCH = i386 ]; then PACKAGES="$PACKAGES kernel-pcmcia-cs" @@ -209,14 +215,17 @@ usr/lib/libdb.so.2 usr/lib/libdb.so.3 usr/lib/libdb1* usr/lib/libnewt* +usr/lib/libparted* usr/lib/libpopt* usr/lib/librpm.so* +usr/lib/librpmdb.so* usr/lib/librpmio.so* usr/lib/libslang* usr/lib/libz.* usr/lib/python* usr/lib/python1.5/site-packages/*kudzu* usr/lib/python1.5/site-packages/rpmmodule.so +usr/lib/python1.5/site-packages/partedmodule.so usr/lib/rpm/macros usr/lib/rpm/rpmpopt usr/lib/rpm/rpmrc @@ -589,9 +598,9 @@ for p in $DEST $DESTGR; do grep '^./[A-Z]' | sort | sed 's/^..//' | gzip -9) > $p/usr/lib/timezones.gz - if [ -x /usr/bin/runroot ]; then - REALPATH=`(cd $p; /bin/pwd)` - runroot dist-7.1 --onlyone --arch $ARCH "cd $REALPATH\; usr/lib/anaconda-runtime/scrubtree $REALPATH" + if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then + REALPATH=`(cd $p; /bin/pwd | sed 's,/md1/,/,g')` + runroot $COMPONENT --onlyone --arch $ARCH "cd $REALPATH\; usr/lib/anaconda-runtime/scrubtree $REALPATH" else $p/usr/lib/anaconda-runtime/scrubtree $p fi @@ -638,9 +647,10 @@ EOF cd - echo -n -e "Removing unused python files in hdimage... " -if [ -x /usr/bin/runroot ]; then - REALPATH=`(cd $DEST; /bin/pwd)` - runroot dist-7.1 --onlyone --arch $ARCH "cd $REALPATH\; usr/lib/anaconda-runtime/pythondeps $REALPATH" + +if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then + REALPATH=`(cd $DEST; /bin/pwd | sed 's,/md1/,/,g')` + runroot $COMPONENT --onlyone --arch $ARCH "cd $REALPATH\; usr/lib/anaconda-runtime/pythondeps $REALPATH" else $DEST/usr/lib/anaconda-runtime/pythondeps $DEST fi @@ -663,43 +673,8 @@ if [ $NEEDGR ]; then fi # this is only for the minimal second stage -echo "Compressing ramdisk install images..." - - cd $DEST/usr/lib - find python1.5 | cpio --quiet -H crc -o | gzip -9 > python1.5.cgz - rm -rf python1.5 - - find anaconda | cpio --quiet -H crc -o | gzip -9 > anaconda.cgz - rm -rf anaconda - - ls libnewt* libslang* | cpio --quiet -H crc -o | - gzip -9 > slang-newt.cgz - rm -f libnewt* libslang* - - cd $DEST/usr/bin - echo python1.5 | cpio --quiet -H crc -o | gzip -9 > python1.5.cgz - /bin/rm -f python python1.5 - /bin/ln -s python1.5 python - - mv anaconda anaconda.real - mv $DEST/usr/lib/anaconda-runtime/anaconda-stub anaconda - - cd $DEST/lib - ls libcom* libcrypt* libdl* libe2p* libext2* libm* libnss* libnsl* \ - libpthread* libss* libtermcap* libuuid* \ - | cpio --quiet -H crc -o | gzip -9 > libs.cgz - rm -f libcom* libcrypt* libdl* libe2p* libext2* libm* libnss* libnsl* \ - libpthread* libss* libtermcap* libuuid* - - cd $DEST/usr - find X11R6 | cpio --quiet -H crc -o | gzip -9 > X11R6.cgz - rm -rf X11R6 - - cd $DEST/usr/sbin - ls [a-r]* | cpio --quiet -H crc -o | gzip -9 > sbin.cgz - rm -f [a-r]* - - rm -rf $DEST/usr/lib/anaconda-runtime +echo "Cleaning ramdisk install images..." + rm -rf $DEST/usr/lib/anaconda-runtime if [ -n "$NEEDGR" ]; then cd $ORIGDIR |