Fix labsync seeder

This commit is contained in:
jalr 2018-03-18 14:38:49 +01:00
parent 387351006e
commit b968eff8ad
2 changed files with 20 additions and 23 deletions

View file

@ -2,25 +2,15 @@
set -e
set -- $(cat /proc/cmdline)
for x in "$@"; do
arg="$(echo $x | cut -d= -f1)"
case "$arg" in
disk|torrent_file|torrent)
eval $arg="$(echo $x | cut -d= -f2)"
;;
esac
done
cd /tmp
ln -s "${disk}1" "$torrent_file"
ln -s "$LABSYNC_SQUASHFS_LV" "$LABSYNC_SQUASHFS_FILE"
exec aria2c \
--allow-overwrite \
--check-integrity \
--seed-ratio=0.0 \
--summary-interval=60 \
--file-allocation=none \
--enable-dht=false \
"$torrent"
--allow-overwrite \
--check-integrity \
--seed-ratio=0.0 \
--summary-interval=60 \
--file-allocation=none \
--enable-dht=false \
"$LABSYNC_TORRENT"

View file

@ -1,5 +1,13 @@
#!/bin/sh
labsync_set_environment() {
if grep -q "^${1}=" /root/etc/environment; then
sed -i "s/^\(${1}\)=.*$/\1='${2}'/" /root/etc/environment
else
echo "${1}='${2}'" >> /root/etc/environment
fi
}
labsync_lv_path() {
lvm lvs "$1/$2" -o LV_PATH --noheadings | sed 's/\s//g'
}
@ -175,11 +183,10 @@ PARTTABLE
mount -t overlay overlay -o lowerdir=/ro_root,upperdir=/rw_root/upper,workdir=/rw_root/work /root
if [ -z "$labsync_localboot" ]; then
if grep -q '^LABSYNC=' /root/etc/environment; then
sed -i "s/^\(LABSYNC\)=.*$/\1='$torrent_name'/" /root/etc/environment
else
echo "LABSYNC='$torrent_name'" >> /root/etc/environment
fi
labsync_set_environment LABSYNC "$torrent_name"
labsync_set_environment LABSYNC_TORRENT "${labsync_torrent}"
labsync_set_environment LABSYNC_SQUASHFS_FILE "$squashfs_file"
labsync_set_environment LABSYNC_SQUASHFS_LV "$lv_path_squashfs"
fi
case "$labsync_wait" in