Configure a valid DHT cache directory.
This commit is contained in:
parent
57ec856f49
commit
350f4c2646
3 changed files with 16 additions and 3 deletions
|
@ -37,7 +37,9 @@ get_torrent() {
|
|||
sudo vm-aria2 stop "${VM_NAME}"
|
||||
cd "${VM_SYSDIR}"
|
||||
# get image
|
||||
aria2c --seed-time=0 --dht-entry-point="${SEEDBOX_HOST}:${SEEDBOX_PORT}" "${VM_SYSDIR}/${VM_NAME}.qcow2.torrent"
|
||||
aria2c --seed-time=0 --dht-file-path=$DHTDAT \
|
||||
--dht-entry-point="${SEEDBOX_HOST}:${SEEDBOX_PORT}" \
|
||||
"${VM_SYSDIR}/${VM_NAME}.qcow2.torrent"
|
||||
# and seed
|
||||
sudo vm-aria2 start "${VM_NAME}"
|
||||
if ! flock -u 200; then
|
||||
|
@ -51,7 +53,8 @@ get_torrent() {
|
|||
|
||||
get_image_size() {
|
||||
torrentfile=$1
|
||||
length=$(aria2c -S "${torrentfile}" | grep "Total Length" | grep "Total Length" | sed -E 's/.*\(([0-9,]*)\)/\1/' | sed s/,//g)
|
||||
length=$(aria2c -S "${torrentfile}" | grep "Total Length" | \
|
||||
sed -E -e 's/.*\(([0-9,]*)\)/\1/' -e 's/,//g')
|
||||
echo "$length"
|
||||
}
|
||||
|
||||
|
@ -75,6 +78,8 @@ push_file() {
|
|||
--pwdfile "${SEEDBOX_PWFILE}" --no-cert "${FILENAME}"
|
||||
}
|
||||
|
||||
########################
|
||||
|
||||
if [[ "$(id -nu)" != "lmnsynci" ]]; then
|
||||
echo "$(basename "$0") must be run as lmnsynci user"
|
||||
show_help
|
||||
|
|
|
@ -4,6 +4,7 @@ SEEDBOX_HOST="seedbox.pn.steinbeis.schule"
|
|||
SEEDBOX_PORT=6789
|
||||
SEEDBOX_RPC_PORT=6800
|
||||
SEEDBOX_PWFILE="/etc/lmn/uploadseed.conf"
|
||||
DHTDAT="/var/cache/aria2/dht.dat"
|
||||
|
||||
VM_SYSDIR="/lmn/vm"
|
||||
if [[ -v SUDO_UID ]]; then
|
||||
|
|
|
@ -176,7 +176,14 @@
|
|||
group: lmnsynci
|
||||
mode: '0640'
|
||||
content: |
|
||||
"{{ uploadseed_pwd }}"
|
||||
{{ uploadseed_pwd }}
|
||||
|
||||
- name: Prepare directory for aria2 dht.dat
|
||||
ansible.builtin.file:
|
||||
path: /var/cache/aria2/
|
||||
state: directory
|
||||
owner: lmnsynci
|
||||
group: lmnsynci
|
||||
|
||||
- name: Prepare directory for qemu bridge config
|
||||
ansible.builtin.file:
|
||||
|
|
Loading…
Add table
Reference in a new issue