diff --git a/packages/net-misc/dropbox/dropbox-55.4.171.exheres-0 b/packages/net-misc/dropbox/dropbox-55.4.171.exheres-0 new file mode 100644 index 00000000..1a74044d --- /dev/null +++ b/packages/net-misc/dropbox/dropbox-55.4.171.exheres-0 @@ -0,0 +1,93 @@ +# Copyright 2018 Julian Ospald +# Distributed under the terms of the GNU General Public License v2 + +require gtk-icon-cache desktop-utils +require systemd-service openrc-service [ openrc_confd_files=[ "${FILES}"/openrc/confd ] ] + +SUMMARY="Dropbox daemon (pretends to be GUI-less)" +HOMEPAGE="https://www.dropbox.com/" +DOWNLOADS=" + platform:x86? ( https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.x86-${PV}.tar.gz ) + platform:amd64? ( https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.x86_64-${PV}.tar.gz ) +" + +LICENCES="CC-Attribution-NoDerivs-3.0 FTL MIT LGPL-2 openssl dropbox" +SLOT="0" +PLATFORMS="~amd64 ~x86" +MYOPTIONS=" + platform: + amd64 + x86 + ( providers: ijg-jpeg jpeg-turbo ) [[ number-selected = exactly-one ]] +" +RESTRICT="mirror strip" + +DEPENDENCIES=" + build: + dev-util/patchelf + run: + app-arch/bzip2 + dev-lang/python:*[>=3] + dev-libs/glib:2 + dev-libs/popt + media-libs/fontconfig + media-libs/freetype:2 + net-misc/wget + sys-libs/ncurses[compat-libs] + sys-libs/zlib + x11-libs/libSM + x11-libs/libX11 + x11-libs/libXinerama + x11-libs/libXxf86vm + x11-libs/pango[X] + x11-libs/qtbase:5 + x11-libs/qtdeclarative:5 + x11-libs/qtwebkit:5 + x11-misc/wmctrl + x11-themes/hicolor-icon-theme + providers:ijg-jpeg? ( media-libs/jpeg:= ) + providers:jpeg-turbo? ( media-libs/libjpeg-turbo ) +" + +BUGS_TO="hasufell@posteo" + +pkg_setup() { + exdirectory --allow /opt +} + +src_unpack() { + default + edo mkdir "${WORK}" + edo mv "${WORKBASE}"/.dropbox-dist/* "${WORK}"/ + edo mv "${WORK}"/dropbox-lnx.*-${PV}/* "${WORK}" + edo rmdir "${WORK}"/dropbox-lnx.*-${PV}/ + edo rmdir .dropbox-dist +} + +src_prepare() { + # remove some bundled stuff + edo rm -v libGL.so.1 libX11* libdrm.so.2 libffi.so.6 libpopt.so.0 wmctrl + + edo patchelf --set-rpath '$ORIGIN' librsyncffi.compiled._librsyncffi*.so +} + +src_install() { + local installdir="/opt/dropbox" + + insinto "${installdir}" + doins -r * + chmod a+x "${IMAGE}${installdir}"/{dropbox,dropbox_py3,dropboxd} + dodir /usr/$(exhost --target)/bin + dosym "../../../${installdir}/dropboxd" "/usr/$(exhost --target)/bin/dropbox" + + insinto /usr/share/icons/hicolor/16x16/status + doins images/hicolor/16x16/status/* + + install_desktop_entry "Name=Dropbox" + + install_systemd_files + install_openrc_files + + dodoc README ACKNOWLEDGEMENTS +} + diff --git a/packages/net-misc/dropbox/files/dropbox.initd b/packages/net-misc/dropbox/files/dropbox.initd new file mode 100644 index 00000000..4f8dd706 --- /dev/null +++ b/packages/net-misc/dropbox/files/dropbox.initd @@ -0,0 +1,65 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later + +depend() { + need localmount net + after bootmisc +} + +start() { + local tmpnice="${NICE:+"--nicelevel "}${NICE}" + local tmpionice="${IONICE:+"--ionice "}${IONICE}" + local started="" + + ebegin "Starting dropbox" + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + if test -d "${homedir}" && \ + echo 0 > ${homedir}/.dropbox/dropbox.pid && \ + start-stop-daemon -S -b \ + ${tmpnice} ${tmpionice} \ + -u ${dbuser} -v \ + -p ${homedir}/.dropbox/dropbox.pid \ + -e HOME=${homedir} \ + -x /opt/bin/dropbox; then + started="${started} ${dbuser}" + else + eend $? + eerror "Failed to start dropbox for ${dbuser}" + if [ -n "${started}" ]; then + eerror "Stopping already started dropbox" + DROPBOX_USERS=${started} stop + fi + return 1 + fi + done + if [ -z "${started}" ];then + eerror "No dropbox started" + eend 1 + else + eend 0 + fi +} + +stop() { + local retval=0 + ebegin "Stopping dropbox" + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + start-stop-daemon --stop \ + --pidfile ${homedir}/.dropbox/dropbox.pid || retval=$? + done + eend ${retval} +} + +status() { + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + if [ -e ${homedir}/.dropbox/dropbox.pid ] ; then + echo "dropboxd for USER $dbuser: running." + else + echo "dropboxd for USER $dbuser: not running." + fi + done +} diff --git a/packages/net-misc/dropbox/files/openrc/confd/dropbox b/packages/net-misc/dropbox/files/openrc/confd/dropbox new file mode 100644 index 00000000..c20c3c46 --- /dev/null +++ b/packages/net-misc/dropbox/files/openrc/confd/dropbox @@ -0,0 +1,14 @@ +# /etc/conf.d/dropbox.conf: config file for /etc/init.d/dropbox + +# Users to run dropbox +DROPBOX_USERS="" + +# integer [-20 .. 19 ] default 0 +# change the priority of the server -20 (high) to 19 (low) +# see nice(1) for description +#NICE=0 + +# See start-stop-daemon(8) for possible settings +#IONICE=2 + +PID_DIR=/var/run/dropbox diff --git a/packages/net-misc/dropbox/files/openrc/initd/dropbox b/packages/net-misc/dropbox/files/openrc/initd/dropbox new file mode 100644 index 00000000..4f8dd706 --- /dev/null +++ b/packages/net-misc/dropbox/files/openrc/initd/dropbox @@ -0,0 +1,65 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later + +depend() { + need localmount net + after bootmisc +} + +start() { + local tmpnice="${NICE:+"--nicelevel "}${NICE}" + local tmpionice="${IONICE:+"--ionice "}${IONICE}" + local started="" + + ebegin "Starting dropbox" + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + if test -d "${homedir}" && \ + echo 0 > ${homedir}/.dropbox/dropbox.pid && \ + start-stop-daemon -S -b \ + ${tmpnice} ${tmpionice} \ + -u ${dbuser} -v \ + -p ${homedir}/.dropbox/dropbox.pid \ + -e HOME=${homedir} \ + -x /opt/bin/dropbox; then + started="${started} ${dbuser}" + else + eend $? + eerror "Failed to start dropbox for ${dbuser}" + if [ -n "${started}" ]; then + eerror "Stopping already started dropbox" + DROPBOX_USERS=${started} stop + fi + return 1 + fi + done + if [ -z "${started}" ];then + eerror "No dropbox started" + eend 1 + else + eend 0 + fi +} + +stop() { + local retval=0 + ebegin "Stopping dropbox" + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + start-stop-daemon --stop \ + --pidfile ${homedir}/.dropbox/dropbox.pid || retval=$? + done + eend ${retval} +} + +status() { + for dbuser in ${DROPBOX_USERS}; do + local homedir=$(eval echo ~${dbuser}) + if [ -e ${homedir}/.dropbox/dropbox.pid ] ; then + echo "dropboxd for USER $dbuser: running." + else + echo "dropboxd for USER $dbuser: not running." + fi + done +} diff --git a/packages/net-misc/dropbox/files/systemd/dropbox@.service b/packages/net-misc/dropbox/files/systemd/dropbox@.service new file mode 100644 index 00000000..b46a8509 --- /dev/null +++ b/packages/net-misc/dropbox/files/systemd/dropbox@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Dropbox +After=local-fs.target network.target + +[Service] +ExecStart=/opt/dropbox/dropboxd +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=always +User=%i + +[Install] +WantedBy=multi-user.target