Section "AFS Client" secClient
SetShellVarContext all
+
+ ; Check for bad previous installation (if we are doing a new install)
+ Call IsAnyAFSInstalled
+ Pop $R0
+ StrCmp $R0 "0" +1 skipCheck
+ Call CheckPathForAFS
+ skipCheck:
+
; Stop any running services or we can't replace the files
; Stop the running processes
GetTempFileName $R0
nsExec::Exec '$R0 afscreds.exe'
Exec "afscreds.exe -z"
; in case we are upgrading an old version that does not support -z
- Sleep 2000
nsExec::Exec '$R0 afscreds.exe'
!IFDEF INSTALL_KFW
;nsExec::Exec '$R0 krbcc32s.exe'
CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" "-A -M -N -Q"
Push "$INSTDIR\Client\Program"
- Call AddToPath
+ Call AddToUniquePath
Push "$INSTDIR\Common"
- Call AddToPath
+ Call AddToUniquePath
!ifdef INSTALL_KFW
; Add kfw to path too
Push "$INSTDIR\kfw\bin"
- Call AddToPath
+ Call AddToUniquePath
!endif
; Create the AFS service
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "VerboseLogging" 10
+
+ ; Must also add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\HwOrder
+ ; and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
+ ; to also include the service name.
+ Call AddProvider
ReadINIStr $R0 $1 "Field 7" "State"
ReadINIStr $R1 $1 "Field 9" "State"
; Complicated way to do $R1 = ($R1 *2) + $R0
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" $R0
ReadINIStr $R0 $1 "Field 5" "State"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient" $R0
- WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" 1
+ ReadINIStr $R0 $1 "Field 11" "State"
+ WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" $R0
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "NetbiosName" "AFS"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "MountRoot" "/afs"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "RxMaxMTU" 1260
Section "AFS Server" secServer
SetShellVarContext all
+
+ ; Check for bad previous installation (if we are doing a new install)
+ Call IsAnyAFSInstalled
+ Pop $R0
+ StrCmp $R0 "0" +1 skipCheck
+ Call CheckPathForAFS
+skipCheck:
+
; Stop any running services or we can't replace the files
; Stop the running processes
GetTempFileName $R0
GetTempFileName $R0
File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
nsExec::Exec '$R0 afscreds.exe'
- nsExec::Exec "afscreds.exe -z"
+ Exec "afscreds.exe -z"
; in case we are upgrading an old version that does not support -z
Sleep 2000
nsExec::Exec '$R0 afscreds.exe'
nsExec::Exec '$R0 u TransarcAFSServer'
Delete $R0
+ Call un.RemoveProvider
+
Push "$INSTDIR\Client\Program"
Call un.RemoveFromPath
Push "$INSTDIR\Common"
ReadINIStr $R0 $0 "Field 2" "State"
StrCmp $R0 "1" done
+ReadINIStr $R0 $0 "Field 6" "State"
+StrCmp $R0 "1" CheckOther
+
ReadINIStr $R0 $0 "Field 3" "State"
StrCmp $R0 "1" UsePackaged
; If none of these, grab file from other location
-goto CheckOther
+goto UsePackaged
DoDownload:
ReadINIStr $R0 $0 "Field 5" "State"
CheckOther:
ReadINIStr $R0 $0 "Field 7" "State"
- StrCmp $R0 "1" +1 done
+ StrCmp $R0 "" done
CopyFiles $R0 "$WINDIR\afsdcell.ini"
done:
FunctionEnd
+Function AddProvider
+ Push $R0
+ Push $R1
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 DoOther
+ ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
+ StrCpy $R0 "$R1,TransarcAFSDaemon"
+ WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder" $R0
+DoOther:
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 End
+ ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
+ StrCpy $R0 "$R1,TransarcAFSDaemon"
+ WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder" $R0
+End:
+ Pop $R1
+ Pop $R0
+FunctionEnd
+
+Function un.RemoveProvider
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder"
+ Call un.RemoveFromProvider
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order"
+ Call un.RemoveFromProvider
+ Pop $R0
+FunctionEnd
+
+Function un.RemoveFromProvider
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ ReadRegStr $1 HKLM "$R0" "ProviderOrder"
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 "," +2 # if last char != ,
+ StrCpy $1 "$1," # append ,
+ Push $1
+ Push "$0,"
+ Call un.StrStr ; Find `$0,` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0,"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 "," 0 +2 # if last char == ,
+ StrCpy $3 $3 -1 # remove last char
+
+ WriteRegStr HKLM "$R0" "ProviderOrder" $3
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+Function CheckPathForAFS
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+ ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ StrCpy $1 "$1;"
+loop:
+ Push $1
+ Push ";"
+ Call StrStr
+ Pop $0
+ StrLen $2 $0
+ StrCpy $3 $1 -$2
+ IfFileExists "$3\afsd_service.exe" Error
+ StrCpy $1 $0 32768 1
+ StrLen $2 $1
+ IntCmp $2 0 Done Done loop
+ goto Done
+Error:
+ MessageBox MB_ICONSTOP|MB_OK|MB_TOPMOST "This installer is unable to upgrade the previous version of AFS. Please uninstall the current AFS version before continuing."
+ Abort "Unable to install OpenAFS"
+Done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+Function AddToUniquePath
+ Pop $R0
+ Push $R0
+ Push "$R0;"
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ Push "$R0;"
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 Done
+ Call AddToPath
+Done:
+FunctionEnd
;-------------------------------