mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
Pakfire holt nun Systemupdates.
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@751 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -2,6 +2,7 @@ etc/fcron.daily/pakfire-update
|
|||||||
#opt/pakfire
|
#opt/pakfire
|
||||||
opt/pakfire/cache
|
opt/pakfire/cache
|
||||||
#opt/pakfire/db
|
#opt/pakfire/db
|
||||||
|
opt/pakfire/db/core
|
||||||
opt/pakfire/db/installed
|
opt/pakfire/db/installed
|
||||||
opt/pakfire/db/lists
|
opt/pakfire/db/lists
|
||||||
opt/pakfire/db/meta
|
opt/pakfire/db/meta
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ md5 :
|
|||||||
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||||
@$(PREBUILD)
|
@$(PREBUILD)
|
||||||
@rm -rf $(DIR_APP)
|
@rm -rf $(DIR_APP)
|
||||||
-mkdir -p /opt/pakfire/{db/{meta,lists,rootfiles,installed},etc,lib,tmp} \
|
-mkdir -p /opt/pakfire/{db/{meta,lists,rootfiles,installed,core},etc,lib,tmp} \
|
||||||
/var/log/pakfire /var/cache/pakfire
|
/var/log/pakfire /var/cache/pakfire
|
||||||
cp -fRv $(DIR_SRC)/src/pakfire/* $(DIR_APP)
|
cp -fRv $(DIR_SRC)/src/pakfire/* $(DIR_APP)
|
||||||
mv -vf $(DIR_APP)/pakfire.conf $(DIR_APP)/etc/
|
mv -vf $(DIR_APP)/pakfire.conf $(DIR_APP)/etc/
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ sub getmirrors {
|
|||||||
|
|
||||||
logger("MIRROR: Trying to get a mirror list.");
|
logger("MIRROR: Trying to get a mirror list.");
|
||||||
|
|
||||||
if ( -e "$Conf::dbdir/lists/server_list.db" ) {
|
if ( -e "$Conf::dbdir/lists/server-list.db" ) {
|
||||||
my @stat = stat("$Conf::dbdir/lists/server_list.db");
|
my @stat = stat("$Conf::dbdir/lists/server-list.db");
|
||||||
my $time = time();
|
my $time = time();
|
||||||
$age = $time - $stat[9];
|
$age = $time - $stat[9];
|
||||||
} else {
|
} else {
|
||||||
@@ -229,6 +229,27 @@ sub getmirrors {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getcoredb {
|
||||||
|
use File::Copy;
|
||||||
|
|
||||||
|
logger("CORE: Trying to get a core list.");
|
||||||
|
|
||||||
|
if ( -e "$Conf::dbdir/lists/core-list.db" ) {
|
||||||
|
my @stat = stat("$Conf::dbdir/lists/core-list.db");
|
||||||
|
my $time = time();
|
||||||
|
$age = $time - $stat[9];
|
||||||
|
} else {
|
||||||
|
# Force an update.
|
||||||
|
$age = "3601";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("$age" gt "3600") {
|
||||||
|
fetchfile("lists/core-list.db", "");
|
||||||
|
move("$Conf::cachedir/core-list.db", "$Conf::dbdir/lists/core-list.db");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub selectmirror {
|
sub selectmirror {
|
||||||
### Check if there is a current server list and read it.
|
### Check if there is a current server list and read it.
|
||||||
# If there is no list try to get one.
|
# If there is no list try to get one.
|
||||||
@@ -296,10 +317,10 @@ sub dbgetlist {
|
|||||||
$age = $time - $stat[9];
|
$age = $time - $stat[9];
|
||||||
} else {
|
} else {
|
||||||
# Force an update.
|
# Force an update.
|
||||||
$age = "86401";
|
$age = "3601";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (("$age" gt "86400") || ("$force" eq "force")) {
|
if (("$age" gt "3600") || ("$force" eq "force")) {
|
||||||
fetchfile("lists/packages_list.db", "");
|
fetchfile("lists/packages_list.db", "");
|
||||||
move("$Conf::cachedir/packages_list.db", "$Conf::dbdir/lists/packages_list.db");
|
move("$Conf::cachedir/packages_list.db", "$Conf::dbdir/lists/packages_list.db");
|
||||||
}
|
}
|
||||||
@@ -594,6 +615,32 @@ sub setuppak {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub upgradecore {
|
||||||
|
getcoredb();
|
||||||
|
eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
|
||||||
|
if ("$core_release" gt "$Conf::core_mine") {
|
||||||
|
message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release");
|
||||||
|
|
||||||
|
my @seq = `seq $Conf::core_mine $core_release`;
|
||||||
|
shift @seq;
|
||||||
|
my $release;
|
||||||
|
foreach $release (@seq) {
|
||||||
|
chomp($release);
|
||||||
|
getpak("core-upgrade-$release");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $release (@seq) {
|
||||||
|
chomp($release);
|
||||||
|
upgradepak("core-upgrade-$release");
|
||||||
|
}
|
||||||
|
|
||||||
|
system("echo $core_release > $Conf::coredir/mine");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message("CORE ERROR: No new upgrades available. You are on release $Conf::core_mine.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub isinstalled {
|
sub isinstalled {
|
||||||
my $pak = shift;
|
my $pak = shift;
|
||||||
if ( open(FILE,"<$Conf::dbdir/installed/meta-$pak") ) {
|
if ( open(FILE,"<$Conf::dbdir/installed/meta-$pak") ) {
|
||||||
|
|||||||
@@ -208,9 +208,11 @@
|
|||||||
&Pakfire::makeuuid();
|
&Pakfire::makeuuid();
|
||||||
&Pakfire::senduuid();
|
&Pakfire::senduuid();
|
||||||
&Pakfire::getmirrors();
|
&Pakfire::getmirrors();
|
||||||
&Pakfire::dbgetlist("force");
|
&Pakfire::dbgetlist("noforce");
|
||||||
|
&Pakfire::getcoredb();
|
||||||
|
|
||||||
} elsif ("$ARGV[0]" eq "upgrade") {
|
} elsif ("$ARGV[0]" eq "upgrade") {
|
||||||
|
&Pakfire::upgradecore();
|
||||||
my @upgradepaks = &Pakfire::dblist("upgrade", "noweb");
|
my @upgradepaks = &Pakfire::dblist("upgrade", "noweb");
|
||||||
my @temp;
|
my @temp;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ $mainserver = "pakfire.ipfire.org";
|
|||||||
|
|
||||||
$cachedir = "/opt/pakfire/cache";
|
$cachedir = "/opt/pakfire/cache";
|
||||||
$dbdir = "/opt/pakfire/db";
|
$dbdir = "/opt/pakfire/db";
|
||||||
|
$coredir = "/opt/pakfire/db/core";
|
||||||
$tmpdir = "/opt/pakfire/tmp";
|
$tmpdir = "/opt/pakfire/tmp";
|
||||||
$logdir = "/opt/pakfire/logs";
|
$logdir = "/opt/pakfire/logs";
|
||||||
|
|
||||||
@@ -16,4 +17,11 @@ if ( -e "$dbdir/uuid" ) {
|
|||||||
chomp($uuid);
|
chomp($uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( -e "$coredir/mine" ) {
|
||||||
|
$core_mine = `cat $coredir/mine`;
|
||||||
|
chomp($core_mine);
|
||||||
|
} else {
|
||||||
|
$core_mine = "0";
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user