#!/usr/bin/ksh ####################################################################3 # Create a productline from a package created by pkg_pline.sh # J. David Schronce - Thu May 22 15:24:02 CDT 2003 ####################################################################3 # Display instructions if [ $# -gt 0 ]; then clear echo " unpack_pline.sh used to create a productline in the exact image of the one packaged with pkg_pline.sh Before You Begin: Turn Lawson Security Off before proceeding. su - root and cd $LADBDIR/GEN and verify that all the GEN tables are at least 660 and owned by 'lawson' The program must be executed by user 'root' and has the logic to exit gracefully if that is not the case. . cv into the existing, running target environment execute unpack_pline.sh with no parameters Required knowledge: Your previously created package file must be located in a workspace with a minimum of 300 MB of remaining free space. This is where the package file will be unpacked. You will be expected to provide the full path to this directory at the File Storage Directory > prompt. You will then be asked to provide the Source Productline name from with the package was created at the Name of Orginal SOURCE Product Line > prompt. The first section of the package file name reflects the source productline. Next you'll be asked to provide the name of the TARGET Productline at the Name of TARGET Product Line > prompt. This productline cannot already exist or the program will exit. Press to continue...\c" read dummy echo " This completes the program's requests for information. It will create the new productline after you press at the Preparing to create in environment.. Press to Continue > prompt What happens next: If you specified only the DIRECTORY in which the package file(s) exist, you will be shown a menu listing of the available packages and asked to select the number corresponding to your choice. Otherwise the named file will be acted upon. One selected the previously prepared package will be untarred in it's work directory and each of it's components will be uncompressed, installed and deleted. The original package file remains untouched so it can be used repeatedly. Along with streaming of filenames up your screen, you will see these major section notations: Loading System.. Loading Menus.. Installing Source Code ... Installing Libraries... Reproducing Admin... Building dictionary Output is in /tmp/.log The program now executes a blddbdict and a dbcreate, completing the productline copy Press to continue...\c" read dummy echo " The executable programs have not been built at this point. You will need to execute cobcmp as user 'lawson' J. David Schronce June 6, 2003 " exit fi # Only execute as 'root' if [ $LOGNAME != "root" ]; then echo "\n\n$0 only executable by user 'root'...\n\n" exit fi # Make sure there is an environment if [ "X$LAWENVNAME" = "X" ]; then echo "\nNo Environment: . cv to SOURCE Environment...\n" exit 1 fi echo "\nNOTICE :Currently in * $LAWENVNAME * environment. If this is not the" echo "TARGET environment then press and cv to the correct one." echo "Otherwise, press to continue >\c" read dummy # Get parms echo "\nEnter the full path to a directory that contains your PL package" echo "\nFile Storage Directory > \c" read WorkDir if [ "X$WorkDir" = "X" ]; then echo "Cannot be null..." exit 4 fi # See if Directory exists if [ -d $WorkDir ]; then : else echo "$WorkDir does not exist..." exit 2 fi echo "Name of Original SOURCE Product Line > \c" read CurrentPLName if [ "X$CurrentPLName" = "X" ]; then echo "Cannot be null..." exit 4 fi echo "Name of TARGET Product Line > \c" read NewPLName if [ "X$NewPLName" = "X" ]; then echo "Cannot be null..." exit 4 fi # Following commented out to allow new PL to overwrite existing PL # Fast way to apply a load of patches!! # Check to see if New Prodline already exists #rngdbdump -nc gen prodline -f Productline \ #| sed 's/"//g' | tr [:upper:] [:lower:] \ #> /tmp/plines.$$ #if [ `grep ^$NewPLName$ /tmp/plines.$$ | wc -l` -gt 0 ]; then #echo "$newPLName already exists - Aborting..." #sleep 3 #exit 5 #fi #rm /tmp/plines.$$ # Create new PL cd $LAWDIR echo "Current directory is `pwd`" echo "Preparing to create $NewPLName in $LAWENVNAME environment.." echo "Press to Continue >\c" read dummy echo "Creating $NewPLName..." if [ -f $NewPLName ]; then : else mkdir $NewPLName chmod 777 $NewPLName fi # Untar package ######################################################## cd $WorkDir # get Correct Package File if [ `ls -1 $CurrentPLName.pkg.tar.* | wc -l` -eq 1 ]; then pkg=`ls -1 $CurrentPLName.pkg.tar.*` else ls -1 $CurrentPLName.pkg.tar.* | sort > /tmp/expfile.$$ pr -n -t /tmp/expfile.$$ | more -e echo "Enter number of Package File to use > \c" read ans pkg=`sed -n "$ans p" /tmp/expfile.$$ 2> /dev/null` rm /tmp/expfile.$$ fi echo "Preparing package for deployment..." # kls added p flag tar xvpf $pkg echo "Loading System.." uncompress $CurrentPLName.exp.Z sysload -efp $WorkDir/$CurrentPLName.exp $NewPLName rm $WorkDir/$CurrentPLName.exp echo "Loading Menus.." uncompress $CurrentPLName.menus.Z ldprodmenus $WorkDir/$CurrentPLName.menus $NewPLName rm $WorkDir/$CurrentPLName.menus # Install source and libraries echo "Installing Source Code ..." cd $WorkDir uncompress $CurrentPLName.src.tar.Z cd $LAWDIR/$NewPLName # kls added p flag tar xpf $WorkDir/$CurrentPLName.src.tar rm $WorkDir/$CurrentPLName.src.tar echo "Installing Libraries..." cd $WorkDir uncompress $CurrentPLName.lib.tar.Z cd $LAWDIR/$NewPLName # kls added p flag tar xpf $WorkDir/$CurrentPLName.lib.tar rm $WorkDir/$CurrentPLName.lib.tar echo "Reproducing Admin..." cd $WorkDir uncompress $CurrentPLName.admin.tar.Z cd $LAWDIR/$NewPLName # kls added p flag tar xpf $WorkDir/$CurrentPLName.admin.tar rm $WorkDir/$CurrentPLName.admin.tar if [ -f $WorkDir/$CurrentPLName.NONSTDLIB.cfg.tar.Z ]; then cd $WorkDir uncompress $CurrentPLName.NONSTDLIB.cfg.tar.Z cd $LAWDIR/$NewPLName # kls added p flag tar xpf $WorkDir/$CurrentPLName.NONSTDLIB.cfg.tar rm $WorkDir/$CurrentPLName.NONSTDLIB.cfg.tar fi if [ -f $WorkDir/$CurrentPLName.NONSTD_DIRS.tar.Z ]; then cd $WorkDir uncompress $CurrentPLName.NONSTD_DIRS.tar.Z cd $LAWDIR/$NewPLName # kls added p flag tar xpf $WorkDir/$CurrentPLName.NONSTD_DIRS.tar rm $WorkDir/$CurrentPLName.NONSTD_DIRS.tar fi echo "\nBuilding $NewPLName dictionary" echo "Output is in /tmp/$NewPLName.log" blddbdict $NewPLName > /tmp/$NewPLName.log dbcreate $NewPLName cd $LAWDIR/$NewPLName bldmsg $NewPLName ./Admin/usrexits.msg echo "\n\nReady to compile source for $NewPLName"