btsync: download and install as post install hook

This commit is contained in:
JuhaniImberg 2015-05-07 19:07:49 +03:00
parent ed7e3ef104
commit 1a587a37ec
5 changed files with 63 additions and 13 deletions

28
srcpkgs/btsync/INSTALL Normal file
View File

@ -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

5
srcpkgs/btsync/REMOVE Normal file
View File

@ -0,0 +1,5 @@
case "$ACTION" in
pre)
rm usr/bin/btsync
;;
esac

View File

@ -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

View File

@ -0,0 +1 @@
export BTSYNC_URL="%BTSYNC_URL%" BTSYNC_CHECKSUM="%BTSYNC_CHECKSUM%"

View File

@ -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
}