From 2e89e34523e569050082ce617c0f1653a0a2349a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Jun 2014 13:43:57 -0400 Subject: windows no-DOS-box and autostart, at last Using the crazy but apparently best approach of a VB Script that runs git-annex, in a hidden DOS window. Note that currently the git-annex messages are not directed to daemon.log. Would probably need another layer of script. Also problimatic since the repository may not exist yet. --- Build/NullSoftInstaller.hs | 37 ++++++++++++++++++++++++++++++++----- debian/changelog | 3 +++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Build/NullSoftInstaller.hs b/Build/NullSoftInstaller.hs index b3d323ce2..eaad0584d 100644 --- a/Build/NullSoftInstaller.hs +++ b/Build/NullSoftInstaller.hs @@ -42,8 +42,12 @@ main = do when (isNothing p) $ print ("unable to find in PATH", f) return p + let webappscript = tmpdir "git-annex-webapp.vbs" + webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git-annex webapp" + autostartscript <- vbsLauncher tmpdir "git-annex-autostart" "git annex assistant --autostart" writeFile nsifile $ makeInstaller gitannex license $ - catMaybes extrafiles + catMaybes extrafiles ++ + [ webappscript, autostartscript ] mustSucceed "makensis" [File nsifile] removeFile nsifile -- left behind if makensis fails where @@ -54,6 +58,17 @@ main = do True -> return () False -> error $ cmd ++ " failed" +{- Generates a .vbs launcher which runs a command without any visible DOS + - box. -} +vbsLauncher :: FilePath -> String -> String -> IO String +vbsLauncher tmpdir basename cmd = do + let f = tmpdir basename ++ ".vbs" + writeFile f $ unlines + [ "Set objshell=CreateObject(\"Wscript.Shell\")" + , "objShell.Run(\"" ++ cmd ++ "\"), 0, False" + ] + return f + gitannexprogram :: FilePath gitannexprogram = "git-annex.exe" @@ -72,6 +87,9 @@ gitInstallDir = fromString "$PROGRAMFILES\\Git\\bin" startMenuItem :: Exp FilePath startMenuItem = "$SMPROGRAMS/git-annex.lnk" +autoStartItem :: Exp FilePath +autoStartItem = "$SMSTARTUP/git-annex-autostart.lnk" + needGit :: Exp String needGit = strConcat [ fromString "You need git installed to use git-annex. Looking at " @@ -101,14 +119,22 @@ makeInstaller gitannex license extrafiles = nsis $ do -- Start menu shortcut Development.NSIS.createDirectory "$SMPROGRAMS" createShortcut startMenuItem - [ Target "$INSTDIR/git-annex.exe" - , Parameters "webapp" + [ Target "wscript.exe" + , Parameters "$INSTDIR/git-annex-webapp.vbs" + , StartOptions "SW_SHOWMINIMIZED" , IconFile "$INSTDIR/git-annex.exe" , IconIndex 2 - , StartOptions "SW_SHOWMINIMIZED" , KeyboardShortcut "ALT|CONTROL|a" , Description "git-annex webapp" ] + createShortcut autoStartItem + [ Target "wscript.exe" + , Parameters "$INSTDIR/git-annex-autostart.vbs" + , StartOptions "SW_SHOWMINIMIZED" + , IconFile "$INSTDIR/git-annex.exe" + , IconIndex 2 + , Description "git-annex autostart" + ] -- Groups of files to install section "main" [] $ do setOutPath "$INSTDIR" @@ -118,11 +144,12 @@ makeInstaller gitannex license extrafiles = nsis $ do writeUninstaller $ str uninstaller uninstall $ do delete [RebootOK] $ startMenuItem + delete [RebootOK] $ autoStartItem mapM_ (\f -> delete [RebootOK] $ fromString $ "$INSTDIR/" ++ f) $ [ gitannexprogram , licensefile , uninstaller - ] ++ cygwinPrograms ++ cygwinDlls + ] ++ cygwinPrograms ++ cygwinDlls ++ extrafiles where addfile f = file [] (str f) diff --git a/debian/changelog b/debian/changelog index 931694fc3..40d36bda1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ git-annex (5.20140614) UNRELEASED; urgency=medium * assistant: Fix one-way assistant->assistant sync in direct mode. + * Windows: Got rid of that pesky DOS box when starting the webapp. + * Windows: Added Startup menu item so assistant starts automatically + on login. -- Joey Hess Mon, 16 Jun 2014 11:28:42 -0400 -- cgit v1.2.3