From 254e6ec34f30c4d8b2911006b99d97ae58de4b46 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 10 Mar 2009 16:14:09 +0000 Subject: [PATCH] Windows work. git-svn-id: file:///svn/unbound/trunk@1516 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 1 + makedist.sh | 7 +++--- util/config_file.c | 10 ++++++++ winrc/setup.nsi | 63 ++++++++++++++++++++++++++++++++++------------ 4 files changed, 62 insertions(+), 19 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 12fc73aa0..836febb16 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,7 @@ 10 March 2009: Wouter - makedist -w strips out old rc.. and snapshot info from version. - setup.exe starts and stops unbound after install, before uninstall. + - unbound-checkconf recognizes absolute pathnames on windows (C:...). 9 March 2009: Wouter - Nullsoft NSIS installer creation script. diff --git a/makedist.sh b/makedist.sh index 861c94d73..80e9229b7 100755 --- a/makedist.sh +++ b/makedist.sh @@ -149,7 +149,7 @@ done if [ "$DOWIN" = "yes" ]; then version=`./configure --version | head -1 | awk '{ print $3 }'` \ || error_cleanup "Cannot determine version number." - version=`echo $version | sed -e 's/rc.*//' -e 's/_20.*//'` + version=`echo $version | sed -e 's/rc.*$//' -e 's/_20.*$//'` if [ "$RC" != "no" -o "$SNAPSHOT" != "no" ]; then if [ "$RC" != "no" ]; then version2=`echo $version | sed -e 's/rc.*//'`"rc$RC" @@ -167,10 +167,11 @@ if [ "$DOWIN" = "yes" ]; then # procedure for making unbound installer on mingw. info "Creating windows dist unbound $version" info "Calling configure" - echo './configure --enable-debug --enable-static-exe "--with-conf-file=C:\Program Files\Unbound\service.conf" --with-run-dir="" '"$*" + echo './configure --enable-debug --enable-static-exe "--with-conf-file=C:\Program Files\Unbound\service.conf" --with-run-dir="" --with-pidfile="" --with-chroot-dir="" '"$*" ./configure --enable-debug --enable-static-exe \ "--with-conf-file=C:\Program Files\Unbound\service.conf" \ - "--with-run-dir=C:\Program Files\Unbound" $* \ + "--with-run-dir=C:\Program Files\Unbound" --with-pidfile="" \ + --with-chroot-dir="" $* \ || error_cleanup "Could not configure" info "Calling make" make || error_cleanup "Could not make" diff --git a/util/config_file.c b/util/config_file.c index 98f02110d..400011968 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -835,6 +835,11 @@ strlen_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) slashit = 1; } /* chdir */ +#ifdef UB_ON_WINDOWS + if(fname[0] != 0 && fname[1] == ':') { + /* full path, no chdir */ + } else +#endif if(fname[0] == '/' || !use_chdir) { /* full path, no chdir */ } else if(cfg->directory && cfg->directory[0]) { @@ -878,6 +883,11 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir) strncpy(buf, cfg->chrootdir, len); slashit = 1; } +#ifdef UB_ON_WINDOWS + if(fname[0] != 0 && fname[1] == ':') { + /* full path, no chdir */ + } else +#endif /* chdir */ if(fname[0] == '/' || !use_chdir) { /* full path, no chdir */ diff --git a/winrc/setup.nsi b/winrc/setup.nsi index f9e4a4e57..7de5c72cb 100644 --- a/winrc/setup.nsi +++ b/winrc/setup.nsi @@ -28,22 +28,11 @@ VIProductVersion "${QUADVERSION}" # Global Variables Var StartMenuFolder -# user interface pages to show -# for the plain UI (using MUI2 now) -#Page license -#Page directory -#Page instfiles -#UninstPage uninstConfirm -#UninstPage instfiles - # use ReserveFile for files required before actual installation # makes the installer start faster #ReserveFile "System.dll" #ReserveFile "NsExec.dll" -ReserveFile "..\LICENSE" -#!define MUI_ICON "combined.ico" -#!define MUI_UNICON "combined.ico" !define MUI_ICON "${NSISDIR}\contrib\graphics\icons\orange-install-nsis.ico" !define MUI_UNICON "${NSISDIR}\contrib\graphics\icons\orange-uninstall-nsis.ico" @@ -52,10 +41,11 @@ ReserveFile "..\LICENSE" !define MUI_HEADERIMAGE_BITMAP "setup_top.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "setup_left.bmp" !define MUI_ABORTWARNING +#!define MUI_FINISHPAGE_NOAUTOCLOSE # so we can inspect install log. !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "..\LICENSE" -#!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" @@ -75,7 +65,26 @@ ReserveFile "..\LICENSE" !insertmacro MUI_LANGUAGE "English" # default section, one per component, we have one component. -section "Unbound section" +section "Unbound" SectionUnbound + SectionIn RO # cannot unselect this one + # real work in postinstall +sectionEnd + +section "DLV - dlv.isc.org" SectionDLV + # add estimated size for key (Kb) + AddSize 2 + SetOutPath $INSTDIR + NSISdl::download "http://ftp.isc.org/www/dlv/dlv.isc.org.key" "$INSTDIR\dlv.isc.org.key" + Pop $R0 # result from Inetc::get + ${If} $R0 != "success" + MessageBox MB_OK|MB_ICONEXCLAMATION "Download error (ftp.isc.org: $R0), click OK to abort installation" /SD IDOK + SetOutPath "C:\" + RMDir "$INSTDIR" # doesnt work directory in use by us ... + Abort + ${EndIf} +sectionEnd + +section "-hidden.postinstall" # copy files setOutPath $INSTDIR File "..\LICENSE" @@ -89,6 +98,19 @@ section "Unbound section" File "service.conf" File "..\doc\example.conf" + # Store DLV choice + SectionGetFlags ${SectionDLV} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + ${If} $R0 == ${SF_SELECTED} + ClearErrors + FileOpen $R1 "$INSTDIR\service.conf" a + IfErrors done + FileSeek $R1 0 END + FileWrite $R1 "$\nserver: dlv-anchor-file: $\"$INSTDIR\dlv.isc.org.key$\"$\n" + FileClose $R1 + done: + ${EndIf} + # store installation folder WriteRegStr HKLM "Software\Unbound" "InstallLocation" $INSTDIR @@ -113,17 +135,25 @@ section "Unbound section" # install service entry nsExec::ExecToLog '"$INSTDIR\unbound-service-install.exe"' - # start unbound service !insertmacro SERVICE "start" "unbound" "" sectionEnd +# set section descriptions +LangString DESC_unbound ${LANG_ENGLISH} "The base unbound DNS(SEC) validating caching resolver. $\r$\n$\r$\nIt can be found in the Services control panel, and a config file is in the Program Files folder." +LangString DESC_dlv ${LANG_ENGLISH} "Set up to use DLV with dlv.isc.org. Downloads the key with a leap of faith. $\r$\n$\r$\nThis provides public keys that are used for security verification." + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SectionUnbound} $(DESC_unbound) + !insertmacro MUI_DESCRIPTION_TEXT ${SectionDLV} $(DESC_dlv) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + # setup macros for uninstall functions. !undef UN !define UN "un." # uninstaller section -section "un.Unbound section" +section "un.Unbound" # stop unbound service !insertmacro SERVICE "stop" "unbound" "" # uninstall service entry @@ -141,7 +171,8 @@ section "un.Unbound section" Delete "$INSTDIR\unbound-website.url" Delete "$INSTDIR\service.conf" Delete "$INSTDIR\example.conf" - RmDir "$INSTDIR" + Delete "$INSTDIR\dlv.isc.org.key" + RMDir "$INSTDIR" # start menu items !insertmacro MUI_STARTMENU_GETFOLDER UnboundStartMenu $StartMenuFolder