system/anything-sync-daemon: Added (pseudo-daemon).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Winkel Manah 2015-07-22 10:42:13 +07:00 committed by Willy Sudiarto Raharjo
parent 1facdd736c
commit 945b6bba3a
6 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,6 @@
Anything-sync-daemon (asd) is a tiny pseudo-daemon designed to manage user
specified directories referred to as sync targets from here on out, in tmpfs and
to periodically sync them back to the physical disc (HDD/SSD). This is
accomplished via a symlinking step and an innovative use of rsync to maintain
synchronization between a tmpfs copy and media-bound backups. Additionally, asd
features several crash recovery features.

View file

@ -0,0 +1,70 @@
#!/bin/sh
# Slackware build script for "anything-sync-daemon".
# Copyright 2015 Winkel Manah <winkel.manah@outlook.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=anything-sync-daemon
VERSION=${VERSION:-5.74}
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
rm -rf $TMP/$PRGNAM-$VERSION
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/v$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
sed -i 's#/share##g' Makefile
make
make install-bin install-man install-cron DESTDIR=$PKG
mv $PKG/etc/cron.hourly/asd-update $PKG/etc/cron.hourly/asd-update.new
install -D -m 0644 $TMP/$PRGNAM-$VERSION/common/asd.conf $PKG/etc/asd.conf.new
install -D -m 0644 $CWD/rc.asd $PKG/etc/rc.d/rc.asd.new
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a INSTALL MIT README.md WARNING_READ_THIS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="anything-sync-daemon"
VERSION="5.74"
HOMEPAGE="https://github.com/graysky2/anything-sync-daemon"
DOWNLOAD="https://github.com/graysky2/anything-sync-daemon/archive/v5.74.tar.gz"
MD5SUM="cae6e550acb585e93af9d6cea8bda354"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Winkel Manah"
EMAIL="winkel.manah@outlook.com"

View file

@ -0,0 +1,27 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.asd.new
config etc/cron.hourly/asd-update.new
config etc/asd.conf.new

View file

@ -0,0 +1,39 @@
#!/bin/sh
# Adaptation of Marcel Saegebarth's rc.psd script for slackbuilds.org.
description="Directories syncing"
extra_commands="resync"
description_resync="Manually sync the directories with running tmpfs image"
start() {
echo "Starting Anything-Sync-Daemon"
/usr/bin/anything-sync-daemon sync
}
stop() {
echo "Stopping Anything-Sync-Daemon"
/usr/bin/anything-sync-daemon unsync
}
status() {
/usr/bin/anything-sync-daemon debug
}
resync() {
echo "Syncing directories in tmpfs to physical disc"
/usr/bin/anything-sync-daemon resync
}
case "$1" in
start)
start ;;
stop)
stop ;;
resync)
resync ;;
status)
status ;;
*)
echo $"Usage: $0 {start|stop|resync|status}"
exit 1
esac

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
anything-sync-daemon: anything-sync-daemon (Manage directories in tmpfs)
anything-sync-daemon:
anything-sync-daemon: Anything-sync-daemonAUR (asd) is a tiny pseudo-daemon designed to
anything-sync-daemon: manage user specified directories referred to as sync targets from
anything-sync-daemon: here on out, in tmpfs and to periodically sync them back to the
anything-sync-daemon: physical disc (HDD/SSD). This is accomplished via a symlinking step
anything-sync-daemon: and an innovative use of rsync to maintain synchronization between
anything-sync-daemon: a tmpfs copy and media-bound backups.
anything-sync-daemon:
anything-sync-daemon: Homepage: https://github.com/graysky2/anything-sync-daemon/
anything-sync-daemon: