mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make installation of USB drivers optional on windows.
This commit is contained in:
parent
23991fe815
commit
e71d862928
@ -13,7 +13,7 @@
|
|||||||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
''' E-book management software'''
|
''' E-book management software'''
|
||||||
__version__ = "0.3.83"
|
__version__ = "0.3.84"
|
||||||
__docformat__ = "epytext"
|
__docformat__ = "epytext"
|
||||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||||
__appname__ = 'libprs500'
|
__appname__ = 'libprs500'
|
||||||
|
@ -53,7 +53,8 @@ Var MUI_TEMP
|
|||||||
!define WEBSITE "https://libprs500.kovidgoyal.net"
|
!define WEBSITE "https://libprs500.kovidgoyal.net"
|
||||||
!define DEVCON "C:\devcon\i386\devcon.exe"
|
!define DEVCON "C:\devcon\i386\devcon.exe"
|
||||||
!define PY2EXE_DIR "%(py2exe_dir)s"
|
!define PY2EXE_DIR "%(py2exe_dir)s"
|
||||||
!define LIBUSB_DIR "C:\libusb-prs500"
|
;!define LIBUSB_DIR "C:\libusb-prs500"
|
||||||
|
!define LIBUSB_DIR "C:\Users\kovid\libusb1"
|
||||||
!define LIBUNRAR_DIR "C:\Program Files\UnrarDLL"
|
!define LIBUNRAR_DIR "C:\Program Files\UnrarDLL"
|
||||||
!define CLIT "C:\clit\clit.exe"
|
!define CLIT "C:\clit\clit.exe"
|
||||||
!define UNRTF "C:\unrtf\unrtf.exe"
|
!define UNRTF "C:\unrtf\unrtf.exe"
|
||||||
@ -119,7 +120,7 @@ Function .onInit
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
Section "libprs500" Seclibprs500
|
Section "Main" "secmain"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
|
|
||||||
@ -129,32 +130,10 @@ Section "libprs500" Seclibprs500
|
|||||||
File "${UNRTF}"
|
File "${UNRTF}"
|
||||||
File "${PDFTOHTML}"
|
File "${PDFTOHTML}"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\driver"
|
|
||||||
File "${LIBUSB_DIR}\*.dll"
|
|
||||||
File "${LIBUSB_DIR}\*.sys"
|
|
||||||
File "${LIBUSB_DIR}\*.cat"
|
|
||||||
File "${LIBUSB_DIR}\*.inf"
|
|
||||||
File "${DEVCON}"
|
|
||||||
|
|
||||||
SetOutPath "$SYSDIR"
|
SetOutPath "$SYSDIR"
|
||||||
File "${LIBUSB_DIR}\libusb0.dll"
|
|
||||||
File "${LIBUNRAR_DIR}\unrar.dll"
|
File "${LIBUNRAR_DIR}\unrar.dll"
|
||||||
DetailPrint " "
|
DetailPrint " "
|
||||||
|
|
||||||
; Uninstall USB drivers
|
|
||||||
DetailPrint "Uninstalling any existing device drivers"
|
|
||||||
ExecWait '"$INSTDIR\driver\devcon.exe" remove "USB\VID_054C&PID_029B"' $0
|
|
||||||
DetailPrint "devcon returned exit code $0"
|
|
||||||
|
|
||||||
|
|
||||||
DetailPrint "Installing USB driver for prs500..."
|
|
||||||
ExecWait '"$INSTDIR\driver\devcon.exe" install "$INSTDIR\driver\prs500.inf" "USB\VID_054C&PID_029B"' $0
|
|
||||||
DetailPrint "devcon returned exit code $0"
|
|
||||||
IfErrors 0 +2
|
|
||||||
MessageBox MB_OK "Failed to install USB driver. devcon exit code: $0"
|
|
||||||
DetailPrint " "
|
|
||||||
|
|
||||||
|
|
||||||
;Store installation folder
|
;Store installation folder
|
||||||
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "" $INSTDIR
|
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "" $INSTDIR
|
||||||
|
|
||||||
@ -174,7 +153,7 @@ Section "libprs500" Seclibprs500
|
|||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\libprs500.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\libprs500.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
|
||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||||
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\prs500-gui.exe"
|
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\libprs500.exe"
|
||||||
|
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
@ -183,23 +162,65 @@ Section "libprs500" Seclibprs500
|
|||||||
Call AddToPath
|
Call AddToPath
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Device Drivers" "secdd"
|
||||||
|
SetOutPath "$INSTDIR\driver"
|
||||||
|
File "${LIBUSB_DIR}\*.dll"
|
||||||
|
File "${LIBUSB_DIR}\*.sys"
|
||||||
|
File "${LIBUSB_DIR}\*.cat"
|
||||||
|
File "${LIBUSB_DIR}\*.inf"
|
||||||
|
File "${LIBUSB_DIR}\testlibusb-win.exe"
|
||||||
|
File "${DEVCON}"
|
||||||
|
|
||||||
|
SetOutPath "$SYSDIR"
|
||||||
|
File "${LIBUSB_DIR}\libusb0.dll"
|
||||||
|
File "${LIBUSB_DIR}\libusb0.sys"
|
||||||
|
;File "${LIBUSB_DIR}\libusb0_x64.dll"
|
||||||
|
;File "${LIBUSB_DIR}\libusb0_x64.sys"
|
||||||
|
|
||||||
|
; Uninstall USB drivers
|
||||||
|
DetailPrint "Uninstalling any existing device drivers"
|
||||||
|
ExecWait '"$INSTDIR\driver\devcon.exe" remove "USB\VID_054C&PID_029B"' $0
|
||||||
|
DetailPrint "devcon returned exit code $0"
|
||||||
|
|
||||||
|
|
||||||
|
DetailPrint "Installing USB driver for prs500..."
|
||||||
|
ExecWait '"$INSTDIR\driver\devcon.exe" install "$INSTDIR\driver\prs500.inf" "USB\VID_054C&PID_029B"' $0
|
||||||
|
DetailPrint "devcon returned exit code $0"
|
||||||
|
IfErrors 0 +3
|
||||||
|
MessageBox MB_OK|MB_ICONINFORMATION|MB_TOPMOST "Failed to install USB driver. devcon exit code: $0"
|
||||||
|
Goto +2
|
||||||
|
MessageBox MB_OK 'If you have the SONY Connect Reader software installed: $\nGoto Add Remove Programs and uninstall the entry "Windows Driver Package - Sony Corporation (PRSUSB)". $\n$\nIf your reader is connected to the computer, disconnect and reconnect it now.'
|
||||||
|
DetailPrint " "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
;------------------------------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------------------------------
|
||||||
;Descriptions
|
;Descriptions
|
||||||
|
|
||||||
;Language strings
|
;Language strings
|
||||||
LangString DESC_Seclibprs500 ${LANG_ENGLISH} "The GUI and command-line tools for working with ebooks"
|
LangString DESC_secmain ${LANG_ENGLISH} "The GUI and command-line tools for working with ebooks."
|
||||||
|
LangString DESC_secdd ${LANG_ENGLISH} "The device drivers to talk to the ebook reader. If you want to use the device through the SONY Connect software then uncheck this. If you uncheck this you will not be able to transfer books to your reader using ${PRODUCT_NAME}."
|
||||||
|
|
||||||
;Assign language strings to sections
|
;Assign language strings to sections
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${Seclibprs500} $(DESC_Seclibprs500)
|
!insertmacro MUI_DESCRIPTION_TEXT ${secmain} $(DESC_secmain)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${secdd} $(DESC_secdd)
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
;------------------------------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------------------------------
|
||||||
;Uninstaller Section
|
;Uninstaller Section
|
||||||
|
|
||||||
Section "Uninstall"
|
Section "un.DeviceDrivers"
|
||||||
; Uninstall USB drivers
|
; Uninstall USB drivers
|
||||||
ExecWait '"$INSTDIR\driver\devcon.exe" remove "USB\VID_054C&PID_029B"' $0
|
ExecWait '"$INSTDIR\driver\devcon.exe" remove "USB\VID_054C&PID_029B"' $0
|
||||||
DetailPrint "devcon returned exit code $0"
|
DetailPrint "devcon returned exit code $0"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
|
||||||
;ADD YOUR OWN FILES HERE...
|
;ADD YOUR OWN FILES HERE...
|
||||||
RMDir /r "$INSTDIR"
|
RMDir /r "$INSTDIR"
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user