#!C:/MKS/mksnt/ksh.exe ####################################################################3 # Create a productline from a package created by la_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 is a Korn Shell script located in $GENDIR/bin. Its purpose is 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. login as "Administrator" and cd $LADBDIR/GEN and verify that all the GEN tables are at leastd 660 and owned by 'Administrator' The program must be executed by user 'Administrator' and has the logic to exit gracefully if that is not the case. Run $GENDIR/bin/setenv.ksh into the existing, running target environment execute $GENDIR/bin/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. The program will also check to see if the environment is running. If not the program will report this error and 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 C:/temp/.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 $GENDIR/bin/app_compile.sh as user 'Administrator' Caveat: The $LAWDIR//data directory (A non-standard HCA structure) is NOT replicated in this script due to the fact that it must be created EMPTY for any new productline. Ask a unix admin to crete an empty structure for you if you do not know how. J. David Schronce Lawson Software June 6, 2003 " exit fi # Only execute as 'administrator' if [ $LOGNAME != "administrator" ]; then echo "\n\n$0 only executable by user 'administrator'...\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 # Make sure security is OFF if [ `lawsec` != "Lawson Security Is Off." ]; then echo "\n\nTurn OFF Security and try again...\n\n" exit fi # 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 # Check to see if New Prodline already exists rngdbdump -nc gen prodline -f Productline \ | sed 's/"//g' | tr [:upper:] [:lower:] \ > c:/temp/plines.$$ if [ `grep ^$NewPLName$ c:/temp/plines.$$ | wc -l` -gt 0 ]; then echo "$newPLName already exists - Aborting..." sleep 3 exit 5 fi rm c:/temp/plines.$$ # See if TARGET Environment is running #NewPLEnvName=$LAWENVNAME #if [ `ps -ef | grep $NewPLEnvName | grep ladb | wc -l` -lt 2 ]; then # echo "TARGET environment is not running..." # exit 3 #fi # Create new PL #. cv $NewPLEnvName 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 > c:/temp/expfile.$$ pr -n -t c:/temp/expfile.$$ | more -e echo "Enter number of Package File to use > \c" read ans pkg=`sed -n "$ans p" c:/temp/expfile.$$ 2> c:/temp/null` rm c:/temp/expfile.$$ fi echo "Preparing package for deployment..." # kls added p flag tar xvpf $pkg echo "Loading System.." uncompress $CurrentPLName.exp.gz sysload -efp $WorkDir/$CurrentPLName.exp $NewPLName rm $WorkDir/$CurrentPLName.exp echo "Loading Menus.." uncompress $CurrentPLName.menus.gz ldprodmenus $WorkDir/$CurrentPLName.menus $NewPLName rm $WorkDir/$CurrentPLName.menus # Install source and libraries echo "Installing Source Code ..." cd $WorkDir uncompress $CurrentPLName.src.tar.gz 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.gz 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.gz 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.gz ]; then cd $WorkDir uncompress $CurrentPLName.NONSTDLIB.cfg.tar.gz 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.gz ]; then cd $WorkDir uncompress $CurrentPLName.NONSTD_DIRS.tar.gz 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 c:/temp/$NewPLName.log" blddbdict $NewPLName > c:/temp/$NewPLName.log dbcreate $NewPLName echo "\n\nReady to compile source for $NewPLName"