#!/bin/ksh ############################################################################### # $Id: make_install_images,v 1.1.1.1 2005/09/06 14:55:47 petri Exp $ # Project: ESRF/Linux # Description: Rebuilding KickStart databases from RPMS # # Author(s): Bernard Regad, Petri Makijarvi # European Synchrotron Radiation Facility, # Grenoble, France # # Original: August 2005 (started as make-ks-sdb2) # # License: GNU General Public License, version 2 ############################################################################### # # This script can be executed only by root # if [ $(whoami) != "root" ];then echo "You must be root" exit 1 fi # # This script can be executed only from its data directory # if [ $0 != "./make_install_images" ];then echo "You must start the script with command ./make_install_images" echo "- move to release/version/patch/ksbin directory first" exit 1 fi # # The script should be executed in a directory path, such as # /dist/rX/vY/pZ/mydist/ksbin/ # 1 2 3 4 5 6 7 depth=`pwd | awk '/^\// { n = split ( $0, arr, "/"); print n; }'` if [ ${depth} -ne 7 ]; then echo "Sorry, you are executing this script from data directory" echo "- `pwd`" echo "Your data directory should in the directory where this script" echo "is located, something like" echo "- /dist/rX/vY/pZ/mydist/ksbin/" exit 1 fi # # Following is adapted for the ESRF/Linux tree from RedHat's examples # # Find out the revision, version and patch level string from the path # and run buildinstall-utility script to remake the stage2-images. # revision=`pwd | awk '/^\// { n = split ( $0, arr, "/"); print arr[3]; }'` version=`pwd | awk '/^\// { n = split ( $0, arr, "/"); print arr[4]; }'` patch=`pwd | awk '/^\// { n = split ( $0, arr, "/"); print arr[5]; }'` diststr="${revision}${version}${patch}" distdir="${revision}/${version}/${patch}" echo "make_install_images: Building install images for ${diststr}.." echo " Note that the following steps" echo " will take several minutes each." echo " Please do not interrupt." # unalias cp # echo -n "make_install_images: Adding signatures to all packages.." rpm --addsign /dist/${distdir}/rhel4ws/RedHat/RPMS/*rpm 1>/tmp/rpmaddsign.log 2>&1 echo "done." # echo -n "make_install_images: Removing all TRANS.TBL files.." export FCBASE=/dist/${distdir}/rhel4ws find $FCBASE -name TRANS.TBL -exec rm -f {} \; echo "done." # echo -n "make_install_images: Removing old hdlist-files.." rm -rf /dist/${distdir}/rhel4ws/RedHat/base/hdlist* echo "done." # # gendhlist, pkgorder and buildinstall scripts settings # export PYTHONPATH=/usr/lib/anaconda PATH=$PATH:/usr/lib/anaconda-runtime export PATH cd /dist/${distdir}/rhel4ws # echo -n "make_install_images: generating RPM header lists (1st pass).." genhdlist \ --withnumbers \ --productpath RedHat \ --hdlist RedHat/base/hdlist `pwd` 1>/tmp/genhdlist_1.log 2>&1 echo "done. " echo " (log file /tmp/genhdlist_1.log)" # echo -n "make_install_images: creating file order list of packages.." pkgorder `pwd` i386 RedHat >./RedHat/pkgfile.rhe4 2>/tmp/pkgorder.log cp ./RedHat/pkgfile.rhe4 /tmp/pkgfile.rhe4 echo "done." echo " (log file error output /tmp/pkgorder.log)" echo " (generated package file copy /tmp/pkgfile.rhe4)" # echo -n "make_install_images: generating genhdlist (2nd pass).." genhdlist \ --withnumbers \ --productpath RedHat \ --fileorder RedHat/pkgfile.rhe4 \ --hdlist RedHat/base/hdlist `pwd` 1>/tmp/genhdlist_2.log 2>&1 echo "done." echo " (log file /tmp/genhdlist_2.log)" # # Note that the below buildinstall destroys the package order file if it fails. echo -n "make_install_images: building ISO images and stage2 images.." buildinstall \ --pkgorder /dist/${distdir}/rhel4ws/RedHat/pkgfile.rhe4 \ --version 4 \ --product 'RedHat Enterprise Linux' \ --release "${diststr}" \ --discs "${diststr}" \ --prodpath RedHat \ --comp ${diststr} \ --debug \ /dist/${distdir}/rhel4ws 1>/tmp/buildinstall.log 2>&1 echo "done." echo " (log file /tmp/buildinstall.log)" # echo -n "make_install_images: building product image.." mkproduct.sh \ --productname 'RedHat Enterprise Linux' \ --version 4 \ /dist/${distdir}/rhel4ws 1>/tmp/mkproduct.log 2>&1 echo "done." echo " (log file /tmp/mkproduct.log)" # echo -n "make_install_images: Cleaning /tmp directory.." unalias rm rm -rf /tmp/glibc-timezone-* rm -rf /tmp/instimagemods.* rm -rf /tmp/pkgorder-* rm -rf /tmp/product.img.* rm -rf /tmp/product.mnt.* rm -rf /tmp/treedir.* echo "done." # echo "make_install_images: Check the creation dates of following files:" cd /dist/${distdir}/rhel4ws/isolinux/ ls -g -G -s -h vmlinuz cd /dist/${distdir}/rhel4ws/RedHat/base/ ls -g -G -s -h hdlist* ls -g -G -s -h stage2.img ls -g -G -s -h product.img echo "make_install_images: if _all_ the above images have been generated OK" echo " install the ISO kernel on Rembo servers" echo " with script ./upload_iso_kernel_all ." echo " Done." # # end of script make_install_images