diff --git a/p2pacman-server.conf b/p2pacman-server.conf index 016693f82ffe09e0d26029002f4a24ab394c0299..7f5a7f43b0ade4cb865e3b81e3f9f115535ed799 100644 --- a/p2pacman-server.conf +++ b/p2pacman-server.conf @@ -1,5 +1,5 @@ +[general] mirror_directory = '/var/www/mirror.project-insanity.org' mirrors = 'ftp://ftp.hadiko.de/pub/dists/arch/arch/$repo/os/$arch' -repositories = 'core extra testing community community-testing' +repositories = 'core extra testing community community-testing staging' sync_log = 0 - diff --git a/p2pacman-server.py b/p2pacman-server.py index be49414dbfe7389fb07cf76c552973d2f11155ca..ee5475c6b5ec5c58f4e6d1d9c35587e1017dbd75 100644 --- a/p2pacman-server.py +++ b/p2pacman-server.py @@ -1,11 +1,6 @@ #!/usr/bin/python # dependencies: yaourt -S python-libtorrent-rasterbar rsync mktorrent -# todo: -# - use mktorrent to create torrent files -# - create dns records for: -# mirror.project-insanity.org -# tracker.project-insanity.org import os import libtorrent as lt import re diff --git a/p2pacman.conf b/p2pacman.conf index e5b0fb544525c913b37ff5502da84a395c857874..5e336549e4f8332a7342846424f71cf23e608e00 100644 --- a/p2pacman.conf +++ b/p2pacman.conf @@ -1 +1,2 @@ -timeout = 60 # in seconds +[general] +timeout = 60 # Fallback to http download (in sec) diff --git a/p2pacman.py b/p2pacman.py index 6668f8fb0f628c58df28acb25c4e8f19232c79eb..438a5c9769316eeca8719a2f854e5e8187af17b7 100644 --- a/p2pacman.py +++ b/p2pacman.py @@ -7,6 +7,7 @@ import libtorrent as lt import time from sys import exit import os +import configparser from progressbar import AnimatedMarker, Bar, BouncingBar, Counter, ETA, \ FileTransferSpeed, FormatLabel, Percentage, \ ProgressBar, ReverseBar, RotatingMarker, \ @@ -23,15 +24,16 @@ ses.add_dht_router("router.bitcomet.com", 6881) ses.listen_on(6881, 6891) -# properly remove object -# verbose flag for additional information -# pacman like usage: python-progressbar -# p2p packet database list -# libtorrent python3 bindings 32bit systeme failed noch -# test for root, use less root permissions +config = configparser.ConfigParser() packages = [] +def initconfig(path): + if config.read(path) and 'general' in config: + print("reading config successfull") + else: + print("reading config failed") + class ETA(Timer): """Widget which attempts to estimate the time of arrival.""" diff --git a/p2pacmand.conf b/p2pacmand.conf index 5d0e10588fd632dbf7e6556ee01280367a69ee27..1cdcdfae0fac8e15e973a7a2663144e7a93a443c 100644 --- a/p2pacmand.conf +++ b/p2pacmand.conf @@ -1,3 +1,4 @@ +[general] maxupload_general = 0 # in kb/s maxupload_package = 0 # in kb/s package_cache = /var/cache/pacman/pkg # directory with package and torrent files diff --git a/p2pacmand.py b/p2pacmand.py index c04e23609800a2511f319d2ff2a0d8e12fcba030..0405386d24608d13927abfa706dd0063c0b94d0a 100644 --- a/p2pacmand.py +++ b/p2pacmand.py @@ -6,12 +6,6 @@ import logging import threading import os -#logging.basicConfig(level=DEBUG) -# rescanning package cache every X seconds -# nach einer zeit "stalled" das seeding -# nicht packete hinzufügen, wenn pacman db log aktiv -# systemd service file - ses = lt.session() class torrent: