From ed7e3ef10437f3e276ad61aef863cbfd2a0ec467 Mon Sep 17 00:00:00 2001 From: JuhaniImberg Date: Thu, 7 May 2015 16:51:45 +0300 Subject: [PATCH 1/5] New package: btsync-2.0.105 --- srcpkgs/btsync/files/btsync/run | 2 ++ srcpkgs/btsync/template | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 srcpkgs/btsync/files/btsync/run create mode 100644 srcpkgs/btsync/template diff --git a/srcpkgs/btsync/files/btsync/run b/srcpkgs/btsync/files/btsync/run new file mode 100644 index 00000000000..531e8b547f7 --- /dev/null +++ b/srcpkgs/btsync/files/btsync/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec btsync --nodaemon --config /etc/btsync.conf \ No newline at end of file diff --git a/srcpkgs/btsync/template b/srcpkgs/btsync/template new file mode 100644 index 00000000000..62fe02687d4 --- /dev/null +++ b/srcpkgs/btsync/template @@ -0,0 +1,47 @@ +pkgname=btsync +version=2.0.105 +revision=1 +repository=nonfree +short_desc="Automatically sync files via secure, distributed technology" +maintainer="Juhani Imberg " +license="Propietary license" +homepage="https://www.getsync.com" + +case "${XBPS_TARGET_MACHINE}" in +x86_64) + _type=x64 + _hash=9e1427b7a6c6e960a378b97ac458ad53c445457ed0e5c8bf693f446597377b78 + ;; +i686) + _type=i386 + _hash=4d446255ff6332da9a244737d6c20e7dcd32d24a8eaabffbaf73147e5898ed8f + ;; +arm*) + _type=arm + _hash=c63fccb76ba3f5dd1197f33bfb8427747faaca9c030f9d8c7f5dfc016d293807 + ;; +esac + +distfiles="https://download-cdn.getsyncapp.com/${version}/linux-${_type}/BitTorrent-Sync_${_type}.tar.gz" +checksum="$_hash" +create_wrksrc=true + +do_install() { + vbin btsync + vlicense LICENSE.TXT + vdoc README + + vmkdir etc + + vmkdir var/lib/btsync + touch ${DESTDIR}/var/lib/btsync/.keep + + ./btsync --dump-sample-config \ + | sed 's:/home/user/\.sync:/var/lib/btsync:' \ + | sed 's:btsync/btsync.pid:btsync.pid:' \ + | sed 's:\/\/ "pid_file": "pid_file":' \ + | sed 's:\/\/ "storage_path": "storage_path":' \ + > "${DESTDIR}/etc/btsync.conf" + + vsv btsync +} From 1a587a37ecf44dac7be42199cd51db1dc20d308c Mon Sep 17 00:00:00 2001 From: JuhaniImberg Date: Thu, 7 May 2015 19:07:49 +0300 Subject: [PATCH 2/5] btsync: download and install as post install hook --- srcpkgs/btsync/INSTALL | 28 ++++++++++++++++++ srcpkgs/btsync/REMOVE | 5 ++++ srcpkgs/btsync/files/LICENSE | 3 ++ srcpkgs/btsync/files/btsync-vars.sh.in | 1 + srcpkgs/btsync/template | 39 +++++++++++++++++--------- 5 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 srcpkgs/btsync/INSTALL create mode 100644 srcpkgs/btsync/REMOVE create mode 100644 srcpkgs/btsync/files/LICENSE create mode 100644 srcpkgs/btsync/files/btsync-vars.sh.in diff --git a/srcpkgs/btsync/INSTALL b/srcpkgs/btsync/INSTALL new file mode 100644 index 00000000000..6248d17de10 --- /dev/null +++ b/srcpkgs/btsync/INSTALL @@ -0,0 +1,28 @@ +BUILD_DIR="./var/tmp/${PKGNAME}.build" + +case "${ACTION}" in +post) + . usr/lib/btsync/btsync-vars.sh + mkdir -p "$BUILD_DIR" + ( + cd "$BUILD_DIR" + xbps-uhelper fetch "${BTSYNC_URL}>$PKGNAME.tar.gz" + echo "$BTSYNC_CHECKSUM $PKGNAME.tar.gz" > chksum + sha256sum -c chksum || exit 1 + tar xf "$PKGNAME.tar.gz" + ) || { + echo Error while extracting; + rm -r $BUILD_DIR; + exit 1; + } + cp $BUILD_DIR/btsync "usr/bin/btsync" + mkdir -p etc + ./$BUILD_DIR/btsync --dump-sample-config \ + | sed 's:/home/user/\.sync:/var/lib/btsync:' \ + | sed 's:btsync/btsync.pid:btsync.pid:' \ + | sed 's:\/\/ "pid_file": "pid_file":' \ + | sed 's:\/\/ "storage_path": "storage_path":' \ + > "etc/btsync.conf" + +;; +esac \ No newline at end of file diff --git a/srcpkgs/btsync/REMOVE b/srcpkgs/btsync/REMOVE new file mode 100644 index 00000000000..c9a0edb3a9d --- /dev/null +++ b/srcpkgs/btsync/REMOVE @@ -0,0 +1,5 @@ +case "$ACTION" in +pre) + rm usr/bin/btsync + ;; +esac \ No newline at end of file diff --git a/srcpkgs/btsync/files/LICENSE b/srcpkgs/btsync/files/LICENSE new file mode 100644 index 00000000000..46cdff51330 --- /dev/null +++ b/srcpkgs/btsync/files/LICENSE @@ -0,0 +1,3 @@ +see https://www.getsync.com/legal/eula + https://www.getsync.com/legal/privacy + https://www.getsync.com/legal/terms-of-use diff --git a/srcpkgs/btsync/files/btsync-vars.sh.in b/srcpkgs/btsync/files/btsync-vars.sh.in new file mode 100644 index 00000000000..a81ca4ff344 --- /dev/null +++ b/srcpkgs/btsync/files/btsync-vars.sh.in @@ -0,0 +1 @@ +export BTSYNC_URL="%BTSYNC_URL%" BTSYNC_CHECKSUM="%BTSYNC_CHECKSUM%" diff --git a/srcpkgs/btsync/template b/srcpkgs/btsync/template index 62fe02687d4..3340fc985c4 100644 --- a/srcpkgs/btsync/template +++ b/srcpkgs/btsync/template @@ -22,26 +22,39 @@ arm*) ;; esac -distfiles="https://download-cdn.getsyncapp.com/${version}/linux-${_type}/BitTorrent-Sync_${_type}.tar.gz" +_filename="BitTorrent-Sync_${_type}.tar.gz" +distfiles="https://download-cdn.getsyncapp.com/${version}/linux-${_type}/${_filename}" checksum="$_hash" -create_wrksrc=true +skip_extraction=$_filename +create_wrksrc=yes + +do_fetch() { + mkdir -p $wrksrc + cd $wrksrc + xbps-uhelper fetch $distfiles + echo "$checksum $_filename" | sha256sum -c || { sha256sum "$_filename"; return 1; } +} + +do_extract() { + : +} + +do_build() { + sed \ + -e "s|%BTSYNC_URL%|${distfiles}|" \ + -e "s|%BTSYNC_CHECKSUM%|${checksum}|" \ + ${FILESDIR}/btsync-vars.sh.in > btsync-vars.sh +} do_install() { - vbin btsync - vlicense LICENSE.TXT - vdoc README - vmkdir etc + vmkdir "usr/lib/btsync" + vcopy btsync-vars.sh "usr/lib/btsync" + + vlicense "${FILESDIR}/LICENSE" vmkdir var/lib/btsync touch ${DESTDIR}/var/lib/btsync/.keep - ./btsync --dump-sample-config \ - | sed 's:/home/user/\.sync:/var/lib/btsync:' \ - | sed 's:btsync/btsync.pid:btsync.pid:' \ - | sed 's:\/\/ "pid_file": "pid_file":' \ - | sed 's:\/\/ "storage_path": "storage_path":' \ - > "${DESTDIR}/etc/btsync.conf" - vsv btsync } From 59337ee5dfcf65445b80d0607573bd3fecd814f2 Mon Sep 17 00:00:00 2001 From: JuhaniImberg Date: Thu, 7 May 2015 19:09:19 +0300 Subject: [PATCH 3/5] btsync: fix indentation in template --- srcpkgs/btsync/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/btsync/template b/srcpkgs/btsync/template index 3340fc985c4..f692d1a320e 100644 --- a/srcpkgs/btsync/template +++ b/srcpkgs/btsync/template @@ -43,12 +43,12 @@ do_build() { sed \ -e "s|%BTSYNC_URL%|${distfiles}|" \ -e "s|%BTSYNC_CHECKSUM%|${checksum}|" \ - ${FILESDIR}/btsync-vars.sh.in > btsync-vars.sh + ${FILESDIR}/btsync-vars.sh.in > btsync-vars.sh } do_install() { - vmkdir "usr/lib/btsync" + vmkdir "usr/lib/btsync" vcopy btsync-vars.sh "usr/lib/btsync" vlicense "${FILESDIR}/LICENSE" From 0b99e87c9673e4b217a07fc3203cd2f0de02ab2e Mon Sep 17 00:00:00 2001 From: JuhaniImberg Date: Thu, 7 May 2015 20:55:18 +0300 Subject: [PATCH 4/5] btsync: use btsync account, use make_dirs, fix typo --- srcpkgs/btsync/INSTALL | 14 +++++++------- srcpkgs/btsync/files/btsync/run | 4 +++- srcpkgs/btsync/template | 7 +++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/srcpkgs/btsync/INSTALL b/srcpkgs/btsync/INSTALL index 6248d17de10..5359bb2eb27 100644 --- a/srcpkgs/btsync/INSTALL +++ b/srcpkgs/btsync/INSTALL @@ -17,12 +17,12 @@ post) } cp $BUILD_DIR/btsync "usr/bin/btsync" mkdir -p etc - ./$BUILD_DIR/btsync --dump-sample-config \ - | sed 's:/home/user/\.sync:/var/lib/btsync:' \ - | sed 's:btsync/btsync.pid:btsync.pid:' \ - | sed 's:\/\/ "pid_file": "pid_file":' \ - | sed 's:\/\/ "storage_path": "storage_path":' \ - > "etc/btsync.conf" - + if [ ! -f etc/btsync.conf ]; then + ./$BUILD_DIR/btsync --dump-sample-config \ + | sed 's:/home/user/\.sync:/var/lib/btsync:' \ + | sed 's:\/\/ "pid_file": "pid_file":' \ + | sed 's:\/\/ "storage_path": "storage_path":' \ + > "etc/btsync.conf" + fi ;; esac \ No newline at end of file diff --git a/srcpkgs/btsync/files/btsync/run b/srcpkgs/btsync/files/btsync/run index 531e8b547f7..1c0fbd71bf0 100644 --- a/srcpkgs/btsync/files/btsync/run +++ b/srcpkgs/btsync/files/btsync/run @@ -1,2 +1,4 @@ #!/bin/sh -exec btsync --nodaemon --config /etc/btsync.conf \ No newline at end of file +mkdir -p /run/btsync +chown -R btsync:btsync /run/btsync +exec chpst -u btsync:btsync btsync --nodaemon --config /etc/btsync.conf 2>&1 diff --git a/srcpkgs/btsync/template b/srcpkgs/btsync/template index f692d1a320e..7ecf61c512c 100644 --- a/srcpkgs/btsync/template +++ b/srcpkgs/btsync/template @@ -4,7 +4,7 @@ revision=1 repository=nonfree short_desc="Automatically sync files via secure, distributed technology" maintainer="Juhani Imberg " -license="Propietary license" +license="Proprietary license" homepage="https://www.getsync.com" case "${XBPS_TARGET_MACHINE}" in @@ -27,6 +27,8 @@ distfiles="https://download-cdn.getsyncapp.com/${version}/linux-${_type}/${_file checksum="$_hash" skip_extraction=$_filename create_wrksrc=yes +system_accounts="btsync" +make_dirs="/var/lib/btsync 0770 ${system_accounts} ${system_accounts}" do_fetch() { mkdir -p $wrksrc @@ -53,8 +55,5 @@ do_install() { vlicense "${FILESDIR}/LICENSE" - vmkdir var/lib/btsync - touch ${DESTDIR}/var/lib/btsync/.keep - vsv btsync } From 7d0b5eefbab91c88388e5dadeca977feadfca1af Mon Sep 17 00:00:00 2001 From: JuhaniImberg Date: Fri, 8 May 2015 22:40:52 +0300 Subject: [PATCH 5/5] btsync: changed make_dirs to home dir, added configuration file, fixed missing newlines --- srcpkgs/btsync/INSTALL | 10 +--- srcpkgs/btsync/REMOVE | 2 +- srcpkgs/btsync/files/btsync.conf | 81 ++++++++++++++++++++++++++++++++ srcpkgs/btsync/template | 6 ++- 4 files changed, 87 insertions(+), 12 deletions(-) create mode 100644 srcpkgs/btsync/files/btsync.conf diff --git a/srcpkgs/btsync/INSTALL b/srcpkgs/btsync/INSTALL index 5359bb2eb27..4896f4dec25 100644 --- a/srcpkgs/btsync/INSTALL +++ b/srcpkgs/btsync/INSTALL @@ -16,13 +16,5 @@ post) exit 1; } cp $BUILD_DIR/btsync "usr/bin/btsync" - mkdir -p etc - if [ ! -f etc/btsync.conf ]; then - ./$BUILD_DIR/btsync --dump-sample-config \ - | sed 's:/home/user/\.sync:/var/lib/btsync:' \ - | sed 's:\/\/ "pid_file": "pid_file":' \ - | sed 's:\/\/ "storage_path": "storage_path":' \ - > "etc/btsync.conf" - fi ;; -esac \ No newline at end of file +esac diff --git a/srcpkgs/btsync/REMOVE b/srcpkgs/btsync/REMOVE index c9a0edb3a9d..c3a3f67c6c0 100644 --- a/srcpkgs/btsync/REMOVE +++ b/srcpkgs/btsync/REMOVE @@ -2,4 +2,4 @@ case "$ACTION" in pre) rm usr/bin/btsync ;; -esac \ No newline at end of file +esac diff --git a/srcpkgs/btsync/files/btsync.conf b/srcpkgs/btsync/files/btsync.conf new file mode 100644 index 00000000000..aefe9a48e0d --- /dev/null +++ b/srcpkgs/btsync/files/btsync.conf @@ -0,0 +1,81 @@ +{ + "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" : "/var/lib/btsync", + +/* set location of pid file */ + "pid_file" : "/var/run/btsync/btsync.pid", + +/* use UPnP for port mapping */ + "use_upnp" : true, + +/* limits in kB/s. 0 - no limit */ + "download_limit" : 0, + "upload_limit" : 0, + +/* proxy configuration */ +// "proxy_type" : "socks4", // Valid types: "socks4", "socks5", "http_connect". Any other value means no proxy +// "proxy_addr" : "192.168.1.2", // IP address of proxy server. +// "proxy_port" : 1080, +// "proxy_auth" : false, // Use authentication for proxy. Note: only username/password for socks5 (RFC 1929) is supported, and it is not really secure +// "proxy_username" : "user", +// "proxy_password" : "password", + + "webui" : + { + "listen" : "0.0.0.0:8888" // remove field to disable WebUI + +/* preset credentials. Use password or password_hash */ +// ,"login" : "admin" +// ,"password" : "password" +// ,"password_hash" : "some_hash" // password hash in crypt(3) format +// ,"allow_empty_password" : false // Defaults to true +/* ssl configuration */ +// ,"force_https" : true // disable http +// ,"ssl_certificate" : "/path/to/cert.pem" +// ,"ssl_private_key" : "/path/to/private.key" + +/* directory_root path defines where the WebUI Folder browser starts (linux only). Default value is / */ +// ,"directory_root" : "/home/user/MySharedFolders/" + +/* directory_root_policy defines how directory_root is used (linux only). + Valid values are: + "all" - accepts directory_root and its subdirectories for 'getdir' and 'adddir' actions + "belowroot" - accepts directory_root's subdirectories for 'getdir' and 'adddir' actions, + but denies attempts to use 'adddir' to create directories directly within directory_root + Default value is "all". */ +// ,"directory_root_policy" : "all" + +/* dir_whitelist defines which directories can be shown to user or have folders added (linux only) + relative paths are relative to directory_root setting */ +// ,"dir_whitelist" : [ "/home/user/MySharedFolders/personal", "work" ] + } + +/* !!! 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" : + [ + { + "secret" : "MY_SECRET_1", // required field - use --generate-secret in command line to create new secret + "dir" : "/home/user/bittorrent/sync_test", // * required field + "use_relay_server" : true, // use relay server when direct connection fails + "use_tracker" : true, + "use_dht" : false, + "search_lan" : true, + "use_sync_trash" : true, // enable SyncArchive to store files deleted on remote devices + "overwrite_changes" : false, // restore modified files to original version, ONLY for Read-Only folders + "known_hosts" : // specify hosts to attempt connection without additional search + [ + "192.168.1.2:44444" + ] + } + ] +*/ + +/* Advanced preferences can be added to config file. Info is available at http://sync-help.bittorrent.com */ + +} diff --git a/srcpkgs/btsync/template b/srcpkgs/btsync/template index 7ecf61c512c..cfd6b739fff 100644 --- a/srcpkgs/btsync/template +++ b/srcpkgs/btsync/template @@ -28,7 +28,8 @@ checksum="$_hash" skip_extraction=$_filename create_wrksrc=yes system_accounts="btsync" -make_dirs="/var/lib/btsync 0770 ${system_accounts} ${system_accounts}" +btsync_homedir="/var/lib/btsync" +conf_files="/etc/btsync.conf" do_fetch() { mkdir -p $wrksrc @@ -49,10 +50,11 @@ do_build() { } do_install() { - vmkdir "usr/lib/btsync" vcopy btsync-vars.sh "usr/lib/btsync" + vconf "${FILESDIR}/btsync.conf" + vlicense "${FILESDIR}/LICENSE" vsv btsync