Commit 1fc99797 authored by claes's avatar claes

*** empty log message ***

parent b8c1bdd9
......@@ -25,7 +25,6 @@ public class Errh {
private static boolean initDone = false;
public Errh( String programName, int anix) {
if ( !initDone) {
init( programName, anix);
initDone = true;
......
......@@ -13,31 +13,39 @@ let reload__loaddb=4
let pass__continue=1
let pass__execute=2
reload_createstruct()
reload_classvolumes()
{
reload_checkpass "createstruct" $start_pass
reload_checkpass "classvolumes" $start_pass
if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success
return
fi
reload_continue "Pass create structfiles"
fname="$pwrp_db/userclasses.wb_load"
if [ -e $fname ]; then
echo "-- Creating structfile for $fname"
co_convert -sv -d $pwrp_inc $fname
fi
reload_continue "Pass create structfiles and loadfiles for classvolumes"
list=`eval ls -1d $pwrp_db/*.wb_load`
for file in $list; do
volume=`eval grep pwr_eClass_ClassVolume $file | awk '{ print $2 }'`
volumelow=`eval grep pwr_eClass_ClassVolume $file | awk '{ print tolower($2) }'`
if [ "$volume" != "" ]; then
echo "-- Creating structfile and loadfile for $volume"
if co_convert -sv -d $pwrp_inc $file
then
reload_status=$reload__success
else
reload_status=$reload__userclasses
return
fi
for cdb in $databases; do
if [ $cdb != "dbdirectory" ]; then
fname="$pwrp_db/$cdb/userclasses.wb_load"
if [ -e $fname ]; then
echo "-- Creating structfile for $fname"
co_convert -sv -d $pwrp_inc $fname
if wb_cmd create snapshot/file=\"$file\"/out=\"$pwrp_load/$volumelow.dbs\"
then
reload_status=$reload__success
else
reload_status=$reload__userclasses
return
fi
fi
fi
done
}
......@@ -51,145 +59,52 @@ reload_dumpdb()
reload_continue "Pass dump database"
# Rename old dumpfiles
dmpfiles=`eval ls -1 $pwrp_db/*.wb_dmp`
for dmpfile in $dmpfiles; do
reload_save_file $dmpfile
done
for cdb in $databases; do
echo "Dumping database $cdb"
source pwrp_env.sh setdb $cdb
if [ $cdb != "dbdirectory" ]; then
#Store versions of classvolumes
wb_cmd @$pwr_exe/reload_vol_versions $cdb
fi
dump_file=$pwrp_db/$cdb.wb_dmp
reload_save_file $dump_file
wb_cmd wb dump/out=\"$dump_file\"
echo "Dumping volume $cdb in $dump_file"
wb_cmd -v $cdb wb dump/out=\"$dump_file\"
done
}
reload_templatedb()
reload_renamedb()
{
reload_checkpass "templatedb" $start_pass
reload_checkpass "renamedb" $start_pass
if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success
return
fi
reload_continue "Pass copy template database"
reload_continue "Pass copy rename old database"
for cdb in $databases; do
echo "-- Copy template database to $cdb"
source pwrp_env.sh copy template $cdb noconfirm
reload_save_file $pwrp_db/$cdb.db
done
}
reload_userclasses()
reload_dirvolume()
{
reload_checkpass "userclasses" $start_pass
if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success
if [ -e "$pwrp_db/directory.db" ]; then
return
fi
reload_continue "Pass load userclasses"
for cdb in $databases; do
if [ $cdb != "dbdirectory" ]; then
source pwrp_env.sh setdb $cdb
# Load usertypes
fname="$pwrp_db/$cdb/usertypes.wb_load"
list_file="$pwrp_db/"$cdb"_usertypes.lis"
if [ -e $fname ]; then
echo "-- Loading usertypes in $cdb $fname"
if wb_cmd wb load/load=\"$fname\"/out=\"$list_file\"
then
reload_status=$reload__success
else
reload_status=$reload__usertypes
cat $list_file
return
fi
else
fname="$pwrp_db/usertypes.wb_load"
list_file="$pwrp_db/"$cdb"_usertypes.lis"
if [ -e $fname ]; then
echo "-- Loading usertypes in $cdb $fname"
if wb_cmd wb load/load=\"$fname\"/out=\"$list_file\"
then
reload_status=$reload__success
else
reload_status=$reload__usertypes
cat $list_file
return
fi
fi
fi
# Load userclasses
fname="$pwrp_db/$cdb/userclasses.wb_load"
list_file="$pwrp_db/"$cdb"_userclasses.lis"
if [ -e $fname ]; then
echo "-- Loading userclasses in $cdb $fname"
if wb_cmd wb load/load=\"$fname\"/out=\"$list_file\"
then
reload_status=$reload__success
else
reload_status=$reload__userclasses
cat $list_file
return
fi
else
fname="$pwrp_db/userclasses.wb_load"
list_file="$pwrp_db/"$cdb"_userclasses.lis"
if [ -e $fname ]; then
echo "-- Loading userclasses in $cdb $fname"
if wb_cmd wb load/load=\"$fname\"/out=\"$list_file\"
then
reload_status=$reload__success
else
reload_status=$reload__userclasses
cat $list_file
return
fi
fi
fi
fi
done
}
reload_settemplate()
{
reload_checkpass "settemplate" $start_pass
reload_checkpass "dirvolume" $start_pass
if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success
return
fi
reload_continue "Pass set template values"
fname="$pwrp_db/set_template.pwr_com"
if [ -e $fname ]; then
for cdb in $databases; do
if [ $cdb != "dbdirectory" ]; then
source pwrp_env.sh setdb $cdb
echo "-- Setting template values in $cdb $fname"
if wb_cmd @$fname
then
reload_status=$reload__success
else
reload_status=$reload__settemplate
return
fi
fi
done
else
echo "-- No set_template file found"
reload_status=$reload__success
fi
reload_continue "Pass dirvolume"
wb_cmd create volume/directory
wb_cmd wb load /load=\"$pwrp_db/directory.wb_dmp\"
}
reload_loaddb()
......@@ -202,27 +117,34 @@ reload_loaddb()
reload_continue "Pass load database"
if [ -z "$1" ]; then
tmp=`eval ls -1 $pwrp_db/*.wb_dmp`
databases=""
for db in $tmp; do
db=${db##/*/}
db="${db%.*}"
if [ "$db" != "directory" ]; then
databases="$databases $db"
fi
done
else
databases=$@
fi
for cdb in $databases; do
echo "-- Loading database $cdb"
if [ $cdb != "directory" ]; then
echo "-- Loading volume $cdb"
source pwrp_env.sh setdb $cdb
if [ $cdb != "dbdirectory" ]; then
#Restore versions of classvolumes
if [ -e $pwrp_db/reload_vol_versions_$cdb.pwr_com ]; then
wb_cmd @$pwrp_db/reload_vol_versions_$cdb
dump_file=$pwrp_db/$cdb.wb_dmp
list_file=$pwrp_db/$cdb.lis
if wb_cmd wb load/load=\"$dump_file\"/out=\"$list_file\"
then
reload_status=$reload__success
else
cat $list_file
reload_status=$reload__loaddb
fi
fi
dump_file=$pwrp_db/$cdb.wb_dmp
list_file=$pwrp_db/$cdb.lis
if wb_cmd wb load/load=\"$dump_file\"/out=\"$list_file\"/ignore
then
reload_status=$reload__success
else
cat $list_file
reload_status=$reload__loaddb
fi
done
}
......@@ -383,14 +305,10 @@ usage()
Pass
createstruct Create structfiles
dumpdb Dump database to textfile \$pwrp_load/'dbid'.wb_dmp
templatedb Replace the database with a template database
userclasses Load userclasses.wb_load (and usertypes.wb_load)
reload will first the load_files in \$pwrp_db/'dbid'/
and then in \$pwrp_db/
settemplate Set template values. \$pwrp_db/set_template.pwr_com is
executed
classvolumes Create structfiles and loadfiles for classvolumes
dumpdb Dump database to textfile \$pwrp_db/'volume'.wb_dmp
renamedb Rename the old database database
dirvolume Load directory volume
loaddb Load the dump into the new database
compile Compile all plcprograms in the database
removeload Remove old loadfiles.
......@@ -400,7 +318,7 @@ usage()
EOF
}
if [ $1 = "help" ] || [ $1 = "-h" ]; then
if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
usage
exit
fi
......@@ -411,8 +329,15 @@ let check_status=0
let go=0
if [ -z "$1" ]; then
databases=`eval source pwrp_env.sh show db -a`
databases=$databases" dbdirectory"
tmp=`eval ls -1d $pwrp_db/*.db`
databases=""
for db in $tmp; do
db=${db##/*/}
db="${db%.*}"
if [ "$db" != "rt_eventlog" ]; then
databases="$databases $db"
fi
done
else
databases=$@
fi
......@@ -420,17 +345,17 @@ fi
usage
echo ""
echo "-- Reloading database $databases"
echo "-- Reloading volume $databases"
echo ""
passes="createstruct dumpdb templatedb userclasses settemplate loaddb compile removeload createload createboot"
passes="dumpdb classvolumes renamedb dirvolume loaddb compile removeload createload createboot"
echo "Pass: $passes"
echo ""
echo -n "Enter start pass [createstruct] > "
echo -n "Enter start pass [dumpdb] > "
read start_pass
if [ -z $start_pass ]; then
start_pass="createstruct"
start_pass="dumpdb"
fi
for cpass in $passes; do
......
......@@ -35,6 +35,61 @@ reload_dumpdb()
source $v34_root/os_linux/hw_x86/exp/exe/pwrp_env.sh setdb $cdb
export pwr_inc=$pwrb_root/os_linux/hw_x86/exp/inc
# Create a script that removes NoderVersion and $Orphanage objects
tmpfile=$pwrp_tmp/del.sh
cat > $tmpfile <<-EOF
main()
string v;
string class;
string node;
string name;
verify(0);
v = GetVolumeList();
while( v != "")
class = GetVolumeClass( v);
if ( class != "\$ClassVolume")
set volume/volume='v'
node = GetNodeObject();
if ( node == "")
v = GetNextVolume( v);
continue;
endif
name = node + "-NodeVersion";
class = GetObjectClass( name);
if ( class != "")
delete object/name='name'/noconfirm
endif
name = node + "-\$Orphanage";
class = GetObjectClass( name);
if ( class != "")
delete object/name='name'/noconfirm
endif
name = "System-SystemVersion";
class = GetObjectClass( name);
if ( class != "")
delete object/name='name'/noconfirm
endif
name = "System-BootVersion";
class = GetObjectClass( name);
if ( class != "")
delete object/name='name'/noconfirm
endif
save
endif
v = GetNextVolume( v);
endwhile
endmain
EOF
chmod a+x $tmpfile
$v34_root/os_linux/hw_x86/exp/exe/wb_cmd @$tmpfile
# Create a script that dumps each volume
tmpfile=$pwrp_tmp/dump.sh
cat > $tmpfile <<-EOF
......@@ -69,7 +124,12 @@ reload_userclasses()
return
fi
reload_continue "Pass load userclasses"
echo ""
echo "The classvolume should be defined in one file only: userclasses.wb_load !"
echo ""
reload_continue "Pass create loadfiles for userclasses"
# Load userclasses
fname="$pwrp_db/userclasses.wb_load"
......@@ -80,6 +140,8 @@ reload_userclasses()
if wb_cmd create snapshot/file=\"$fname\"/out=\"$pwrp_load/$volume.dbs\"
then
reload_status=$reload__success
echo "-- Renaming userclasses.wb_load to $volume.wb_load"
mv $fname $pwrp_db/$volume.wb_load
else
reload_status=$reload__userclasses
return
......@@ -108,6 +170,7 @@ reload_dirvolume()
l1="Volume $volume \$DirectoryVolume"
l2="Volume Directory \$DirectoryVolume"
sed 's/ '$volume' / Directory /' $dmpfile > $pwrp_db/directory.wb_dmp
wb_cmd create volume/directory
wb_cmd wb load /load=\"$pwrp_db/directory.wb_dmp\"
mv $dmpfile $dmpfile"_old"
mv $pwrp_db/directory.wb_dmp $pwrp_db/directory.wb_dmp_old
......@@ -308,7 +371,17 @@ reload_compile()
reload_continue "Pass compile plcprograms"
wb_cmd compile /all
list=`eval ls -1d $pwrp_db/*.db`
for file in $list; do
file=${file##/*/}
file=${file%%.*}
if [ $file != "directory" ] && [ $file != "rt_eventlog" ]; then
wb_cmd -v $file compile /all
fi
done
# wb_cmd compile /all
reload_status=$reload__success
}
......@@ -342,7 +415,17 @@ reload_createload()
echo "-- Removing old loadfiles"
rm $pwrp_load/ld_vol*.dat
wb_cmd create load/all
list=`eval ls -1d $pwrp_db/*.db`
for file in $list; do
file=${file##/*/}
file=${file%%.*}
if [ $file != "directory" ] && [ $file != "rt_eventlog" ]; then
wb_cmd -v $file create load/volume=$file
fi
done
# wb_cmd create load/all
reload_status=$reload__success
}
......@@ -354,6 +437,10 @@ reload_createboot()
return
fi
echo ""
echo "Before this pass you should compile the modules included by ra_plc_user."
echo ""
reload_continue "Pass create bootfiles"
echo "-- Creating bootfiles for all nodes"
......@@ -369,14 +456,21 @@ reload_convertge()
return
fi
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! !"
echo "! Note ! This pass should not be executed when upgrading from V3.9 !!"
echo "! !"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
reload_continue "Pass convert ge graphs"
# Create a script that dumps each volume
tmpfile=$pwrp_tmp/convertv40.ge_com
cat > $tmpfile << EOF
function int process( string graph)
open 'graph'
printf( "Converting %s...\n", graph);
open 'graph'
convert v40
save
endfunction
......@@ -472,20 +566,14 @@ usage()
{
cat << EOF
upgrade.sh Upgrade from V3.3 to V3.4.
The upgrade procedure will be done in three steps:
- Create project on linux (Pass 1)
- Execute upgrade.com on V3.3
- Continue with pass copyfile
upgrade.sh Upgrade from V3.4 or V3.9 to V4.0.
Arguments Project name.
Pass
dumpdb Dump database to textfile \$pwrp_db/'volume'.wb_dmp
userclasses Load userclasses.wb_load
userclasses Create loadfiles and rename userclasses.wb_load
dirvolume Create directory volume.
cnvdirvolume Convert the directory volume.
cnvdump Convert dumpfiles.
......@@ -508,12 +596,12 @@ let reload_status=$reload__success
let check_status=0
let go=0
if [ -z "$1" ]; then
usage
exit
fi
#if [ -z "$1" ]; then
# usage
# exit
#fi
project=$1
project=${pwrp_root##/*/}
usage
......@@ -522,7 +610,7 @@ echo "-- Upgrade $project"
echo ""
export pwr_inc=$v34_root/os_linux/hw_x86/exp/inc
echo $pwr_inc
#echo $pwr_inc
databases=`eval source $v34_root/os_linux/hw_x86/exp/exe/pwrp_env.sh show db -a`
databases=$databases" dbdirectory"
export pwr_inc=$pwrb_root/os_linux/hw_x86/exp/inc
......@@ -546,9 +634,13 @@ for cpass in $passes; do
done
echo ""
echo "-- The reload is now accomplished."
echo "-- The upgrade procedure is now accomplished."
echo " Please remove the dumpfiles: \$pwrp_db/*.wb_dmp*"
echo " when you are satisfied with the reload."
echo " when you are satisfied with the upgrade."
echo ""
echo "-- Remaining tasks:"
echo " Build the applications"
echo " Create packages from the distributor"
echo ""
reload_exit
......
......@@ -25,7 +25,6 @@ public class Errh {
private static boolean initDone = false;
public Errh( String programName, int anix) {
if ( !initDone) {
init( programName, anix);
initDone = true;
......
......@@ -8,13 +8,20 @@
. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "rt_errh.h"
pwr_tStatus aproc_RegisterObject(pwr_tOid);
pwr_tStatus aproc_TimeStamp();
#if defined __cplusplus
}
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment