1 | VWHSH0 ;;GpZ; - ; IMPROVED HASHING UTILITY: MAIN INSTALL MODULE; 01/08/2010
|
---|
2 | V ;;8.0;KERNEL;;Jul 10, 1995
|
---|
3 | ;; VWHSH
|
---|
4 | CHECK ;;
|
---|
5 | N %S,%D,%ZR,HSH,HASH,HASHLIST,MUMPS,OS,PATH,SCR,ZTOS
|
---|
6 | DO
|
---|
7 | . IF $$EN^XUSHSH("TEST")="TEST" S HASH="NONE" QUIT
|
---|
8 | . S HASH=$P($G(^%ZOSF("HASHLIST")),"|") ; ID installed HASH from earlier version.
|
---|
9 | . S HASH=$S($$EN^XUSHSH("TEST")="TEST":"NONE",$L($G(HASH))>0:HASH,1:"LEGACY") ; query current XUSHSH
|
---|
10 | DO DEFHASH
|
---|
11 | IF HASHLIST'[" MD5 " S ABORT="gpg FAILURE; CHECK for gnupg dependency & its PATH" GOTO ABORT
|
---|
12 | S %S=$S(ZTOS=8:"VWHSHGTM",HASHLIST["Linux":"VWHSHCLX",1:"VWHSHCWN")
|
---|
13 | S %D="XUSHSH",U="^",SCR="I 1"
|
---|
14 | IF $T(^VWHSHLEG)="" S %S="XUSHSH^"_%S,%D="VWHSHLEG^"_%D
|
---|
15 | ; preserve old ^XUSHSH as ^VWHSHLEG
|
---|
16 | S U="^",SCR="I 1"
|
---|
17 | DO MOVE^ZTMGRSET
|
---|
18 | QUIT
|
---|
19 | ;
|
---|
20 | DEFHASH ;; Entry point for changing default hash.
|
---|
21 | IF '$L($G(HASH)) DO
|
---|
22 | . S HASH=$P($G(^%ZOSF("HASHLIST")),"|")
|
---|
23 | . QUIT:$L($G(HASH))
|
---|
24 | . S:$T(^VWHSHLEG)>"" HASH=$S($$EN^VWHSHLEG("TEST")="TEST":"NONE",1:"LEGACY")
|
---|
25 | . QUIT:$L($G(HASH))
|
---|
26 | . S HASH="LEGACY" ; hard-coded default hash is LEGACY
|
---|
27 | . QUIT
|
---|
28 | S HASH=$TR(HASH,"abcdefghijklmnopqrstuvwxyz- ","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
---|
29 | S MUMPS=^%ZOSF("OS"),ZTOS=$S(MUMPS["GT.M":8,MUMPS["OpenM":3)
|
---|
30 | ; SHOULD ERROR IF neither GTM nor Cache.
|
---|
31 | S HASHLIST=HASH_"||"_$$INIT^@("VWHSH"_ZTOS)()
|
---|
32 | S ^%ZOSF("HASHLIST")=HASHLIST
|
---|
33 | QUIT
|
---|
34 | ;
|
---|
35 | ABORT ;; Failed to find gpg hashes.
|
---|
36 | U 0 W !,ABORT,! W $G(^%ZOSF("HASHLIST")),!
|
---|