alpha-quadrant/net-p2p/resilio-sync/resilio-sync-2.5.12.ebuild
2018-01-16 09:07:29 +01:00

68 lines
2.0 KiB
Bash

# Copyright (C) 2013-2014 Jonathan Vasquez <fearedbliss@funtoo.org>
# Copyright (C) 2014 Sandy McArthur <Sandy@McArthur.org>
# Copyright (C) 2015 Scott Alfter <scott@alfter.us>
# Copyright (C) 2016 Micha Glave <gentoo@migmedia.de>
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
inherit eutils user
NAME="rslsync"
DESCRIPTION="Magic folder style file syncing powered by BitTorrent."
HOMEPAGE="http://www.getsync.com/"
SRC_URI="
amd64? ( https://download-cdn.resilio.com/${PV}/linux-x64/${PN}_x64.tar.gz -> ${PN}_x64-${PV}.tar.gz )
x86? ( https://download-cdn.resilio.com/${PV}/linux-i386/${PN}_i386.tar.gz -> ${PN}_i386-${PV}.tar.gz )
arm? ( https://download-cdn.resilio.com/${PV}/linux-arm/${PN}_arm.tar.gz -> ${PN}_arm-${PV}.tar.gz )"
RESTRICT="mirror strip"
LICENSE="BitTorrent"
SLOT="0"
KEYWORDS="amd64 x86 arm"
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
QA_PREBUILT="opt/${PN}/${NAME}"
S="${WORKDIR}"
pkg_setup() {
enewgroup ${NAME}
enewuser ${NAME} -1 -1 -1 "${NAME}"
}
src_install() {
einfo dodir "/opt/${PN}"
dodir "/opt/${PN}"
exeinto "/opt/${PN}"
doexe ${NAME}
insinto "/opt/${PN}"
doins LICENSE.TXT
newinitd "${FILESDIR}/initd" ${NAME}
newconfd "${FILESDIR}/confd" ${NAME}
einfo dodir "/etc/${PN}"
dodir "/etc/${PN}"
"${D}/opt/${PN}/${NAME}" --dump-sample-config > "${D}/etc/${PN}/config"
fowners ${NAME} "/etc/${PN}/config"
fperms 460 "/etc/${PN}/config"
}
pkg_preinst() {
# Customize for local machine
sed -i 's|// "pid_file".*$| "pid_file" : "/run/resilio-sync/rslsync.pid",|' "${D}/etc/${PN}/config"
# Set device name to `hostname`
sed -i "s/My Sync Device/$(hostname) Gentoo Linux/" "${D}/etc/${PN}/config"
# Update defaults to the ${NAME}'s home dir
sed -i "s|/home/user|$(egethome ${NAME})|" "${D}/etc/${PN}/config"
}
pkg_postinst() {
elog "Init scripts launch ${NAME} daemon as ${NAME}:${NAME} "
elog "Please review/tweak /etc/${PN}/config for default configuration."
elog "Default web-gui URL is http://localhost:8888/ ."
}