Index: head/deskutils/calibre/Makefile =================================================================== --- head/deskutils/calibre/Makefile (revision 444320) +++ head/deskutils/calibre/Makefile (revision 444321) @@ -1,99 +1,100 @@ # Created by: stas # $FreeBSD$ PORTNAME= calibre PORTVERSION= 3.1.0 +PORTREVISION= 1 CATEGORIES= deskutils python MASTER_SITES= http://download.calibre-ebook.com/${PORTVERSION}/ MAINTAINER= madpilot@FreeBSD.org COMMENT= Ebook management application LICENSE= GPLv3 LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libpoppler-qt5.so:graphics/poppler-qt5 \ libwmflite.so:graphics/libwmf \ libchm.so:misc/chmlib \ libicudata.so:devel/icu \ libpodofo.so:graphics/podofo \ libmtp.so:multimedia/libmtp \ libfreetype.so:print/freetype2 BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sqlite3>=0:databases/py-sqlite3 \ ${PYTHON_PKGNAMEPREFIX}dateutil>=0:devel/py-dateutil \ ${PYTHON_PKGNAMEPREFIX}pillow>=0:graphics/py-pillow \ ${PYTHON_PKGNAMEPREFIX}lxml>=0:devel/py-lxml \ ${PYTHON_PKGNAMEPREFIX}cssutils>=1.0.1,1:www/py-cssutils \ ${PYTHON_PKGNAMEPREFIX}apsw>=0:databases/py-apsw \ ${PYTHON_PKGNAMEPREFIX}msgpack-python>=0.3:devel/py-msgpack-python \ ${PYTHON_PKGNAMEPREFIX}regex>=0:textproc/py-regex RUN_DEPENDS= xdg-open:devel/xdg-utils \ ${PYTHON_PKGNAMEPREFIX}cssutils>=1.0.1,1:www/py-cssutils \ ${PYTHON_PKGNAMEPREFIX}dnspython>=0:dns/py-dnspython \ ${PYTHON_PKGNAMEPREFIX}dateutil>=0:devel/py-dateutil \ ${PYTHON_PKGNAMEPREFIX}beautifulsoup32>=0:www/py-beautifulsoup32 \ ${PYTHON_PKGNAMEPREFIX}pillow>=0:graphics/py-pillow \ ${PYTHON_PKGNAMEPREFIX}lxml>=0:devel/py-lxml \ ${PYTHON_PKGNAMEPREFIX}mechanize>=0:www/py-mechanize \ ${PYTHON_PKGNAMEPREFIX}sqlite3>=0:databases/py-sqlite3 \ ${PYTHON_PKGNAMEPREFIX}dbus>=0:devel/py-dbus \ ${PYTHON_PKGNAMEPREFIX}netifaces>=0:net/py-netifaces \ ${PYTHON_PKGNAMEPREFIX}cssselect>=0:www/py-cssselect \ ${PYTHON_PKGNAMEPREFIX}apsw>=0:databases/py-apsw \ ${PYTHON_PKGNAMEPREFIX}msgpack-python>=0.3:devel/py-msgpack-python \ ${PYTHON_PKGNAMEPREFIX}regex>=0:textproc/py-regex \ ${PYTHON_PKGNAMEPREFIX}chardet>=0:textproc/py-chardet \ pdftohtml:graphics/poppler-utils USE_RC_SUBR= calibre EXTRACT_BEFORE_ARGS= -x -s '/^calibre/~-src/' -f USES= desktop-file-utils gettext-runtime gnome localbase:ldflags pkgconfig \ python:2 pyqt:5 shared-mime-info shebangfix ssl tar:xz SHEBANG_FILES= resources/calibre-portable.sh \ src/calibre/ebooks/metadata/odt.py \ src/calibre/utils/*.py \ src/odf/*.py USE_PYQT= core gui network sip svg webkit widgets webkitwidgets xmlpatterns USE_QT5= buildtools_build core dbus gui qmake_build widgets USE_GL= egl gl USE_GNOME= glib20 USE_XORG= xrender xext x11 WRKSRC= ${WRKDIR}/${PORTNAME}-src-${PORTVERSION} MAKE_ENV+= FC_INC_DIR="${LOCALBASE}/include/fontconfig" \ FC_LIB_DIR="${LOCALBASE}/lib" \ OVERRIDE_CFLAGS="${CFLAGS}" \ OVERRIDE_LDFLAGS="${LDFLAGS}" \ PODOFO_LIB_DIR="${LOCALBASE}/lib" \ PODOFO_INC_DIR="${LOCALBASE}/include/podofo" \ WITH_USB=yes \ CALIBRE_CONFIG_DIRECTORY=${WRKDIR}/calibre-config \ XDG_DATA_DIRS=${STAGEDIR}${PREFIX}/share \ XDG_CONFIG_HOME=${WRKDIR}/xdg-config \ XDG_UTILS_INSTALL_MODE=system \ QMAKE=${QMAKE} .include do-build: @${MKDIR} ${WRKDIR}/calibre-config ${WRKDIR}/xdg-config @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} \ ${PYSETUP} build) do-install: @${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION}/site-packages \ ${STAGEDIR}${PREFIX}/share/icons/hicolor \ ${STAGEDIR}${PREFIX}/share/applications \ ${STAGEDIR}${PREFIX}/share/desktop-directories \ ${STAGEDIR}${PREFIX}/share/mime/packages # Create this file to avoid what looks like a bug in xdg-desktop-menu @${TOUCH} ${STAGEDIR}${PREFIX}/share/applications/defaults.list (cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} \ ${PYSETUP} install --prefix ${PREFIX} \ --staging-root ${STAGEDIR}${PREFIX}) @${RM} ${STAGEDIR}${PREFIX}/bin/calibre-uninstall \ ${STAGEDIR}${PREFIX}/share/applications/defaults.list @${RMDIR} ${STAGEDIR}${PREFIX}/share/desktop-directories @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/calibre/calibre/plugins/* .include Index: head/deskutils/calibre/files/calibre.in =================================================================== --- head/deskutils/calibre/files/calibre.in (revision 444320) +++ head/deskutils/calibre/files/calibre.in (revision 444321) @@ -1,70 +1,70 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: calibre # REQUIRE: DAEMON # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable calibre_server: # # calibre_enable (bool): Set it to "YES" to enable calibre # Default is "NO". # calibre_port (int): port that calibre_server listens on # Default is 8080 # calibre_user (string): user that calibre_server runs as # Default is calibre # calibre_home (string): home directory for calibre_server # Default is the home directory of calibre_user -# calibre_username (string): username for calibre authentication -# Default is calibre -# calibre_password (string): If set then access is restricted -# default is unrestricted # calibre_url_prefix (string): prefix to append to all URLs # default is unset +# calibre_logfile (string): log file location +# Default /var/log/calibre-server/calibre-server.log +# calibre_logsize (int): size of log file before being rotated in MBs +# Default 10 MB +# calibre_flags (string): Any further flags to customize configuration +# Default empty # calibre_library (string): path to library folder to serve content from # # ########################################################## . /etc/rc.subr name=calibre rcvar=calibre_enable load_rc_config $name : ${calibre_enable:=NO} : ${calibre_user:=calibre} : ${calibre_library:=/nonexistent} +: ${calibre_logfile:=/var/log/calibre-server/calibre-server.log} +: ${calibre_logsize:=10} pidfile=/var/run/${name}/${name}.pid command=/usr/local/bin/calibre-server command_interpreter=python2 required_dirs=${calibre_library} -start_cmd=${name}_start +start_precmd=calibre_prestart -start_precmd="install -d -o ${calibre_user} -m755 /var/run/${name}" +calibre_home=${calibre_home:-$(getent passwd ${calibre_user} | awk -F: '{print $6}')} +calibre_env="${calibre_env} HOME=${calibre_home:-/nonexistent}" -calibre_start() -{ - if [ ! -z "${calibre_port}" ]; then - command_args="${command_args} --port=${calibre_port}" - fi - if [ ! -z "${calibre_username}" ]; then - command_args="${command_args} --username=${calibre_username}" - fi - if [ ! -z "${calibre_password}" ]; then - command_args="${command_args} --password=${calibre_password}" - fi - if [ ! -z "${calibre_url_prefix}" ]; then - command_args="${command_args} --url-prefix=${calibre_url_prefix}" - fi +if [ ! -z "${calibre_port}" ]; then + command_args="${command_args} --port=${calibre_port}" +fi +if [ ! -z "${calibre_url_prefix}" ]; then + command_args="${command_args} --url-prefix=${calibre_url_prefix}" +fi - calibre_home=${calibre_home:-$(getent passwd ${calibre_user} | awk -F: '{print $6}')} - HOME=${calibre_home:-/nonexistent} - /usr/sbin/daemon -f -u ${calibre_user} -p ${pidfile} ${command} ${command_args} --with-library ${calibre_library} +command_args="${command_args} --log ${calibre_logfile} --pidfile ${pidfile} --max-log-size ${calibre_logsize} --daemonize ${calibre_library}" + +calibre_prestart() +{ + install -d -o ${calibre_user} -m 755 /var/run/${name} + install -d -o ${calibre_user} -m 755 `dirname ${calibre_logfile}` } run_rc_command "$1" Index: head/deskutils/calibre/pkg-message =================================================================== --- head/deskutils/calibre/pkg-message (revision 444320) +++ head/deskutils/calibre/pkg-message (revision 444321) @@ -1,34 +1,45 @@ --- NOTE: Calibre requires Hal to be running for access to devices. The user who is running Calibre also needs to be able to mount devices. For non-root users, this means modifying %%PREFIX%%/etc/PolicyKit/PolicyKit.conf and adding the policy there. To allow a single user named "example" to mount removable devices, add the following: Additional users will each need their own block with a "yes" return result. To permit all accounts to mount removable devices (allowing a denial of access attack) add the following: --- If you are using an Android device as your e-book reader, please note that the stock Google Books app uses a storage format that is not supported by calibre. The calibre FAQ recommends that either of the free apps Aldiko or WordPlayer are used instead. --- + +A basic startup script for calibre-server has been installed. + +It can be customized and configured using the flags described in the +headers of the startup script. + +The command line options are documented here: + +https://manual.calibre-ebook.com/generated/en/calibre-server.html + +---