Difference between revisions of "Dropbox"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Created page with 'Dropbox for Windows is a client software for use with the popular Dropbox online storage service. For more information see the [http://www.dropbox.com/ Dropbox Homepage]. Instal…')
(No difference)

Revision as of 09:23, 14 January 2011

Dropbox for Windows is a client software for use with the popular Dropbox online storage service. For more information see the Dropbox Homepage.

Installing Dropbox software was meant to be "easy for end users" which apparently meant that it must be a challenge for administrators. Dropbox 1.0.10 uses an NSIS installer which supports /D[estination irectory] and /S[ilent] switches, but there seems to be no way to use them both in conjunction (see this discussion thread for details). As dropbox installs everything (including binaries!) into the current user's %APPDATA% unless told otherwise, we would need to use the /D switch and script the installation using the AutoIt3 scripting language.

Package file

This is the silent installer for GPL Ghostscript.

<package id="dropbox" name="Dropbox client 1.0.10" revision="1" reboot="false" priority="0">
 <check type="logical" condition="and">
  <check type="uninstall" condition="exists" path="Dropbox" />
  <check type="file" condition="versiongreaterorequal" path="%PROGRAMFILES%\dropbox\dropbox.exe" value="1.0.10.0"
 </check>
 <install cmd='"%SOFTWARE%\autoit\AutoIt3.exe" "%SOFTWARE%\dropbox\dropbox.au3"' />
 <remove cmd='"%PROGRAMFILES%\dropbox\uninstall.exe" /S' />
 <remove cmd='%WINDIR%\system32\cmd /c rd /S "%ALLUSERSPROFILE%\Start Menu\Programs\Dropbox"' />
</package>

Autoit script for "silent" dropbox install

Save this script as dropbox.au3 to the %SOFTWARE%\dropbox directory and modify the $DROPBOXINSTALLER variable to reflect your environment.

;Get environment variable
$SOFTWARE=EnvGet("SOFTWARE")
;Path and filename of the installer executable
$DROPBOXINSTALLER="""" & $SOFTWARE & "\dropbox\Dropbox 1.0.10.exe"""
;Path of the desired install destination
$DROPBOXINSTALLPATH=@ProgramFilesDir & "\Dropbox"

; Run Dropbox installer
Run($DROPBOXINSTALLER & " /D=" & $DROPBOXINSTALLPATH, "", @SW_SHOW)
If @error <> 0  Then 
	MsgBox(0, "Run failed", "The ""Run"" command failed for " & $DROPBOXINSTALLER & " /D=" & $DROPBOXINSTALLPATH & " - exiting", 5)
	Exit
EndIf
;Wait for the installer window to appear and activate it
WinWait("Dropbox Setup", "Click Install to start the installation")
WinActivate("Dropbox Setup", "Click Install to start the installation")
;Click the "Install" button
If ControlClick("Dropbox Setup", "Click Install to start the installation", "[CLASS:Button; INSTANCE:2]")=0 Then
	MsgBox(0, "Autoit Dropbox install script", "Something's wrong: The ControlClick used to start the installation returned failure - exiting", 5)
	Exit
EndIf

;Wait for the installation to complete and the Dropbox account entry dialog to appear, close the window
WinWait("Dropbox Setup", "I don't have a Dropbox account", 120)
WinActivate("Dropbox Setup", "I don't have a Dropbox account")
WinClose("Dropbox Setup", "I don't have a Dropbox account")
WinWait("Exit Dropbox", "Are you sure", 20)
If ControlClick("Exit Dropbox", "Are you sure", "[CLASS:Button; INSTANCE:1]")=0 Then
	MsgBox(0, "Autoit Dropbox install script", "Something's wrong: The ControlClick used to confirm the 'are you sure' dialog returned failure - proceeding with file copy", 5)
EndIf

;Copy the program group to %ALLUSERSPROFILE%
If DirCopy(@ProgramsDir & "\Dropbox", @ProgramsCommonDir & "\Dropbox", 1) = 0 Then
	MsgBox(0, "Autoit Dropbox install script", "Something's wrong: error copying the " & @StartMenuDir & "\Programme\Dropbox directory", 5)
EndIf

;If you want to copy the automatic startup entry to %ALLUSERSPROFILE% as well, uncomment these lines
;If FileCopy(@StartupDir & "\Dropbox.lnk", @StartupCommonDir & "\Dropbox.lnk") = 0 Then
;	MsgBox(0, "Autoit Dropbox install script", "Something's wrong: error copying the " & @StartupDir & "Dropbox.lnk file", 5)
;EndIf

;Installation complete
Exit