Commit 1fc99797 authored by claes's avatar claes

*** empty log message ***

parent b8c1bdd9
...@@ -25,7 +25,6 @@ public class Errh { ...@@ -25,7 +25,6 @@ public class Errh {
private static boolean initDone = false; private static boolean initDone = false;
public Errh( String programName, int anix) { public Errh( String programName, int anix) {
if ( !initDone) { if ( !initDone) {
init( programName, anix); init( programName, anix);
initDone = true; initDone = true;
......
...@@ -13,29 +13,37 @@ let reload__loaddb=4 ...@@ -13,29 +13,37 @@ let reload__loaddb=4
let pass__continue=1 let pass__continue=1
let pass__execute=2 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 if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success reload_status=$reload__success
return return
fi fi
reload_continue "Pass create structfiles" reload_continue "Pass create structfiles and loadfiles for classvolumes"
fname="$pwrp_db/userclasses.wb_load" list=`eval ls -1d $pwrp_db/*.wb_load`
if [ -e $fname ]; then for file in $list; do
echo "-- Creating structfile for $fname" volume=`eval grep pwr_eClass_ClassVolume $file | awk '{ print $2 }'`
co_convert -sv -d $pwrp_inc $fname 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 fi
for cdb in $databases; do if wb_cmd create snapshot/file=\"$file\"/out=\"$pwrp_load/$volumelow.dbs\"
if [ $cdb != "dbdirectory" ]; then then
fname="$pwrp_db/$cdb/userclasses.wb_load" reload_status=$reload__success
if [ -e $fname ]; then else
echo "-- Creating structfile for $fname" reload_status=$reload__userclasses
co_convert -sv -d $pwrp_inc $fname return
fi fi
fi fi
done done
...@@ -51,145 +59,52 @@ reload_dumpdb() ...@@ -51,145 +59,52 @@ reload_dumpdb()
reload_continue "Pass dump database" reload_continue "Pass dump database"
for cdb in $databases; do # Rename old dumpfiles
echo "Dumping database $cdb" dmpfiles=`eval ls -1 $pwrp_db/*.wb_dmp`
for dmpfile in $dmpfiles; do
source pwrp_env.sh setdb $cdb reload_save_file $dmpfile
done
if [ $cdb != "dbdirectory" ]; then for cdb in $databases; do
#Store versions of classvolumes
wb_cmd @$pwr_exe/reload_vol_versions $cdb
fi
dump_file=$pwrp_db/$cdb.wb_dmp 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 done
} }
reload_templatedb() reload_renamedb()
{ {
reload_checkpass "templatedb" $start_pass reload_checkpass "renamedb" $start_pass
if [ $pass_status -ne $pass__execute ]; then if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success reload_status=$reload__success
return return
fi fi
reload_continue "Pass copy template database" reload_continue "Pass copy rename old database"
for cdb in $databases; do for cdb in $databases; do
echo "-- Copy template database to $cdb" reload_save_file $pwrp_db/$cdb.db
source pwrp_env.sh copy template $cdb noconfirm
done done
} }
reload_userclasses() reload_dirvolume()
{ {
reload_checkpass "userclasses" $start_pass if [ -e "$pwrp_db/directory.db" ]; then
if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success
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 return
fi fi
fi
fi
fi
done
}
reload_settemplate() reload_checkpass "dirvolume" $start_pass
{
reload_checkpass "settemplate" $start_pass
if [ $pass_status -ne $pass__execute ]; then if [ $pass_status -ne $pass__execute ]; then
reload_status=$reload__success reload_status=$reload__success
return return
fi fi
reload_continue "Pass set template values" reload_continue "Pass dirvolume"
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" wb_cmd create volume/directory
if wb_cmd @$fname wb_cmd wb load /load=\"$pwrp_db/directory.wb_dmp\"
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_loaddb() reload_loaddb()
...@@ -202,27 +117,34 @@ reload_loaddb() ...@@ -202,27 +117,34 @@ reload_loaddb()
reload_continue "Pass load database" reload_continue "Pass load database"
for cdb in $databases; do if [ -z "$1" ]; then
echo "-- Loading database $cdb" tmp=`eval ls -1 $pwrp_db/*.wb_dmp`
databases=""
source pwrp_env.sh setdb $cdb for db in $tmp; do
db=${db##/*/}
if [ $cdb != "dbdirectory" ]; then db="${db%.*}"
#Restore versions of classvolumes if [ "$db" != "directory" ]; then
if [ -e $pwrp_db/reload_vol_versions_$cdb.pwr_com ]; then databases="$databases $db"
wb_cmd @$pwrp_db/reload_vol_versions_$cdb
fi fi
done
else
databases=$@
fi fi
for cdb in $databases; do
if [ $cdb != "directory" ]; then
echo "-- Loading volume $cdb"
dump_file=$pwrp_db/$cdb.wb_dmp dump_file=$pwrp_db/$cdb.wb_dmp
list_file=$pwrp_db/$cdb.lis list_file=$pwrp_db/$cdb.lis
if wb_cmd wb load/load=\"$dump_file\"/out=\"$list_file\"/ignore if wb_cmd wb load/load=\"$dump_file\"/out=\"$list_file\"
then then
reload_status=$reload__success reload_status=$reload__success
else else
cat $list_file cat $list_file
reload_status=$reload__loaddb reload_status=$reload__loaddb
fi fi
fi
done done
} }
...@@ -383,14 +305,10 @@ usage() ...@@ -383,14 +305,10 @@ usage()
Pass Pass
createstruct Create structfiles classvolumes Create structfiles and loadfiles for classvolumes
dumpdb Dump database to textfile \$pwrp_load/'dbid'.wb_dmp dumpdb Dump database to textfile \$pwrp_db/'volume'.wb_dmp
templatedb Replace the database with a template database renamedb Rename the old database database
userclasses Load userclasses.wb_load (and usertypes.wb_load) dirvolume Load directory volume
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
loaddb Load the dump into the new database loaddb Load the dump into the new database
compile Compile all plcprograms in the database compile Compile all plcprograms in the database
removeload Remove old loadfiles. removeload Remove old loadfiles.
...@@ -400,7 +318,7 @@ usage() ...@@ -400,7 +318,7 @@ usage()
EOF EOF
} }
if [ $1 = "help" ] || [ $1 = "-h" ]; then if [ "$1" = "help" ] || [ "$1" = "-h" ]; then
usage usage
exit exit
fi fi
...@@ -411,8 +329,15 @@ let check_status=0 ...@@ -411,8 +329,15 @@ let check_status=0
let go=0 let go=0
if [ -z "$1" ]; then if [ -z "$1" ]; then
databases=`eval source pwrp_env.sh show db -a` tmp=`eval ls -1d $pwrp_db/*.db`
databases=$databases" dbdirectory" databases=""
for db in $tmp; do
db=${db##/*/}
db="${db%.*}"
if [ "$db" != "rt_eventlog" ]; then
databases="$databases $db"
fi
done
else else
databases=$@ databases=$@
fi fi
...@@ -420,17 +345,17 @@ fi ...@@ -420,17 +345,17 @@ fi
usage usage
echo "" echo ""
echo "-- Reloading database $databases" echo "-- Reloading volume $databases"
echo "" 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 "Pass: $passes"
echo "" echo ""
echo -n "Enter start pass [createstruct] > " echo -n "Enter start pass [dumpdb] > "
read start_pass read start_pass
if [ -z $start_pass ]; then if [ -z $start_pass ]; then
start_pass="createstruct" start_pass="dumpdb"
fi fi
for cpass in $passes; do for cpass in $passes; do
......
...@@ -35,6 +35,61 @@ reload_dumpdb() ...@@ -35,6 +35,61 @@ reload_dumpdb()
source $v34_root/os_linux/hw_x86/exp/exe/pwrp_env.sh setdb $cdb 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 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 # Create a script that dumps each volume
tmpfile=$pwrp_tmp/dump.sh tmpfile=$pwrp_tmp/dump.sh
cat > $tmpfile <<-EOF cat > $tmpfile <<-EOF
...@@ -69,7 +124,12 @@ reload_userclasses() ...@@ -69,7 +124,12 @@ reload_userclasses()
return return
fi 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 # Load userclasses
fname="$pwrp_db/userclasses.wb_load" fname="$pwrp_db/userclasses.wb_load"
...@@ -80,6 +140,8 @@ reload_userclasses() ...@@ -80,6 +140,8 @@ reload_userclasses()
if wb_cmd create snapshot/file=\"$fname\"/out=\"$pwrp_load/$volume.dbs\" if wb_cmd create snapshot/file=\"$fname\"/out=\"$pwrp_load/$volume.dbs\"
then then
reload_status=$reload__success reload_status=$reload__success
echo "-- Renaming userclasses.wb_load to $volume.wb_load"
mv $fname $pwrp_db/$volume.wb_load
else else
reload_status=$reload__userclasses reload_status=$reload__userclasses
return return
...@@ -108,6 +170,7 @@ reload_dirvolume() ...@@ -108,6 +170,7 @@ reload_dirvolume()
l1="Volume $volume \$DirectoryVolume" l1="Volume $volume \$DirectoryVolume"
l2="Volume Directory \$DirectoryVolume" l2="Volume Directory \$DirectoryVolume"
sed 's/ '$volume' / Directory /' $dmpfile > $pwrp_db/directory.wb_dmp 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\" wb_cmd wb load /load=\"$pwrp_db/directory.wb_dmp\"
mv $dmpfile $dmpfile"_old" mv $dmpfile $dmpfile"_old"
mv $pwrp_db/directory.wb_dmp $pwrp_db/directory.wb_dmp_old mv $pwrp_db/directory.wb_dmp $pwrp_db/directory.wb_dmp_old
...@@ -308,7 +371,17 @@ reload_compile() ...@@ -308,7 +371,17 @@ reload_compile()
reload_continue "Pass compile plcprograms" 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 reload_status=$reload__success
} }
...@@ -342,7 +415,17 @@ reload_createload() ...@@ -342,7 +415,17 @@ reload_createload()
echo "-- Removing old loadfiles" echo "-- Removing old loadfiles"
rm $pwrp_load/ld_vol*.dat 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 reload_status=$reload__success
} }
...@@ -354,6 +437,10 @@ reload_createboot() ...@@ -354,6 +437,10 @@ reload_createboot()
return return
fi fi
echo ""
echo "Before this pass you should compile the modules included by ra_plc_user."
echo ""
reload_continue "Pass create bootfiles" reload_continue "Pass create bootfiles"
echo "-- Creating bootfiles for all nodes" echo "-- Creating bootfiles for all nodes"
...@@ -369,14 +456,21 @@ reload_convertge() ...@@ -369,14 +456,21 @@ reload_convertge()
return return
fi 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" reload_continue "Pass convert ge graphs"
# Create a script that dumps each volume # Create a script that dumps each volume
tmpfile=$pwrp_tmp/convertv40.ge_com tmpfile=$pwrp_tmp/convertv40.ge_com
cat > $tmpfile << EOF cat > $tmpfile << EOF
function int process( string graph) function int process( string graph)
open 'graph'
printf( "Converting %s...\n", graph); printf( "Converting %s...\n", graph);
open 'graph'
convert v40 convert v40
save save
endfunction endfunction
...@@ -472,20 +566,14 @@ usage() ...@@ -472,20 +566,14 @@ usage()
{ {
cat << EOF cat << EOF
upgrade.sh Upgrade from V3.3 to V3.4. upgrade.sh Upgrade from V3.4 or V3.9 to V4.0.
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
Arguments Project name. Arguments Project name.
Pass Pass
dumpdb Dump database to textfile \$pwrp_db/'volume'.wb_dmp 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. dirvolume Create directory volume.
cnvdirvolume Convert the directory volume. cnvdirvolume Convert the directory volume.
cnvdump Convert dumpfiles. cnvdump Convert dumpfiles.
...@@ -508,12 +596,12 @@ let reload_status=$reload__success ...@@ -508,12 +596,12 @@ let reload_status=$reload__success
let check_status=0 let check_status=0
let go=0 let go=0
if [ -z "$1" ]; then #if [ -z "$1" ]; then
usage # usage
exit # exit
fi #fi
project=$1 project=${pwrp_root##/*/}
usage usage
...@@ -522,7 +610,7 @@ echo "-- Upgrade $project" ...@@ -522,7 +610,7 @@ echo "-- Upgrade $project"
echo "" echo ""
export pwr_inc=$v34_root/os_linux/hw_x86/exp/inc 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=`eval source $v34_root/os_linux/hw_x86/exp/exe/pwrp_env.sh show db -a`
databases=$databases" dbdirectory" databases=$databases" dbdirectory"
export pwr_inc=$pwrb_root/os_linux/hw_x86/exp/inc export pwr_inc=$pwrb_root/os_linux/hw_x86/exp/inc
...@@ -546,9 +634,13 @@ for cpass in $passes; do ...@@ -546,9 +634,13 @@ for cpass in $passes; do
done done
echo "" echo ""
echo "-- The reload is now accomplished." echo "-- The upgrade procedure is now accomplished."
echo " Please remove the dumpfiles: \$pwrp_db/*.wb_dmp*" 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 "" echo ""
reload_exit reload_exit
......
...@@ -25,7 +25,6 @@ public class Errh { ...@@ -25,7 +25,6 @@ public class Errh {
private static boolean initDone = false; private static boolean initDone = false;
public Errh( String programName, int anix) { public Errh( String programName, int anix) {
if ( !initDone) { if ( !initDone) {
init( programName, anix); init( programName, anix);
initDone = true; initDone = true;
......
...@@ -8,13 +8,20 @@ ...@@ -8,13 +8,20 @@
. */ . */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h" #include "pwr.h"
#include "rt_errh.h" #include "rt_errh.h"
pwr_tStatus aproc_RegisterObject(pwr_tOid); pwr_tStatus aproc_RegisterObject(pwr_tOid);
pwr_tStatus aproc_TimeStamp(); pwr_tStatus aproc_TimeStamp();
#if defined __cplusplus
}
#endif
#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