summaryrefslogtreecommitdiff
path: root/Build/NullSoftInstaller.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-17 13:43:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-17 13:57:00 -0400
commit2e89e34523e569050082ce617c0f1653a0a2349a (patch)
treea41319e038765ceb84c53f9acfb40af0458c92e2 /Build/NullSoftInstaller.hs
parent4189bf64de8fa96f34a3a82a108712e3848b3477 (diff)
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.
Diffstat (limited to 'Build/NullSoftInstaller.hs')
-rw-r--r--Build/NullSoftInstaller.hs37
1 files changed, 32 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)