BJMDECKF ;VNGT/HS/AM-Pre Install ENVIRONMENT CHECK for BFMC; 18 Nov 2009 12:51 PM
;;1.0;CDA/C32;**1**;May 27, 2011
;
; Run pre-install checks
;W !,"Build Name XPDNM = ",XPDNM
N EXEC,ROLES,FAC,STAT,NS,OBJ,C32DEST,DEFDEST,EDEST,DIR,METMS,METCS
N METFS,METDFS,LIST,MET,TSC,DEFEDEST,OK,FS,ES,VERSION
;
; Verify Version
;
S VERSION=$$VERSION^%ZOSV
I VERSION<2009!($E(VERSION,1,4)>2010)!(VERSION?1"2010.1.".E) D
. W !,"Ensemble 2009.1 or 2010.2 is required!"
. S XPDQUIT=2
;
; Verify that installer has proper roles
;
S EXEC="S ROLES=$roles" X EXEC
S ROLES=","_ROLES_",",U="^"
I ROLES'[",%All," D
. W !,"Your Ensemble account MUST have ""%All"" role to proceed!" S XPDQUIT=2
S EXEC="S OK=($SYSTEM.SYS.MaxLocalLength()>3600000)"
X EXEC
I 'OK D S XPDQUIT=2
. W !,"Long Strings must be enabled in the System Management Portal!"
K LIST
S EXEC="S NS=$SYSTEM.SYS.NameSpace()" X EXEC
S EXEC="SET OBJ=##class(%ResultSet).%New(""%SYS.Namespace:List"") d OBJ.Execute()" X EXEC
S EXEC="while (OBJ.Next()) { s LIST(OBJ.Data(""Nsp""))=1 }" X EXEC
;
; Check that Ensemble globals are mapped to the default namespace of ENSLIB
;
S EXEC="S DEFEDEST=##class(%SYS.Namespace).GetGlobalDest(""ENSLIB"")" X EXEC
S EXEC="S EDEST=##class(%SYS.Namespace).GetGlobalDest(NS,""^EnsDICOM.Dictionary"")" X EXEC
I EDEST'=DEFEDEST W !,"Ensemble is not properly mapped in ",NS S XPDQUIT=2
;
; check if enough space (only for the BFMC load and only if classes are not there already)
;
S EXEC="S TSC=$SYSTEM.OBJ.GetPackageList(.BFMC,""BFMC"")" X EXEC
I $O(BFMC(""))'="" G Q
S EXEC="S NS=$SYSTEM.SYS.NameSpace()" X EXEC
S EXEC="S DIR=##class(%SYS.Namespace).GetGlobalDest(NS),DIR=$P(DIR,""^"",2,99)" X EXEC
S EXEC="Set MET=##class(%Monitor.System.Freespace).%New()" X EXEC
S EXEC="S TSC=MET.Initialize()" X EXEC
I $G(TSC)'=1 W !,"Space check monitor failed to initialize" S XPDQUIT=2 G Q
;
S METMS=0,METCS=0,METFS=0,METDFS=0,METDS=0
S EXEC="F S TSC=MET.GetSample() Q:'TSC S:MET.DBName=""CACHESYS"" METDFS=MET.DiskFreeSpace I MET.Directory=DIR S:METCS=0 METMS=MET.MaxSize,METCS=MET.CurSize,METFS=MET.FreeSpace,METDS=MET.DiskFreeSpace" X EXEC
I METCS=0 W !,"Space check monitor failed to find Cache Namespace with directory ",DIR S XPDQUIT=2
I METDFS<2000 W !,"Disk space for CACHESYS is too low (",METDFS,"MB available, 2GB needed)" S XPDQUIT=2 G Q
S OK=0
;
; if unlimited cache.dat, then limit is FreeDiskSpace + FreeSpaceInCurrent_cache.dat
I METMS=-1 S FS=METDS+METFS I FS>5000 S OK=1
; if limited cache.dat, then ExpansionSpace is smaller of FreeDiskSpace and (MaxSpace-CurrentSpace)
; then limit is Expansion Space+FreeSpaceInCurrentFile
I METMS'=-1 S ES=METMS-METCS S:METDS<ES ES=METDS S FS=ES+METFS I FS>5000 S OK=1
; if not enough space and BFMC package is not loaded, then abort lest FILEFULL error occurs
I 'OK W !,"Available space is ",FS,"MB, less than required 5 GB" S XPDQUIT=2
Q ;
I $G(MET)'="" S EXEC="S TSC=MET.Shutdown()" X EXEC
K BFMC
Q
DTCK(DT) ;
S %DT="FT",X=DT
D ^%DT
I Y=-1 Q 0
S ZTDTH=Y
Q 1
BJMDECKF ;VNGT/HS/AM-Pre Install ENVIRONMENT CHECK for BFMC; 18 Nov 2009 12:51 PM
+1 ;;1.0;CDA/C32;**1**;May 27, 2011
+2 ;
+3 ; Run pre-install checks
+4 ;W !,"Build Name XPDNM = ",XPDNM
+5 NEW EXEC,ROLES,FAC,STAT,NS,OBJ,C32DEST,DEFDEST,EDEST,DIR,METMS,METCS
+6 NEW METFS,METDFS,LIST,MET,TSC,DEFEDEST,OK,FS,ES,VERSION
+7 ;
+8 ; Verify Version
+9 ;
+10 SET VERSION=$$VERSION^%ZOSV
+11 IF VERSION<2009!($EXTRACT(VERSION,1,4)>2010)!(VERSION?1"2010.1.".E)
Begin DoDot:1
+12 WRITE !,"Ensemble 2009.1 or 2010.2 is required!"
+13 SET XPDQUIT=2
End DoDot:1
+14 ;
+15 ; Verify that installer has proper roles
+16 ;
+17 SET EXEC="S ROLES=$roles"
XECUTE EXEC
+18 SET ROLES=","_ROLES_","
SET U="^"
+19 IF ROLES'[",%All,"
Begin DoDot:1
+20 WRITE !,"Your Ensemble account MUST have ""%All"" role to proceed!"
SET XPDQUIT=2
End DoDot:1
+21 SET EXEC="S OK=($SYSTEM.SYS.MaxLocalLength()>3600000)"
+22 XECUTE EXEC
+23 IF 'OK
Begin DoDot:1
+24 WRITE !,"Long Strings must be enabled in the System Management Portal!"
End DoDot:1
SET XPDQUIT=2
+25 KILL LIST
+26 SET EXEC="S NS=$SYSTEM.SYS.NameSpace()"
XECUTE EXEC
+27 SET EXEC="SET OBJ=##class(%ResultSet).%New(""%SYS.Namespace:List"") d OBJ.Execute()"
XECUTE EXEC
+28 SET EXEC="while (OBJ.Next()) { s LIST(OBJ.Data(""Nsp""))=1 }"
XECUTE EXEC
+29 ;
+30 ; Check that Ensemble globals are mapped to the default namespace of ENSLIB
+31 ;
+32 SET EXEC="S DEFEDEST=##class(%SYS.Namespace).GetGlobalDest(""ENSLIB"")"
XECUTE EXEC
+33 SET EXEC="S EDEST=##class(%SYS.Namespace).GetGlobalDest(NS,""^EnsDICOM.Dictionary"")"
XECUTE EXEC
+34 IF EDEST'=DEFEDEST
WRITE !,"Ensemble is not properly mapped in ",NS
SET XPDQUIT=2
+35 ;
+36 ; check if enough space (only for the BFMC load and only if classes are not there already)
+37 ;
+38 SET EXEC="S TSC=$SYSTEM.OBJ.GetPackageList(.BFMC,""BFMC"")"
XECUTE EXEC
+39 IF $ORDER(BFMC(""))'=""
GOTO Q
+40 SET EXEC="S NS=$SYSTEM.SYS.NameSpace()"
XECUTE EXEC
+41 SET EXEC="S DIR=##class(%SYS.Namespace).GetGlobalDest(NS),DIR=$P(DIR,""^"",2,99)"
XECUTE EXEC
+42 SET EXEC="Set MET=##class(%Monitor.System.Freespace).%New()"
XECUTE EXEC
+43 SET EXEC="S TSC=MET.Initialize()"
XECUTE EXEC
+44 IF $GET(TSC)'=1
WRITE !,"Space check monitor failed to initialize"
SET XPDQUIT=2
GOTO Q
+45 ;
+46 SET METMS=0
SET METCS=0
SET METFS=0
SET METDFS=0
SET METDS=0
+47 SET EXEC="F S TSC=MET.GetSample() Q:'TSC S:MET.DBName=""CACHESYS"" METDFS=MET.DiskFreeSpace I MET.Directory=DIR S:METCS=0 METMS=MET.MaxSize,METCS=MET.CurSize,METFS=MET.FreeSpace,METDS=MET.DiskFreeSpace"
XECUTE EXEC
+48 IF METCS=0
WRITE !,"Space check monitor failed to find Cache Namespace with directory ",DIR
SET XPDQUIT=2
+49 IF METDFS<2000
WRITE !,"Disk space for CACHESYS is too low (",METDFS,"MB available, 2GB needed)"
SET XPDQUIT=2
GOTO Q
+50 SET OK=0
+51 ;
+52 ; if unlimited cache.dat, then limit is FreeDiskSpace + FreeSpaceInCurrent_cache.dat
+53 IF METMS=-1
SET FS=METDS+METFS
IF FS>5000
SET OK=1
+54 ; if limited cache.dat, then ExpansionSpace is smaller of FreeDiskSpace and (MaxSpace-CurrentSpace)
+55 ; then limit is Expansion Space+FreeSpaceInCurrentFile
+56 IF METMS'=-1
SET ES=METMS-METCS
IF METDS<ES
SET ES=METDS
SET FS=ES+METFS
IF FS>5000
SET OK=1
+57 ; if not enough space and BFMC package is not loaded, then abort lest FILEFULL error occurs
+58 IF 'OK
WRITE !,"Available space is ",FS,"MB, less than required 5 GB"
SET XPDQUIT=2
Q ;
+1 IF $GET(MET)'=""
SET EXEC="S TSC=MET.Shutdown()"
XECUTE EXEC
+2 KILL BFMC
+3 QUIT
DTCK(DT) ;
+1 SET %DT="FT"
SET X=DT
+2 DO ^%DT
+3 IF Y=-1
QUIT 0
+4 SET ZTDTH=Y
+5 QUIT 1