owntone-server/win32/nsi/mt-daapd.nsi.templ

485 lines
15 KiB
Plaintext
Raw Normal View History

2006-02-26 03:48:23 -05:00
; $Id$
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
2006-04-30 23:10:45 -04:00
!define PRODUCT_NAME "Firefly Media Server"
!define PRODUCT_SERVICE "Firefly Media Server"
2006-02-26 03:48:23 -05:00
!define /date DATEVER "%Y%m%d"
2006-05-07 03:35:43 -04:00
!define PRODUCT_VERSION "svn-$WCREV$"
2006-02-26 03:48:23 -05:00
!define PRODUCT_PUBLISHER "Ron Pedde"
2006-04-30 23:10:45 -04:00
!define PRODUCT_WEB_SITE "http://www.fireflymediaserver.org"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\firefly.exe"
2006-02-26 03:48:23 -05:00
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
2006-04-30 23:10:45 -04:00
!define PROJROOT "..\..\.."
!define MTD_SOURCE "${PROJROOT}\mt-daapd\win32\Release"
!define DLL_SOURCE "${PROJROOT}\win32\dll"
!define CONFIG_SOURCE "${PROJROOT}\mt-daapd\win32\FireflyShell\Release"
2006-04-30 23:10:45 -04:00
!define ADMIN_ROOT "${PROJROOT}\mt-daapd\admin-root"
2006-02-26 03:48:23 -05:00
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LicensePost
2006-04-30 23:10:45 -04:00
!insertmacro MUI_PAGE_LICENSE "${ADMIN_ROOT}\gpl-license.txt"
2006-02-26 03:48:23 -05:00
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryLeave
2006-02-26 03:48:23 -05:00
!insertmacro MUI_PAGE_DIRECTORY
; Music Directory Page
!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryLeave
!insertmacro MUI_PAGE_DIRECTORY
2006-02-26 03:48:23 -05:00
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
2006-04-30 23:10:45 -04:00
OutFile "${PRODUCT_NAME} (${PRODUCT_VERSION}).exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
2006-02-26 03:48:23 -05:00
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section -Pre
2006-05-05 03:38:13 -04:00
nsSCM::QueryStatus "${PRODUCT_NAME}"
Pop $0
Pop $1
StrCmp $0 "success" lbl_stop_service
goto lbl_continue
lbl_stop_service:
DetailPrint "Stopping Service..."
nsSCM::Stop "${PRODUCT_NAME}"
lbl_wait_stop:
Sleep 200
nsSCM::QueryStatus "${PRODUCT_NAME}"
Pop $0
Pop $1
StrCmp $0 "success" lbl_check_status
goto lbl_continue
lbl_check_status:
IntCmp $1 1 lbl_continue lbl_wait_stop lbl_wait_stop
2006-05-05 03:38:13 -04:00
lbl_continue:
; should really loop until service stops...
DetailPrint "Service is stopped..."
2006-05-07 03:35:43 -04:00
Sleep 1000
!include WinMessages.nsh
FindWindow $0 "" "Firefly Config"
SendMessage $0 ${WM_USER} 0 0
nsSCM::QueryStatus "Bonjour Service"
Pop $0
Pop $1
StrCmp $0 "success" lbl_got_bonjour
MessageBox MB_OK "Bonjour for Windows service not found. Please install Apple's Bonjour for Windows."
Quit
lbl_got_bonjour:
SectionEnd
2006-02-26 03:48:23 -05:00
Section "MainSection" SEC01
SetOutPath "$2"
2006-02-26 03:48:23 -05:00
SetOverwrite ifnewer
File /oname=firefly.exe "${MTD_SOURCE}\mt-daapd.exe"
File "${CONFIG_SOURCE}\FireflyShell.exe"
2006-04-25 19:13:04 -04:00
File "${DLL_SOURCE}\gnu_regex.dll"
File "${DLL_SOURCE}\pthreadVC2.dll"
File "${DLL_SOURCE}\sqlite.dll"
File "${DLL_SOURCE}\sqlite3.dll"
File "${DLL_SOURCE}\zlib1.dll"
File "${DLL_SOURCE}\avutil.dll"
File "${DLL_SOURCE}\avcodec.dll"
File "${DLL_SOURCE}\avformat.dll"
File "${DLL_SOURCE}\libFLAC.dll"
SetOutPath "$2\plugins"
2006-05-04 02:39:38 -04:00
File "${MTD_SOURCE}\rsp.dll"
File "${MTD_SOURCE}\w32-event.dll"
File "${MTD_SOURCE}\ssc-ffmpeg.dll"
2006-05-04 02:39:38 -04:00
SetOutPath "$2\admin-root"
2006-04-25 19:13:04 -04:00
File "${ADMIN_ROOT}\thanks.html"
File "${ADMIN_ROOT}\status.html"
File "${ADMIN_ROOT}\status.js"
2006-04-25 19:13:04 -04:00
File "${ADMIN_ROOT}\smartpopup.html"
File "${ADMIN_ROOT}\smart.js"
File "${ADMIN_ROOT}\smart.html"
File "${ADMIN_ROOT}\required.gif"
File "${ADMIN_ROOT}\playlist.js"
File "${ADMIN_ROOT}\playlist.html"
File "${ADMIN_ROOT}\mt-daapd.png"
File "${ADMIN_ROOT}\mt-daapd.js"
File "${ADMIN_ROOT}\mt-daapd.css"
File "${ADMIN_ROOT}\linkTransparent.gif"
File "${ADMIN_ROOT}\linkOpaque.gif"
File "${ADMIN_ROOT}\index.html"
File "${ADMIN_ROOT}\hdr.html"
File "${ADMIN_ROOT}\gpl-license.txt"
File "${ADMIN_ROOT}\gpl-license.html"
File "${ADMIN_ROOT}\ftr.html"
File "${ADMIN_ROOT}\feedback.html"
File "${ADMIN_ROOT}\favicon.ico"
File "${ADMIN_ROOT}\DAAPApplet-0.1.jar"
File "${ADMIN_ROOT}\CREDITS"
File "${ADMIN_ROOT}\config-update.html"
File "${ADMIN_ROOT}\config.html"
File "${ADMIN_ROOT}\config.js"
File "${ADMIN_ROOT}\config.xml"
2006-04-25 19:13:04 -04:00
File "${ADMIN_ROOT}\aspl-license.txt"
File "${ADMIN_ROOT}\aspl-license.html"
File "${ADMIN_ROOT}\applet.html"
2006-05-24 02:52:15 -04:00
File "${ADMIN_ROOT}\spinner.gif"
File "${ADMIN_ROOT}\util.js"
File "${ADMIN_ROOT}\pngfix.js"
SetOutPath "$2\admin-root\lib-js"
2006-04-25 19:13:04 -04:00
File "${ADMIN_ROOT}\lib-js\prototype.js"
File "${ADMIN_ROOT}\lib-js\rico.js"
SetOutPath "$2\admin-root\lib-js\script.aculo.us"
2006-04-25 19:13:04 -04:00
File "${ADMIN_ROOT}\lib-js\script.aculo.us\builder.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\controls.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\dragdrop.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\effects.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\scriptaculous.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\slider.js"
File "${ADMIN_ROOT}\lib-js\script.aculo.us\unittest.js"
SetOutPath "$2"
2006-04-30 23:10:45 -04:00
File "mt-daapd-example.conf"
IfFileExists "$2\mt-daapd.conf" HasConf
2006-02-26 03:48:23 -05:00
SetOverwrite off
CopyFiles "$2\mt-daapd-example.conf" "$2\mt-daapd.conf"
WriteINIStr "$2\mt-daapd.conf" "general" "mp3_dir" $3
2006-04-25 19:13:04 -04:00
HasConf:
2006-05-04 02:39:38 -04:00
WriteINIStr "$2\mt-daapd.conf" "plugins" "plugin_dir" "plugins"
WriteINIStr "$2\mt-daapd.conf" "plugins" "plugins" "rsp.dll,w32-event.dll,ssc-ffmpeg.dll"
ReadINIStr $0 "$2\mt-daapd.conf" "general" "rescan_interval"
StrCmp $0 "" rescan_set rescan_skip
rescan_set:
WriteINIStr "$2\mt-daapd.conf" "general" "rescan_interval" "600"
rescan_skip:
SetAutoClose False
2006-02-26 03:48:23 -05:00
SectionEnd
Section -AdditionalIcons
WriteIniStr "$2\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
2006-04-30 23:10:45 -04:00
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$2\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$2\uninst.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Debug Mode.lnk" "$2\firefly.exe" "-d9 -f"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Firefly Configuration.lnk" "$2\FireflyShell.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Advanced Configuration.lnk" "notepad.exe" "$2\mt-daapd.conf"
2006-02-26 03:48:23 -05:00
SectionEnd
Section -Post
WriteUninstaller "$2\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$2\mt-daapd.exe"
2006-02-26 03:48:23 -05:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$2\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$2\mt-daapd.exe"
2006-02-26 03:48:23 -05:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "FireflyShell" '"$2\FireflyShell.exe" -q'
; ExecWait "$2\mt-daapd.exe -i"
2006-04-30 23:10:45 -04:00
nsSCM::Install "${PRODUCT_NAME}" "${PRODUCT_SERVICE}" 16 2 "$2\firefly.exe" "" "Bonjour Service" "" ""
Pop $0
Pop $1
StrCmp $0 "success" lbl_install_success
IntCmp $1 1073 lbl_install_success ; service already exists
MessageBox MB_OK "Error installing service: $1"
lbl_install_success:
2006-05-07 03:35:43 -04:00
ExecWait 'netsh firewall add allowedprogram "$2\firefly.exe" "${PRODUCT_NAME}" enable'
2006-04-25 19:13:04 -04:00
nsSCM::Start "${PRODUCT_NAME}"
Exec "$2\FireflyShell.exe"
2006-02-26 03:48:23 -05:00
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Function .onInit
; Must set $INSTDIR here to avoid adding ${PRODUCT_NAME} to the end of the
; path when user selects a new directory using the 'Browse' button.
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT_NAME}"
FunctionEnd
Function LicensePost
StrCpy $9 "0"
FunctionEnd
Function DirectoryPre
StrCmp $9 "0" OK
;Skip 2nd (Music) Directory Page if conf file Exists
IfFileExists "$2\mt-daapd.conf" "" OK
Abort
OK:
FunctionEnd
Function DirectoryShow
StrCmp $9 "0" AppDirectoryPage
StrCmp $9 "1" MusicDirectoryPage
AppDirectoryPage:
StrCpy $9 "1"
!insertmacro MUI_INNERDIALOG_TEXT 1041 "Destination Folder"
!insertmacro MUI_INNERDIALOG_TEXT 1019 "$PROGRAMFILES\${PRODUCT_NAME}\"
!insertmacro MUI_INNERDIALOG_TEXT 1006 "Setup will install ${PRODUCT_NAME} in the following folder.$\r$\n$\r$\nTo install in a different folder, click Browse and select another folder. Click Next to continue."
Goto EndDirectoryShow
MusicDirectoryPage:
StrCpy $9 "2"
!insertmacro MUI_HEADER_TEXT "Choose Music Location" "Choose the folder containing music to share."
!insertmacro MUI_INNERDIALOG_TEXT 1041 "Music Folder"
2006-04-25 19:13:04 -04:00
!insertmacro MUI_INNERDIALOG_TEXT 1019 "$DOCUMENTS\My Music"
!insertmacro MUI_INNERDIALOG_TEXT 1006 "Setup will share the music in the following folder.$\r$\n$\r$\nTo share a different folder, click Browse and select another folder. Click Install to start the installation."
EndDirectoryShow:
FunctionEnd
Function DirectoryLeave
StrCmp $9 "1" SaveInstallDir
StrCmp $9 "2" SaveMusicDir
Goto EndDirectoryLeave
SaveInstallDir:
StrCpy $2 $INSTDIR
Goto EndDirectoryLeave
SaveMusicDir:
2006-04-30 23:10:45 -04:00
; Push $INSTDIR
; Call GetParent
; Pop $3
StrCpy $3 $INSTDIR
EndDirectoryLeave:
FunctionEnd
Function .onVerifyInstDir
StrCmp $9 "2" DataPath All
DataPath:
;all valid if UNC
StrCpy $R2 $INSTDIR 2
StrCmp $R2 "\\" PathOK
All:
; Invalid path if root
Push $INSTDIR
call GetRoot
Pop $R1
StrCmp $R1 $INSTDIR "" PathOK
Abort
PathOK:
FunctionEnd
;--------------------------------
;Helper Functions
2006-04-25 19:13:04 -04:00
; GetParent
; input, top of stack (e.g. C:\Program Files\Poop)
; output, top of stack (replaces, with e.g. C:\Program Files)
; modifies no other variables.
;
; Usage:
; Push "C:\Program Files\Directory\Whatever"
; Call GetParent
; Pop $R0
; ; at this point $R0 will equal "C:\Program Files\Directory"
Function GetParent
Exch $R0
Push $R1
Push $R2
Push $R3
StrCpy $R1 0
StrLen $R2 $R0
loop:
IntOp $R1 $R1 + 1
IntCmp $R1 $R2 get 0 get
StrCpy $R3 $R0 1 -$R1
StrCmp $R3 "\" get
Goto loop
get:
StrCpy $R0 $R0 -$R1
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
Function GetRoot
Exch $0
Push $1
Push $2
Push $3
Push $4
StrCpy $1 $0 2
StrCmp $1 "\\" UNC
StrCpy $0 $1
Goto done
UNC:
StrCpy $2 3
StrLen $3 $0
loop:
IntCmp $2 $3 "" "" loopend
StrCpy $1 $0 1 $2
IntOp $2 $2 + 1
StrCmp $1 "\" loopend loop
loopend:
StrCmp $4 "1" +3
StrCpy $4 1
Goto loop
IntOp $2 $2 - 1
StrCpy $0 $0 $2
done:
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd
2006-02-26 03:48:23 -05:00
Section Uninstall
nsSCM::Stop "${PRODUCT_NAME}"
nsSCM::Remove "${PRODUCT_NAME}"
Pop $0
StrCmp $0 "success" lbl_continue_uninstall
MessageBox MB_OK "Error Uninstalling service: $1"
lbl_continue_uninstall:
2006-02-26 03:48:23 -05:00
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\gnu_regex.dll"
Delete "$INSTDIR\pthreadVC2.dll"
Delete "$INSTDIR\sqlite.dll"
2006-04-25 19:13:04 -04:00
Delete "$INSTDIR\sqlite3.dll"
Delete "$INSTDIR\mt-daapd.conf"
2006-04-25 19:13:04 -04:00
Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\avutil.dll"
Delete "$INSTDIR\avcodec.dll"
Delete "$INSTDIR\avformat.dll"
Delete "$INSTDIR\libFLAC.dll"
Delete "$INSTDIR\plugins\rsp.dll"
2006-05-04 02:39:38 -04:00
Delete "$INSTDIR\plugins\w32-event.dll"
Delete "$INSTDIR\plugins\ssc-ffmpeg.dll"
2006-04-30 23:10:45 -04:00
Delete "$INSTDIR\songs.db"
Delete "$INSTDIR\songs3.db"
2006-02-26 03:48:23 -05:00
Delete "$INSTDIR\mt-daapd-example.conf"
Delete "$INSTDIR\admin-root\applet.html"
Delete "$INSTDIR\admin-root\aspl-license.html"
Delete "$INSTDIR\admin-root\aspl-license.txt"
Delete "$INSTDIR\admin-root\config.html"
Delete "$INSTDIR\admin-root\config-update.html"
Delete "$INSTDIR\admin-root\CREDITS"
Delete "$INSTDIR\admin-root\DAAPApplet-0.1.jar"
Delete "$INSTDIR\admin-root\favicon.ico"
Delete "$INSTDIR\admin-root\feedback.html"
Delete "$INSTDIR\admin-root\ftr.html"
Delete "$INSTDIR\admin-root\gpl-license.html"
Delete "$INSTDIR\admin-root\gpl-license.txt"
Delete "$INSTDIR\admin-root\hdr.html"
Delete "$INSTDIR\admin-root\index.html"
Delete "$INSTDIR\admin-root\linkOpaque.gif"
Delete "$INSTDIR\admin-root\linkTransparent.gif"
Delete "$INSTDIR\admin-root\mt-daapd.css"
Delete "$INSTDIR\admin-root\mt-daapd.js"
Delete "$INSTDIR\admin-root\mt-daapd.png"
Delete "$INSTDIR\admin-root\playlist.html"
Delete "$INSTDIR\admin-root\playlist.js"
Delete "$INSTDIR\admin-root\required.gif"
Delete "$INSTDIR\admin-root\smart.html"
Delete "$INSTDIR\admin-root\smart.js"
2006-05-24 02:52:15 -04:00
Delete "$INSTDIR\admin-root\spinner.gif"
Delete "$INSTDIR\admin-root\util.js"
Delete "$INSTDIR\admin-root\pngfix.js"
Delete "$INSTDIR\admin-root\smartpopup.html"
Delete "$INSTDIR\admin-root\status.html"
Delete "$INSTDIR\admin-root\status.js"
Delete "$INSTDIR\admin-root\thanks.html"
Delete "$INSTDIR\admin-root\config.js"
Delete "$INSTDIR\admin-root\config.xml"
Delete "$INSTDIR\admin-root\lib-js\prototype.js"
Delete "$INSTDIR\admin-root\lib-js\rico.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\builder.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\controls.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\dragdrop.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\effects.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\scriptaculous.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\slider.js"
Delete "$INSTDIR\admin-root\lib-js\script.aculo.us\unittest.js"
RMDir "$INSTDIR\admin-root\lib-js\script.aculo.us"
RMDir "$INSTDIR\admin-root\lib-js"
RMDir "$INSTDIR\admin-root"
RMDir "$INSTDIR\plugins"
2006-04-30 23:10:45 -04:00
Delete "$INSTDIR\firefly.exe"
Delete "$INSTDIR\FireflyShell.exe"
2006-04-30 23:10:45 -04:00
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Debug Mode.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Firefly Configuration.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Advanced Configuration.lnk"
2006-02-26 03:48:23 -05:00
2006-04-30 23:10:45 -04:00
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
2006-02-26 03:48:23 -05:00
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose false
SectionEnd