Jump to content

Recommended Posts

Posted

I am trying to build a Firefox install package and everytime i attempt to compile this i am told that there is an error adding the file. I have tried comenting out each of the files and it still gives me this message. This is the following message.

 

---------------------------
Aut2Exe Error
---------------------------
Error adding file:

C:AdminAppUpdFireFoxmozilla.cfg
---------------------------
OK   
---------------------------
 

Any thoughts on why this may be happening. I usually do not have isues addign the files and I don't think autoit should really have a problem if it is in the directory that the au3 script is in? Maybe I am incorrect though. Please take a look and let me know. Thank you.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_UseUpx=n
;#AutoIt3Wrapper_UseAnsi=y
;#AutoIt3Wrapper_Icon=..\_icons_\bag.ico  ;Assuming its in the projects folder
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#NoTrayIcon
#RequireAdmin

$SilentInstall = False
$installDir = "C:\Admin\AppUpd\FireFox"
$logFile = $installDir & "\" & @ScriptName & ".log"
$logFileSubApp = $installDir & "\" & @ScriptName & "_bundled_app.log"
$logEntries = 0
$appTitle = "Firefox version 25.0.1"
$ret = 0

;command options
;  <exe> /s
if $cmdLine[0] > 0 then
    for $a = 1 to $cmdLine[0]
        if StringLeft($cmdLine[$a],1) = "-" then
            $cmdLine[$a] = "/" & StringMid($cmdLine[$a],1)
        EndIf

        Switch $cmdLine[$a]
            Case "/s", "/q", "/silent", "/quiet"
                $SilentInstall = True

            Case "/noreinstall"
                $reinstall = false

        EndSwitch
    Next
EndIf

;stage the files
FileInstall("Firefox Setup 25.0.1.exe",$installDir & "\Firefox Setup 25.0.1.exe",1)
FileInstall("override.ini",$installDir & "\override.ini",1)
FileInstall("mozilla.cfg",$installDir & "\mozilla.cfg",1)
FileInstall("local-settings.js",$installDir & "\local-settings.js",1)


;start the log
DirCreate($installDir)
_Log("Log Started.  SilentInstall = " & $SilentInstall)
;_CheckIfAdmin()  ;not needed on most installs since the #requireadmin immediately prompts to run as admin
if not $SilentInstall then ProgressOn($appTitle,"Staging Files","Please Wait...",-1,-1,16)

;install the patch
ProgressSet(100, "Please wait...", "Installing Firefox browser")
RunWait('"' & $installDir &'\Firefox Setup 25.0.1.exe -ms"')
_Log("Install returned " & $ret & ", err=" & @error & ", ext=" & @extended)

;Check OS arch, because Firefox does not install in the same directory for both 32 and 64 bit

If @OSArch = "X86" and FileExists("C:\Program Files\Mozilla Firefox\firefox.exe") Then
ProgressSet(100, "Please wait...", "Installing customization files")
FileInstall("C:\Admin\AppUpd\FireFox\override.ini", "C:\Program Files\Mozilla Firefox\override.ini")
FileInstall("C:\Admin\AppUpd\FireFox\mozilla.cfg", "C:\Program Files\Mozilla Firefox\mozilla.cfg")
FileInstall("C:\Admin\AppUpd\FireFox\local-settings.js", "C:\Program Files\Mozilla Firefox\local-settings.js")
_Log("File install returned " & $ret & ", err=" & @error & ", ext=" & @extended)

ElseIf @OSArch = "X64" and FileExists("C:\Program Files(x86)\Mozilla Firefox\firefox.exe") Then
ProgressSet(100, "Please wait...", "Installing customization files")
FileInstall("C:\Admin\AppUpd\FireFox\override.ini", "C:\Program Files(x86)\Mozilla Firefox\override.ini")
FileInstall("C:\Admin\AppUpd\FireFox\mozilla.cfg", "C:\Program Files(x86)\Mozilla Firefox\mozilla.cfg")
FileInstall("C:\Admin\AppUpd\FireFox\local-settings.js", "C:\Program Files(x86)\Mozilla Firefox\local-settings.js")
_Log("File install returned " & $ret & ", err=" & @error & ", ext=" & @extended)

Else

;do nothing
Exit

EndIf

;prompt the user if not silent
ProgressOff()
If Not $SilentInstall Then _ShowUserPrompt($ret)

;exit
_Log("Exiting")
Exit $ret


;----------------------------------
; FUNCTIONS
;----------------------------------
Func _SendToCore($ReturnMessage)
    ;this will only work if its being sent through LANDesk
    If FileExists("C:\Program Files\LANDesk\LDClient\sdclient.exe") Then
        RunWait(@ComSpec & ' /c sdclient.exe /msg="' & $ReturnMessage & '."','C:\Program Files\LANDesk\LDClient',@SW_HIDE)
    EndIf
EndFunc

Func _Log($string)
    $datetime = @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & "." & @SEC & " - "

    if FileExists($logFile) AND $logEntries = 0 Then
        ;add a blank line if this is the first entry in the log
        RunWait(@ComSpec & " /c echo - >> " & $logFile,@WindowsDir,@SW_HIDE)
    EndIf

    ;add the pertinent log information
    RunWait(@ComSpec & " /c echo " & $datetime & $string & " >> " & $logFile,@WindowsDir,@SW_HIDE)

    ;increase the log entries
    $logEntries = $logEntries + 1
EndFunc

Func _CheckIfAdmin()
    if not IsAdmin() Then
        ;Log error (if there's write ability to the install dir then this will update)
        _Log("Admin rights were not detected.  Install will exit.")

        ;Display the error message if its not silent
        if not $SilentInstall Then
            MsgBox(16,"Error","You must have Administrator rights to run this.",300)
        EndIf

        exit 1625 ;This installation is forbidden by system policy. Contact your system administrator.
    EndIf
EndFunc

Func _ShowUserPrompt($returnCode)
    if $returnCode = 3010 then ;reboot needed
        $mret = MsgBox(64 + 4,$appTitle,"A reboot is required to complete this install." & @crlf & @crlf & "Would you like to reboot now?",300)
        if $mret = 6 Then  ;Yes was clicked
            Shutdown(9,$appTitle & " installation")
            exit $returnCode
        EndIf

    ElseIf $returnCode = 0 Then ;successful install
        MsgBox(64,$appTitle,"Installation completed successfully.",300)

    Else
        MsgBox(16,$appTitle,"There was a problem running this install.  The return code was " & $returnCode & _
            @crlf & @crlf & "Refer to the following log(s) for more details:" & @crlf & "    " & $logFile & @crlf & "    " & $logFileSubApp,300)
        EndIf
EndFunc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...