Commit 1a1dcf10 authored by claes's avatar claes

Moved to module wb

parent 662f01ad
#!/bin/bash
#
# Proview $Id: wb_admin.sh,v 1.5 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
wb_adm_opendb_func ()
{
#
# Command is "opendb"
#
# Arguments 1: project
# 2: username
# 3: password
# 4: database
# 5: volume
local project=$1
local username=$2
local password=$3
local database=$4
local volume=$5
echo "args: $1 $2 $3 $4 $5"
source pwrp_env.sh set project $project
if [ "$database" != "dbdirectory" ]; then
source pwrp_env.sh setdb $database
fi
wb -q "$username" "$password" $volume &
}
wb_adm_create_func ()
{
local cmd
cmd="project"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "create project"
#
# Arguments 2: project name
# 3: base name
# 4: project root
# 5: project hierarchy
# 6-: description
pname=$2
bname=$3
proot=$4
source pwrp_env.sh create $@
if [ $pwrc_status -ne 0 ]; then
return $pwrc_status
fi
#source pwrp_env.sh set project $pname
#if [ $pwrc_status -ne 0 ]; then
# return $pwrc_status
#fi
#wb_cmd create volume/name=\"directory\"/ident=254.254.254.253/class=\$DirectoryVolume
fi
}
wb_adm_parse ()
{
local cmd
cmd="opendb"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_adm_opendb_func $1 $2 $3 $4 $5
return
fi
cmd="create"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_adm_create_func $@
return
fi
echo "Unknown command"
}
#set -o xtrace
wb_adm_parse $@
#set +o xtrace
#
# Proview $Id: wb_create_db.sh,v 1.2 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Create the database directory and copy en empty database to the
# directory.
#
db=$1
source pwrp_env.sh copy template $db noconfirm
if [ $? != 0 ]; then
return 1;
fi
#!/bin/bash
#
# Proview $Id: wb_distr_keepboot.sh,v 1.3 2006-01-11 14:18:38 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Keep the old versions of bootfiles
#
new_file=$1
if [ -e $new_file ]; then
let version=30
while [ $version -ge 1 ]
do
old_file=$new_file.$version
old_file_ren=$new_file.$((version+1))
if [ -e $old_file ]; then
mv $old_file $old_file_ren
fi
let version=$version-1
done
old_file=$new_file.1
echo "-- Saving file $new_file -> $old_file"
mv $new_file $old_file
fi
#! /bin/bash
#
# Proview $Id: wb_gcg.sh,v 1.5 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# wb_gcg.sh -- compile and link PLC code
#
# This compiles a file generated by wb_gcg
# and inserts it in the plc library
# It is called from the wb_gcg.c module.
#
let gcg__success=0
let gcg__compileerrors=1
let gcg__linkerrors=2
let gcg__archiveerror=3
let gcg__rsherror=4
#
# MyRsh returns the return status from the compile command, not from rsh
# It only works on remote unix systems, not VMS...
#
MyRsh()
{
hostname=
lflag=
nflag=
user=
case $1 in
-l)
;;
*)
hostname=$1
shift
esac
case $1 in
-l)
lflag=-l
user=$2
shift 2
esac
case $1 in
-n)
nflag=-n
shift
esac
case $hostname in
'')
hostname=$1
shift
esac
case $# in
0)
exec /usr/ucb/rlogin $lflag ${user+"$user"} "$hostname"
esac
AWK='
NR > 1 {
print prev;
prev = $0;
prev1 = $1;
prev2 = $2;
}
NR == 1 {
prev = $0;
prev1 = $1;
prev2 = $2;
}
END {
if (prev1 ~ /[0-9]*[0-9]0/)
exit(prev1 / 10);
if (prev1 == "0")
exit(prev2);
print prev;
exit(1);
}
'
exec 3>&1
if rsh "$hostname" $lflag ${user+"$user"} $nflag \
"(${*-:}); sh -c '"'echo "$0 $1" >&2'\'' $?0 "$status"' \
2>&1 >&3 3>&- | awk "$AWK" >&2 3>&-
then
gcg_status=0
else
gcg_status=1
fi
}
CompileProcess()
{
if $cc_cmd -o $pwrp_obj/${FileName}.o $pwrp_gc/${FileName}.gc
then
echo "-- Plc process compiled for $OsStr $say_debug $ObjectName"
gcg_status=$gcg__success
else
echo "** Plc process compiled with errors $OsStr $ObjectName"
gcg_status=$gcg__compileerrors
fi
if [ $Debug -eq 0 ]; then
rm $pwrp_gc/${FileName}.gc
fi
}
CompileProgram()
{
if $cc_cmd -o $pwrp_obj/plc_m${FileName}.o $pwrp_gc/plc_m${FileName}.gc
then
echo "-- Plc plcpgm compiled for $OsStr $say_debug $ObjectName"
gcg_status=$gcg__success
else
echo "** Plc plcpgm compiled with errors $OsStr $ObjectName"
gcg_status=$gcg__compileerrors
fi
if [ $Debug -eq 0 ]; then
rm $pwrp_gc/plc_m${FileName}.gc
fi
}
CompileWindow()
{
if $cc_cmd -o $pwrp_obj/plc_m${FileName}.o $pwrp_gc/plc_m${FileName}.gc
then
echo "-- Plc window compiled for $OsStr $say_debug $ObjectName"
gcg_status=$gcg__success
else
echo "** Plc window compiled with errors for $OsStr $ObjectName"
gcg_status=$gcg__compileerrors
fi
if [ $Debug -eq 0 ]; then
rm $pwrp_gc/plc_m${FileName}.gc
rm $pwrp_gc/plc_dec${FileName}.gc
rm $pwrp_gc/plc_r1r${FileName}.gc
rm $pwrp_gc/plc_r2r${FileName}.gc
rm $pwrp_gc/plc_ref${FileName}.gc
rm $pwrp_gc/plc_cod${FileName}.gc
fi
}
CompileRtNode()
{
#link option file exists and is not empty
if [ -s $pwrp_exe/$FileName.opt ]; then
ld_opt_tmp="`cat $pwrp_exe/$FileName.opt`"
ld_opt="`eval echo $ld_opt_tmp`"
else
ld_opt="`eval echo $pwr_obj/rt_io_user.o`"
fi
if g++ $link_debug -L/lib/thread -L$pwrp_lib -L$pwrp_cmn/x86_linux/lib -L$pwr_lib \
-o $pwrp_exe/$OutFile \
$pwr_obj/rt_plc_process.o \
$pwrp_obj/${FileName}.o \
$Libs \
$ld_opt \
$pwr_obj/pwr_msg_rt.o $pwr_obj/pwr_msg_co.o \
-lpwr_rt -lpwr_co -lrpcsvc -lpwr_msg_dummy -lpthread -lm -lrt
then
echo "-- Plc program linked for $OsStr $say_linkdebug node $FileName"
gcg_status=$gcg__success
else
echo "** Plc program link errors for $OsStr node $FileName"
gcg_status=$gcg__linkerrors
fi
if [ -n "$pwrp_exe_target" ]; then
cp $pwrp_exe/$OutFile $pwrp_exe_target
echo "-- Plc copied to $pwrp_exe_target"
fi
}
CompileLibrary()
{
echo "-- Building archive for volume: $VolumeId"
if ar -rc $pwrp_lib/$PlcLib `ls $pwrp_obj/plc_m${VolumeId}*.o`
then
echo "-- Archive built for volume: $VolumeId"
gcg_status=$gcg__success
else
echo "** Error builing archive for volume: $VolumeId"
gcg_status=$gcg__archiveerror
fi
}
OsMaskToOpSys ()
{
let BitM=$1
let Idx=0
let Val=1
while [ $Val -lt $BitM ]; do
let Val=$Val*2
let Idx=$Idx+1
done
let OpSys=Idx+1
}
#
#
#
# Main
#
#
#
# Arguments
#
let Debug="$1" # 1 if debug, 0 i nodebug
let FileType="$2" # the type of file: rtnode,
# plc or window module
FileName="$3" # the name of the file to be compiled,
VolumeId="$3" # VolumeId for objects to be inserted
let OsMask="$4" # pwr_mOpSys
OutFile="$5" # the name of the generated file
PlcLib="$5" # library for filetype Program and Windoow
Libs="$6" # link libraries
ObjectName="$6" # name of object
SystemName="$7" # name of system
ProjectRoot="$8" # project root
OsMaskToOpSys $OsMask # Convert Bitmask to index
#
# Local symbols
#
let OpSys__Low=0
let OpSys_VAX_ELN=1
let OpSys_VAX_VMS=2
let OpSys_AXP_VMS=3
let OpSys_PPC_LYNX=4
let OpSys_X86_LYNX=5
let OpSys_PPC_LINUX=6
let OpSys_X86_LINUX=7
let OpSys__High=8
vOpSys="vax_eln,vax_vms,axp_vms,ppc_lynx,x86_lynx,ppc_linux,x86_linux"
let FileType__Low=-1
let FileType_Process=0
let FileType_Program=1
let FileType_Window=2
let FileType_RtNode=3
let FileType_Library=4
let FileType__High=5
vFileType="Process,Program,Window,RtNode,Library"
local_setup="pwr_gcg_setup.sh"
if [ -e ${local_setup} ]; then
# echo "-- Local setup file used"
source ${local_setup} ${ProjectRoot} ${SystemName}
fi
if [ $Debug -eq 1 ]; then
cc_debug="-g"
link_debug="-g"
say_debug="with debug"
say_linkdebug="with debug"
else
cc_debug="-O3"
say_debug="optimized -O3"
say_linkdebug=""
fi
#
# Check OpSys
#
# How can we find out if this is a ppc or x86 host?
#
#
# Check FileType
#
if [ $FileType -le $FileType__Low ] || [ $FileType -ge $FileType__High ];
then
echo "Unknown file type: $FileType"
exit -1
fi
OsStr="`echo $vOpSys| cut -f $OpSys -d ,`"
let FileTypeIdx=$FileType+1
if [ $OpSys -eq $OpSys_PPC_LINUX ] || [ $OpSys -eq $OpSys_X86_LINUX ];
then
pwrp_gc="$pwrp_tmp"
# Suppress all warnings, -x
cc_cmd="gcc -c -x c -w $cc_debug -D_REENTRANT -DOS_LINUX -I$pwr_inc -I$pwrp_inc -I$pwrp_tmp -I$pwrp_cmn/common/inc"
FileTypeStr="`echo $vFileType| cut -f $FileTypeIdx -d ,`"
# Execute build command
Compile$FileTypeStr
exit $gcg_status
elif [ $OpSys -eq $OpSys_AXP_VMS ]; then
rsh $pwr_build_host_axp_vms @pwr_exe:wb_gcg \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$pwrp_root\"
exit $?
elif [ $OpSys -eq $OpSys_VAX_VMS ]; then
rsh $pwr_build_host_vax_vms @pwr_exe:wb_gcg \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$pwrp_root\"
exit $?
elif [ $OpSys -eq $OpSys_VAX_ELN ]; then
rsh $pwr_build_host_vax_eln @pwr_exe:wb_gcg \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$pwrp_root\"
exit $?
elif [ $OpSys -eq $OpSys_X86_LYNX ]; then
MyRsh $pwr_build_host_x86_lynx '$pwr_exe/wb_gcg.sh' \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" \"$7\" \"$pwrp_root\"
exit $gcg_status
else
echo "Unknown operating system: $OpSys"
exit -1
fi
#! /bin/bash
#
# Proview $Id: wb_gre_print.sh,v 1.2 2005-09-01 14:57:49 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
if [ -z "$pwr_foe_gre_print" ]; then
echo "Printer is not defined in env 'pwr_foe_gre_print'"
fi
echo "Printing $1"
$pwr_foe_gre_print $1
#
# Proview $Id: wb_open_db.sh,v 1.4 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Open a new terminal and start the navigator
# This procedure is started from the navigator 'Open db' method for
# DbConfig and DbTrace objects.
#
username=$1
password=$2
database=$3
title=$4
set -o xtrace
if [ -z $database ]; then
echo "Database is missing"
return
fi
echo "-- Opening volume '$database'"
wb -q $username $password $database
#!/bin/bash
#
# Proview $Id: wb_pvd_pl.sh,v 1.1 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelsund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
set -o xtrace
declare -ix pwrc_status=$pwrc__success
declare -i pwrc__success=0
declare -i pwrc__dbnotfound=1
declare -i pwrc__noproj=3
declare -i pwrc__rootexist=4
declare -i pwrc__notconfigured=5
declare -i pwrc__projlistfile=6
declare -i pwrc__projalrexist=7
declare -i pwrc__basealrexist=8
declare -i pwrc__nobase=9
declare -i pwrc__projlistfileacc=10
declare -i pwrc__syntax=11
declare -i pwrc__rootacc=12
declare -i pwrc__rootcreate=13
declare -i pwrc__rootdelete=14
declare -i pwrc__dbdelete=15
declare -i pwrc__baseexist=16
declare -i pwrc__move=17
declare -i pwrc__notmysqlsrv=18
declare -i pwrc__datadir=19
declare -i pwrc__nodb=20
declare -i pwrc__notemplatedb=21
declare -i pwrc__dbalrexist=22
declare -i pwrc__copy=23
declare -i pwrc__dbcreate=24
declare -i pwrc__projnotset=25
declare -i pwrc__projnameinv=26
declare -i pwrc__mysqldbcopy=27
declare -i pwrc__mysqldbrena=28
declare -i pwrc__mysql=29
declare -i pwrc__noroot=30
wb_pl_opendb_func ()
{
#
# Command is "opendb"
#
# Arguments 1: project
# 2: username
# 3: password
# 4: database
# 5: volume
local project=$1
local username=$2
local password=$3
local database=$4
local volume=$5
echo "args: $1 $2 $3 $4 $5"
source pwrp_env.sh set project $project
if [ "$database" != "dbdirectory" ]; then
source pwrp_env.sh setdb $database
fi
wb -q "$username" "$password" $volume &
}
wb_pl_check_func ()
{
cmd="move"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "check move"
#
# Arguments 2: source root
# 3: destination root
local srcroot=$2
local destroot=$3
local destdir=${destroot%/*}
if [ ! -e "$srcroot" ]; then
echo "Source root not found"
pwrc_status=$pwrc_noroot
fi
if [ -e "$destroot" ]; then
if [ ! -w "$destroot" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
else
if [ -e "$destroot/common" ]; then
echo "Error: destination root already exist"
pwrc_status=$pwrc__rootexist
return
fi
fi
else
if [ ! -e "$destdir" ]; then
echo "Can't create destination root"
pwrc_status=$pwrc__rootcreate
return
else
if [ ! -w "$destdir" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
fi
fi
fi
pwrc_status=$pwrc__success
return
fi
cmd="create"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "check move"
#
# Arguments 2: destination root
local destroot=$2
local destdir=${destroot%/*}
if [ -e "$destroot" ]; then
if [ ! -w "$destroot" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
else
if [ -e "$destroot/common" ]; then
echo "Error: destination root already exist"
pwrc_status=$pwrc__rootexist
return
fi
fi
else
if [ ! -e "$destdir" ]; then
echo "Can't create destination root"
pwrc_status=$pwrc__rootcreate
return
else
if [ ! -w "$destdir" ]; then
echo "No write access to project root"
pwrc_status=$pwrc__rootacc
return
fi
fi
fi
pwrc_status=$pwrc__success
return
fi
}
wb_pl_create_func ()
{
local cmd
cmd="project"
if [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
#
# Command is "create project"
#
# Arguments 2: project name
# 3: base name
# 4: project root
# 5: project hierarchy
# 6-: description
pname=$2
bname=$3
proot=$4
source pwrp_env.sh create $@
if [ $pwrc_status -ne 0 ]; then
return $pwrc_status
fi
#source pwrp_env.sh set project $pname
#if [ $pwrc_status -ne 0 ]; then
# return $pwrc_status
#fi
#wb_cmd create volume/name=\"directory\"/ident=254.254.254.253/class=\$DirectoryVolume
fi
}
wb_pl_parse ()
{
local cmd
cmd="opendb"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_opendb_func $1 $2 $3 $4 $5
return
fi
cmd="create"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_create_func $@
return
fi
cmd="check"
if [ -z $1 ] || [ $1 = $cmd ] || [ ${cmd#$1} != $cmd ]; then
shift
wb_pl_check_func $@
return $pwrc_status
fi
echo "Unknown command"
}
#set -o xtrace
wb_pl_parse $@
#set +o xtrace
#
# Proview $Id: wb_start.sh,v 1.4 2005-10-25 12:05:37 claes Exp $
# Copyright (C) 2005 SSAB Oxelösund AB.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the program, if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Start the navigator
#
username=$1
password=$2
volume=$3
wb $username $password $volume
#!/bin/bash
#
# Edit a base wb_load-file with classeditor
#
export pwr_exe=$pwr_eexe
export pwr_load=$pwr_eload
wb -c $1
\ No newline at end of file
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