Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSIS - Silent Autoupdate Application

I have an NSIS install kit for my .net c# application.

Is there a way to silently autoupdate my application, considering that I already downloaded the new update (new NSIS app version) to local computer ?

Thanks! :)

like image 608
Adrian Pirvulescu Avatar asked Sep 01 '09 09:09

Adrian Pirvulescu


1 Answers

(In case you need to detect the command line /Autoupdate=yes)

!include FileFunc.nsh
!insertmacro GetParameters
!insertmacro GetOptions

Var CMD_ARGS
Var CMD_RES
Function .onInit
    #
    #installer stuff.
    #
    StrCpy $CMD_ARGS ""
    StrCpy $CMD_RES "no"
    ${GetParameters} $CMD_ARGS
    ClearErrors
    ${GetOptions} $CMD_ARGS /Autoupdate= $CMD_RES
    StrCmp $CMD_RES "yes" is_update is_not_update
    is_update:
        #Execute all your update code(run your update app, etc)
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS UPDATE"
        goto end_auto_update_check
    is_not_update:
        #Execute all your non-update code.
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS NOT UPDATE"
    end_auto_update_check:
FunctionEnd
like image 171
bithavoc Avatar answered Nov 07 '22 19:11

bithavoc