From 0bc6cf2e96c358cb3955534a704937df8230f1d9 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Sat, 28 Sep 2013 02:56:52 +0200 Subject: [PATCH] systemd support --- net-p2p/btsync/Manifest | 10 ++++- net-p2p/btsync/btsync-1.1.70.ebuild | 45 ++++++++++--------- net-p2p/btsync/files/btsync.service | 8 ++++ net-p2p/btsync/files/config | 68 +++++++++++++++++++++++++++++ net-p2p/btsync/files/init.d/btsync | 38 ++++++++++++++++ 5 files changed, 145 insertions(+), 24 deletions(-) create mode 100644 net-p2p/btsync/files/btsync.service create mode 100644 net-p2p/btsync/files/config create mode 100644 net-p2p/btsync/files/init.d/btsync diff --git a/net-p2p/btsync/Manifest b/net-p2p/btsync/Manifest index f4c39f0..ad9945e 100644 --- a/net-p2p/btsync/Manifest +++ b/net-p2p/btsync/Manifest @@ -1,5 +1,13 @@ +AUX btsync.service 107 SHA256 0ae4d7f973dc89df16c6f78dbaf3e76f9af55f72cad46f5902bbd96e5ca2f88c SHA512 3b6218780e9757371872c10d4f2588aec4f4da193526591d3ade9f60e18db5a9790586baf6858d067510d63ee6a102a5f09a1fccaf6b76b030834ab5b8aa4edf WHIRLPOOL 1fdcb3d9243dd52ed5bbb5477750dd1b46e542b488114570a26762f9d7ddf8edb2ff681876d557c857c6d85b7facf3934ae69783f9048a81da374899faa3951b +AUX config 1810 SHA256 5e2405ad3931123d1c1d05d2e45ed5c57e3dc23a16e46b87a6129434185cedd9 SHA512 f894c0456a71c72f9d90f31b24e853595e0360d18e1a9c5e448ff30e93e4366310896144cf4c72ba6de3d8d0dfc904024fbb6ed765cc3eb55f2baaf5f7de6644 WHIRLPOOL 46b4352e79ad560c3e0b5f644c6a4fa264e1484f065f0a8f95785d92bc2635d9ad20c50478d76564f07672496878515b825d75eb84b8a29bc7d48ec3331244a5 +AUX init.d/btsync 804 SHA256 023bd5c1f36b17af6c81343279fb7a4314e9172663ed8da35fb6731ecc47cb76 SHA512 4238f89b41019fb73f5a328e05d687785d946b80694787a17ffdcc020be71df7a7751479659f82c890e674679bc5b5b4b208a9c48b8926433f9d979fab3cb983 WHIRLPOOL ab167800ebc416474614866ae9c708e8546c6abcb25dc464c95c67f4f2355ce77503f6045572c55772e8fba00a15b0db8cbcbd09dc16abae1d5eb5447c705575 +DIST btsync_arm-1.1.48.tar.gz 1095158 SHA256 ea6e1c6e73c1aa7e4d756fad278143618bf9d760f66a50f1f847ee3821ed1713 SHA512 eb2f10d19bb3fbe058467672c44098664f938fdfb812425305101a02c6e8a6ba835849a6934684b5e35fd753c4aa168a568101bcae7b96620fea7c73a2ee468b WHIRLPOOL 1762c3bd7d9641eeaf10d1ef373029ae76ca732831c452faab8b8a91d274025a38e10cdcd1007827b44f74e387b8c22fc259aa425da1e805b0feb3a4ac1759a5 DIST btsync_arm-1.1.70.tar.gz 1279220 SHA256 d79b3cf1881fcab95614693569c950d07dd93ffb70cefd901963dec54b75a05b SHA512 321079de894170eafdd8f923f2e1bfd0909904d350b678707f67566ed0afd1ef8af333270b791d6a429774d7e454da4ef064b417be36b338de2e53599e699bd3 WHIRLPOOL f6499199eae078bc7609aa190a61800866dffbc40fcf08f1ae65456ab6ebf36123e5542b3bbff39f0e61d7ae7161d97684ebed3f091145a90e6eb0b789d3db41 +DIST btsync_i386-1.1.48.tar.gz 1184048 SHA256 e44bfcc4ba5c6dcf5bd01775abf8a5bcbb44584f92dd26546bd307f63b9c5536 SHA512 290303f80bbef8df882dd00e50980fc22dcb0220c7a5e172188188fd1c457e1325bf89e9032e2fb80e0532636e30385f9d070a5543a670dcdd5110cdd5a92f1e WHIRLPOOL 345f030e0c8900545aad9b51d5e21d837c855aa4f13f2ad30686605174b2c01f5973b4404acb1ef3792ef629e36dc20323b58bedb5717ad423e5686ec7df6430 DIST btsync_i386-1.1.70.tar.gz 1367784 SHA256 25161852b8eaddf50ae385771f79bac47818467bc5cabc539a64d985e8af4dc6 SHA512 ac18a91a2d9549388541c2c7dabcae1e8b04534115d3c7e5d93b3fe984c801ebdeed931d63d59e7e7e767587fe42d2bb80e6833127b4cf475d30130314f5c864 WHIRLPOOL a5b12b32a521b7f730b8e9cd1505ac4b7ccd56f0d5f91a1988192b32a539a48380d040d6485327153051708c4d5919d517202d90aaf3c8033bdb730b72981314 +DIST btsync_powerpc-1.1.48.tar.gz 1267186 SHA256 dd94b8ea37c6ab2eec9b3704a97e7a0d4f171525b9edce0b0a5f9c4b5cefa5ea SHA512 49afb78bc248dc8e9c820422f28731a93ae764c0a13dfe22cbab97f8e31b58591baaf0d4ec12334738e2dafeb32b974a9013a5b676cbc0ba0566bbec81be9f8b WHIRLPOOL 4e1081b4c90f2cc734c0aed0937423e898ea08175f447f3a29c3bd7b1b14b46a54d3d84d7db69277af9c71b63eb8d1a1eae3f0a6ce5c02394be9386736f501aa DIST btsync_powerpc-1.1.70.tar.gz 1451029 SHA256 7d68783020627a019363c20d776aaf017bde023886989cac4bd96528fdae9faf SHA512 7f0e22d1cf10e7ebbae78e43cbd84d4d4de2b20478a6605534ee4c04ade68b2bbdea33049a9861cfd53badc4e7e7b2ff24e35c3156d3cf62a8828300094ba5ba WHIRLPOOL ab33985672e29c69c7aaa9729c93dd35a78152fde6b64adaba8a04f93f3ef4006defe240d127e33f6f348a7b825a3ce2e642228f43beb64ecd2fb811f300bdf3 +DIST btsync_x64-1.1.48.tar.gz 1265078 SHA256 4c58e68a8ef30d3a1c39fb15a62cff863fc8496abc7720b5e9b30842b92e4dc4 SHA512 2a4ce574ec0836c8c5cebc5a5a9fb4c027754b63620313d2e16de4a4cfac0825943a8973ed716416e3326847770b5459673f0aefe86c3afc99198bc05557a735 WHIRLPOOL a2e27d60522a431adae078f2996349f4d2c4cb7dfb082bac9882746c26d4bbf8c335bb4e62ae39c3e05d100387f3425271cc18d0b6027cdffb874347857ee6ba DIST btsync_x64-1.1.70.tar.gz 1449204 SHA256 7197ac1a23ff593b1cc6ef124cb2555376aac4637f368483ed2e0d5230b3dec2 SHA512 768f960935cacd1ccc655e9182ada0ddf61d4b8fd0dc8a5386182a46014e6bd11f1743a78884f17b9d3b04d6668bb98c56bce8019c902a216ed26d65a60492c7 WHIRLPOOL 6261713d643ef0eb9816837975a0d0af534819cf978de8370b088c93bd86770f3053c0976e27aee32fc00b0ecf1a9a01cf083e95c1325dcd632896a6e6b5bf2c -EBUILD btsync-1.1.70.ebuild 975 SHA256 8338a00fec137dc05c9f9df5d888de5a0c16ec0d1e8cb52ca116ff0bf8dd82cf SHA512 6c910b6643d1aedfc380d25c2fa940bec1a1abcbf26bab472331d578b06fe007205e985a1d627daf94b5c5f735e9fff944e70775ca7f0a00631ae1c63c74c7c4 WHIRLPOOL 5a007b0256526188dc7bb99d7165aacba9eeecbeaab7622158b12221856ef4a648872c38575a686a8998784261866d8124dd22d7a66f3c2de3b18d4061290346 +EBUILD btsync-1.1.48.ebuild 1010 SHA256 1b8a53ef7839972948ee44e35b31c1dc66bd511c345687f0e922a7fa3742fc89 SHA512 0f182b34738e45ff9916b5e1ac6d6ea5fd2b26c61fadfd13f9345cd7d82324e5c273caf02139fa3bf0ebdde787267ec529514a9fb9069eb4602ca803a2f43290 WHIRLPOOL 89ab3a8314a372c7e98a578b934d2eb5d26dd6147e761fa3fb4dc2aa122cf5a1f136c41e2e12163e00786a3a34bffac770decdb1965d689831ff6b41d3257db0 +EBUILD btsync-1.1.70.ebuild 1071 SHA256 bab2a3146a266774901ed3dc8fae1298bba0fcb9db88cffbd7f62c533d3ff940 SHA512 76924af233e5aedb9b67decb77c421894aac25f7bb151df9575f400b0f6cff5c3762a0707da5c52d70422e7c4ded7a766e9e0c7a38964bcfa35565f87057b299 WHIRLPOOL b0900b18360e6eb71450e93db143ad4c33a09d7417ab988958a3cb668425bd20062647cd18965c79703a689badfee9638afe74f008d50457e41eadf06f79199f diff --git a/net-p2p/btsync/btsync-1.1.70.ebuild b/net-p2p/btsync/btsync-1.1.70.ebuild index f0d216a..745bb65 100644 --- a/net-p2p/btsync/btsync-1.1.70.ebuild +++ b/net-p2p/btsync/btsync-1.1.70.ebuild @@ -1,42 +1,41 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright (C) 2013 Jonathan Vasquez # Distributed under the terms of the GNU General Public License v2 -# $Header: $ -EAPI=5 +EAPI="4" -inherit pax-utils +inherit systemd -DESCRIPTION="Sync stuff via BitTorrent" +DESCRIPTION="Automatically sync files via secure, distributed technology." HOMEPAGE="http://labs.bittorrent.com/experiments/sync.html" -SRC_URI="amd64? ( http://syncapp.bittorrent.com/${PV}/${PN}_x64-${PV}.tar.gz ) - x86? ( http://syncapp.bittorrent.com/${PV}/${PN}_i386-${PV}.tar.gz ) - ppc? ( http://syncapp.bittorrent.com/${PV}/${PN}_powerpc-${PV}.tar.gz ) - arm? ( http://syncapp.bittorrent.com/${PV}/${PN}_arm-${PV}.tar.gz )" - -RESTRICT="mirror" +SRC_URI=" + amd64? ( http://syncapp.bittorrent.com/${PV}/${PN}_x64-${PV}.tar.gz ) + x86? ( http://syncapp.bittorrent.com/${PV}/${PN}_i386-${PV}.tar.gz ) + arm? ( http://syncapp.bittorrent.com/${PV}/${PN}_arm-${PV}.tar.gz ) + ppc? ( http://syncapp.bittorrent.com/${PV}/${PN}_powerpc-${PV}.tar.gz )" +RESTRICT="mirror strip" LICENSE="BitTorrent" SLOT="0" -KEYWORDS="~amd64 ~x86 ~arm ~ppc" +KEYWORDS="amd64 ~x86 ~arm ~ppc" IUSE="" DEPEND="" RDEPEND="${DEPEND}" +QA_PREBUILT="opt/btsync/${PN}" + S="${WORKDIR}" -QA_PREBUILT="usr/bin/btsync" - src_install() { - dodoc LICENSE.TXT + mkdir -p ${D}/opt/${PN} && cd ${D}/opt/${PN} + mkdir -p ${D}/etc/{init.d,${PN}} - newinitd "${FILESDIR}/btsync_initd" btsync - newconfd "${FILESDIR}/btsync_confd" btsync + cp ${S}/btsync . + cp ${S}/LICENSE.TXT . + cp ${FILESDIR}/config ${D}/etc/${PN} + cp ${FILESDIR}/init.d/${PN} ${D}/etc/init.d/ - insinto /etc - doins "${FILESDIR}/btsync.conf" - - mkdir -p "${D}/usr/bin" - cp btsync "${D}/usr/bin/btsync" - pax-mark m "${D}/usr/bin/btsync" + # Set more secure permissions + chmod 755 ${D}/etc/init.d/btsync + systemd_dounit "${FILESDIR}"/${PN}.service } \ No newline at end of file diff --git a/net-p2p/btsync/files/btsync.service b/net-p2p/btsync/files/btsync.service new file mode 100644 index 0000000..da4692e --- /dev/null +++ b/net-p2p/btsync/files/btsync.service @@ -0,0 +1,8 @@ +[Service] +Type=dbus +BusName=org.btsync.daemon +ExecStart=/opt/btsync + +[Install] +WantedBy=multi-user.target + diff --git a/net-p2p/btsync/files/config b/net-p2p/btsync/files/config new file mode 100644 index 0000000..5264fea --- /dev/null +++ b/net-p2p/btsync/files/config @@ -0,0 +1,68 @@ +{ + "device_name": "My Sync Device", + "listening_port" : 0, // 0 - randomize port + +/* storage_path dir contains auxilliary app files + if no storage_path field: .sync dir created in the directory + where binary is located. + otherwise user-defined directory will be used +*/ + "storage_path" : ".sync", + +// uncomment next line if you want to set location of pid file + "pid_file" : "/var/run/btsync.pid", + + + "check_for_updates" : true, + "use_upnp" : true, // use UPnP for port mapping + + +/* limits in kB/s + 0 - no limit +*/ + "download_limit" : 0, + "upload_limit" : 0, + +/* remove "listen" field to disable WebUI + remove "login" and "password" fields to disable credentials check +*/ + "webui" : + { + "listen" : "0.0.0.0:8888", + "login" : "admin", + "password" : "password" + } + +/* !!! if you set shared folders in config file WebUI will be DISABLED !!! + shared directories specified in config file + override the folders previously added from WebUI. +*/ +/* + , + "shared_folders" : + [ + { +// use --generate-secret in command line to create new secret + "secret" : "MY_SECRET_1", // * required field + "dir" : "/home/user/bittorrent/sync_test", // * required field + +// use relay server when direct connection fails + "use_relay_server" : true, + "use_tracker" : true, + "use_dht" : false, + "search_lan" : true, +// enable sync trash to store files deleted on remote devices + "use_sync_trash" : true, +// specify hosts to attempt connection without additional search + "known_hosts" : + [ + "192.168.1.2:44444" + ] + } + ] +*/ + +// Advanced preferences can be added to config file. +// Info is available in BitTorrent Sync User Guide. + +} diff --git a/net-p2p/btsync/files/init.d/btsync b/net-p2p/btsync/files/init.d/btsync new file mode 100644 index 0000000..982f1d2 --- /dev/null +++ b/net-p2p/btsync/files/init.d/btsync @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright (C) 2013 Jonathan Vasquez +# Distributed under the terms of the Simplified BSD License. + +NAME="BitTorrent Sync" +SYNC_NAME="btsync" +SYNC_PATH="/opt/${SYNC_NAME}/" +SYNC_BINARY="${SYNC_PATH}/${SYNC_NAME}" +SYNC_OPTS="--nodaemon --config /etc/${SYNC_NAME}/config" +SYNC_PIDFILE="/var/run/${SYNC_NAME}.pid" + +start() { + ebegin "Starting ${NAME}" + + start-stop-daemon --start --exec "${SYNC_BINARY}" \ + --pidfile "${SYNC_PIDFILE}" --background \ + -- ${SYNC_OPTS} + + eend $? +} + +stop() { + ebegin "Stopping ${NAME}" + + start-stop-daemon --stop --exec "${SYNC_BINARY}" \ + --pidfile "${SYNC_PIDFILE}" + + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + + start-stop-daemon --signal HUP --exec "${SYNC_BINARY}" \ + --pidfile "${SYNC_PIDFILE}" + + eend $? +}