IPFire-Seeder gebaut...

Pakfire erweitert...
ctorrent geloescht.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@661 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-07-05 21:44:24 +00:00
parent 0f57633b02
commit 06209efc9d
18 changed files with 1502 additions and 30 deletions

View File

@@ -0,0 +1,52 @@
#!/bin/sh
########################################################################
# Begin $rc_base/init.d/ipfireseeder
#
# Description : This is a script that starts the torrent-seeder on your
# local IPFire.
#
# Authors : Michael Tremer (mitch@ipfire.org)
#
# Version : 01.00
#
# Notes :
#
########################################################################
. /etc/sysconfig/rc
. ${rc_functions}
case "${1}" in
start)
boot_mesg "Starting IPFire Seeder..."
cd /var/log/seeder
loadproc screen -dmS seeder /usr/bin/rtorrent /var/ipfire/seeder/*.torrent
;;
stop)
boot_mesg "Stopping IPFire Seeder..."
killproc /usr/bin/rtorrent
;;
reload)
boot_mesg "Reloading IPFire Seeder..."
reloadproc /usr/bin/rtorrent
;;
restart)
${0} stop
sleep 1
${0} start
;;
status)
statusproc /usr/bin/rtorrent
;;
*)
echo "Usage: ${0} {start|stop|reload|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/ipfireseeder

View File

@@ -106,13 +106,15 @@ sub fetchfile {
if (open(FILE, ">$Conf::tmpdir/$bfile")) {
print FILE $response->content;
close(FILE);
logger("File received. Start checking signature...");
if (system("gpg --verify \"$Conf::tmpdir/$bfile\" &>/dev/null") eq 0) {
logger("Signature of $bfile is fine.");
move("$Conf::tmpdir/$bfile","$Conf::cachedir/$bfile");
} else {
message("The downloaded file ($file) wasn't verified by IPFire.org. Sorry - Exiting...");
exit 1;
unless ($bfile =~ /^counter\?.*/) { # Don't check out counterfile cause it's empty
logger("File received. Start checking signature...");
if (system("gpg --verify \"$Conf::tmpdir/$bfile\" &>/dev/null") eq 0) {
logger("Signature of $bfile is fine.");
move("$Conf::tmpdir/$bfile","$Conf::cachedir/$bfile");
} else {
message("The downloaded file ($file) wasn't verified by IPFire.org. Sorry - Exiting...");
exit 1;
}
}
logger("Download successfully done from $host (file: $file).");
$allok = 1;
@@ -133,15 +135,15 @@ sub getmirrors {
logger("Try to get a mirror list.");
fetchfile("lists/$Conf::version-server-list", "$Conf::mainserver");
move("$Conf::cachedir/$Conf::version-server-list", "$Conf::dbdir/lists/$Conf::version-server-list");
fetchfile("$Conf::version/lists/server-list.db", "$Conf::mainserver");
move("$Conf::cachedir/server-list.db", "$Conf::dbdir/lists/server-list.db");
}
sub selectmirror {
### Check if there is a current server list and read it.
# If there is no list try to get one.
my $count = 0;
while (!(open(FILE, "<$Conf::dbdir/lists/$Conf::version-server-list")) && ($count lt 5)) {
while (!(open(FILE, "<$Conf::dbdir/lists/server-list.db")) && ($count lt 5)) {
$count++;
getmirrors();
}
@@ -272,6 +274,7 @@ sub dblist {
my $line;
my @templine;
foreach $line (sort @db) {
next unless ($line =~ /.*;.*;.*;/ );
@templine = split(/\;/,$line);
if ("$filter" eq "notinstalled") {
next if ( -e "$Conf::dbdir/installed/meta-$templine[0]" );
@@ -477,6 +480,7 @@ sub setuppak {
copy("$Conf::dbdir/meta/meta-$pak","$Conf::dbdir/installed/");
message("Setup completed. Congratulations!");
message("################################################################################");
fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&ipak=$pak&return=$return", "$Conf::mainserver");
} else {
message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
exit $return;
@@ -507,6 +511,7 @@ sub upgradepak {
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
cleanup("tmp");
copy("$Conf::dbdir/meta/meta-$pak","$Conf::dbdir/installed/");
fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&upak=$pak&return=$return", "$Conf::mainserver");
message("Upgrade completed. Congratulations!");
} else {
message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
@@ -536,6 +541,7 @@ sub removepak {
}
unlink("$Conf::dbdir/rootfiles/$pak");
cleanup("tmp");
fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&dpak=$pak&return=$return", "$Conf::mainserver");
message("Uninstall completed. Congratulations!");
} else {
message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
@@ -581,7 +587,7 @@ sub senduuid {
}
logger("Sending my uuid: $Conf::uuid");
fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid", "$Conf::mainserver");
system("rm -f $Conf::cachedir/counter* 2>/dev/null");
system("rm -f $Conf::tmpdir/counter* 2>/dev/null");
}
}

View File

@@ -16,6 +16,27 @@
exit 1;
}
### Check if there are running some other pakfire processes
#
#my $return = `pidof pakfire`;
#chomp($return);
#if ($return) {
# &Pakfire::message("There are running some other pakfire processes...");
# exit 1;
#}
### Check if we are started by another name
#
if ( $0 =~ /pakfire-update$/ ) {
&Pakfire::message("Running an update started by fcron.");
$ARGV[0] = "update";
$interactive = 0;
} elsif ( $0 =~ /pakfire-upgrade$/ ) {
&Pakfire::message("Running an upgrade started by fcron.");
$ARGV[0] = "upgrade";
$interactive = 0;
}
unless (@ARGV) {
&Pakfire::usage;
}

View File

@@ -13,6 +13,7 @@ $logdir = "/opt/pakfire/logs";
if ( -e "$dbdir/uuid" ) {
$uuid = `cat $dbdir/uuid`;
chomp($uuid);
}
1;

View File

@@ -0,0 +1,4 @@
#!/bin/bash
. /opt/pakfire/lib/functions.sh
extract_files

View File

View File

View File

@@ -0,0 +1,4 @@
#!/bin/bash
. /opt/pakfire/lib/functions.sh
extract_files

View File

View File