Menu

#188 SetOverwrite newer + Silent

2.0 Beta Series
closed-fixed
General (291)
5
2003-11-25
2003-11-10
No

Hi,

when doing a silent installation, I want to set overwrite
method to "newer". But then, when the file exists _and_
is locked (a .tlb file e.g. - does not have a version
number to compare, onyl the date counts) I get a user
prompt to ignore/abort installation o fhtis file.
I use the SetOverwrite try first and if it fails, use the
Rename /REBOOTOK method to overwrite it afterwards,
but I want to check for the file dates before overwriting
a locked file.

My suggestion:
Include a /REBOOTOK flag to the File command. Thus, if
a file cannot be copied, but should (on/newer) it's tried
when rebooting.

Or is there any workoáround for this problem? Anyhow -
silent installations should _not_ give any message box.
Because I do remote installations on 100s of remote pc's
and if there's a message box the administrator gets in
trouble.

Thank you very much,
Gernot

Discussion

  • Amir Szekely

    Amir Szekely - 2003-11-10

    Logged In: YES
    user_id=584402

    File can't have /REBOOTOK because the installer might be
    there for the second extraction. You should therefore extract
    it as a temporary file and Rename /REBOOTOK it.

    See the UpgradeDLL implemention for an example. You should
    also probably use UpgradeDLL for this tlb upgrade (with
    NO_REGISTER defined, of course).

     
  • Amir Szekely

    Amir Szekely - 2003-11-10
    • assigned_to: nobody --> kichik
    • status: open --> closed-invalid
     
  • Nobody/Anonymous

    Logged In: NO

    ... but Rename /REBOOTOK does ignores "SetOverwrite
    newer", so does the UpgradeDll function for files that do not
    have a version resource included. Right?

     
  • Gernot Frisch

    Gernot Frisch - 2003-11-11
    • status: closed-invalid --> open-invalid
     
  • Amir Szekely

    Amir Szekely - 2003-11-11
    • status: open-invalid --> open
     
  • Amir Szekely

    Amir Szekely - 2003-11-11

    Logged In: YES
    user_id=584402

    Misread that, sorry.

    So your bug report is that the message box shows in silent
    installations. I need to think about that.

    As for the time comparsion problem, you will have to use
    GetFileTime and GetFileTimeLocal and compare manually. That
    is what 'SetOverwrite ifnewer' does anyway.

     
  • Gernot Frisch

    Gernot Frisch - 2003-11-11

    Logged In: YES
    user_id=905723

    No problem. I'll use the 2 functions you mentioned. Thank you
    very much.

     
  • Gernot Frisch

    Gernot Frisch - 2003-11-11

    Logged In: YES
    user_id=905723

    Do you find any error in the macro I created:

    ;--------------------------------
    ; Like 'file' but copy after reboot if not possible right now
    ; !insertmacro ForceFile "Stdole2.tlb" "$SYSDIR\Stdole2.tlb"
    ;--------------------------------
    !macro ForceFile FILE_ID OVERWRITE_METHOD LOCALFILE
    DESTFILE
    Push $R0
    Push $R1
    Push $R2
    Push $R3
    Push $R4
    SetOverwrite ${OVERWRITE_METHOD}
    ClearErrors
    StrCpy $R4 "${DESTFILE}"
    Call ":ffile_${FILE_ID}"
    IfErrors "" "fdone_${FILE_ID}"

    ;DESTFILE is in use. Copy it to a temp file and Rename it on
    reboot.
    GetTempFileName $R4
    Call ":ffile_${FILE_ID}"
    Rename /REBOOTOK $R4 "${DESTFILE}"
    Goto "fdone_${FILE_ID}"

    "ffile_${FILE_ID}:"

    StrCmp "on" "${OVERWRITE_METHOD}" "copy_${FILE_ID}" ""
    ClearErrors
    GetFileTimeLocal "${LOCALFILE}" $R0 $R1
    GetFileTime "${DESTFILE}" $R2 $R3

    StrCmp "off" "${OVERWRITE_METHOD}" "" "check_${FILE_ID}"
    IfErrors "fdone_${FILE_ID}"

    "check_${FILE_ID}:"
    IfErrors "copy_${FILE_ID}"
    IntCmpU $R0 $R2 "" "fdone_${FILE_ID}" "copy_${FILE_ID}"
    IntCmpU $R1
    $R3 "fdone_${FILE_ID}" "fdone_${FILE_ID}" "copy_${FILE_ID}
    "

    "copy_${FILE_ID}:"
    ClearErrors
    SetOverwrite try
    File /oname=$R4 "${LOCALFILE}"
    SetOverwrite ${OVERWRITE_METHOD}
    Return

    "fdone_${FILE_ID}:"
    ClearErrors
    Pop $R0
    Pop $R1
    Pop $R2
    Pop $R3
    Pop $R4
    !macroend

     
  • Amir Szekely

    Amir Szekely - 2003-11-11

    Logged In: YES
    user_id=584402

    It doesn't seem like overwrite mode off will work. If there was
    an error getting the file time it most probably means the file
    isn't there, which means you should "overwrite", not skip.
    Other than that, it seems. fine.

     
  • Joost Verburg

    Joost Verburg - 2003-11-11

    Logged In: YES
    user_id=604457

    Most Type Libaries (.TLB) include a version number.

     
  • Amir Szekely

    Amir Szekely - 2003-11-25
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2003-11-25

    Logged In: YES
    user_id=584402

    Fixed in latest CVS version, thanks.

    - Fixed bug #839214 - message box shown in silent mode if a
    file can't be opened for writing. Now it will skip the file if
    AllowSkipFiles is on and abort if it's not.
    - Added /SD parameter for MessageBox. Allows to set default
    for silent installers (MessageBox MB_OKCANCEL \"OK? Cancel?
    \" /SD IDOK IDOK doOK IDCANCEL doCancel)

     

Log in to post a comment.

MongoDB Logo MongoDB