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.
This commit is contained in:
parent
ba952aca3c
commit
883aa84209
2 changed files with 35 additions and 5 deletions
|
@ -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)
|
||||
|
||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -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 <joeyh@debian.org> Mon, 16 Jun 2014 11:28:42 -0400
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue