Migrating packages from legacy to modular style

33
operation_sequence $SGCONF/scripts/sg/filesystem.sh \
operation_sequence $SGCONF/scripts/sg/package_ip.sh \
operation_sequence $SGCONF/scripts/sg/external.sh \
operation_sequence $SGCONF/scripts/sg/service.sh \
' > $newpkg
The following script automates some of the changes needed to modify the package control script.
#!/bin/sh
# Input to scrip is packagename
# The steps to convert are:
# get the package controlscript name
# get the package ascii file
# get arguments - input is package name if (( $# == 0 ))
then
echo "ERROR: Package name is required" exit 1;
fi
nupkg=$1
nuscript=$2
# get control script from pkg1
nupkgcntl=$(cmviewcl -v -fline -p $nupkg | grep "run_script=")
nupkgcntl=${nupkgcntl#*=}
echo "control script = $nupkgcntl"
# Extract parameters from control script # Get only parameters from control script
cat $nupkgcntl |
sed -e '/# START OF CUSTOMER DEFINED FUNCTIONS/,$d' > ./tmp/nu-pkg.cntl.0
# Extract package attributes from package control file
cat ./tmp/nu-pkg.cntl.0 | grep ^[A-Z_.-]*[*[0-9]*]*= |
egrep -v -i 'PATH|GFS|DATA_REP|RAID|HA_NFS_SCRIPT_EXTENSION' |
egrep -v -i 'DTC_NAME|^MD|HA_APP_SERVER|STORAGE_GROUP'|
sed -e 's/\[[0-9]*\]//g' \
-e 's/=/ /g'\
-e 's/# Default//'\
-e 's/^SUBNET/IP_SUBNET/'\
-e 's/\"-r\([ 0-9]*\)\"/\1/'\
-e 's/\"-R\"/unlimited/'> ./tmp/nu-pkg.cntl.1