system("logger -t pakfire \"$log\"");
}
+sub usage {
+ &Pakfire::message("Usage: pakfire <install|remove> <pak(s)>");
+ &Pakfire::message(" <update> - Contacts the servers for new lists of paks.");
+ &Pakfire::message(" <upgrade> - Installs the latest version of a pak.");
+ &Pakfire::message(" <list> - Outputs a short list with all available paks.");
+ exit 1;
+}
+
sub pinghost {
my $host = shift;
}
if (("$age" gt 86400) || ("$force" eq "force")) {
- cleanup();
+ #cleanup();
fetchfile("lists/packages_list.db", "");
move("$Conf::cachedir/packages_list.db", "$Conf::dbdir/lists/packages_list.db");
}
my @templine;
foreach $line (sort @db) {
@templine = split(/\;/,$line);
- ### filter here...
+ if ("$filter" eq "notinstalled") {
+ next if ( -e "$Conf::dbdir/installed/meta-$templine[0]" );
+ } elsif ("$filter" eq "installed") {
+ next unless ( -e "$Conf::dbdir/installed/meta-$templine[0]" );
+ }
if ("$forweb" eq "forweb") {
print "<option value=\"$templine[0]\">$templine[0]-$templine[1]-$templine[2]</option>\n";
} else {
- print "Name: $templine[0]\nVersion: $templine[1]\nRelease: $templine[2]\n\n";
+ print "Name: $templine[0]\nProgVersion: $templine[1]\nRelease: $templine[2]\n\n";
}
}
}
my $file = getpak("$pak", "noforce");
- my $return = system("gpg -d < $Conf::cachedir/$file | tar xj -C $Conf::tmpdir/");
+ my $return = system("cd $Conf::tmpdir/ && gpg -d < $Conf::cachedir/$file | cpio -i >/dev/null 2>&1");
logger("Decryption process returned the following: $return");
- if ($return != 1) { exit 1; }
+ if ($return != 0) { exit 1; }
}
sub getpak {
decryptpak("$pak");
my $return = system("cd $Conf::tmpdir && ./install.sh >> $Conf::logdir/install-$pak.log 2>&1");
+ $return %= 255;
if ($return == 0) {
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
cleanup("tmp");
system("rm -f $Conf::cachedir/counter* 2>/dev/null");
}
+sub lock {
+ my $status = shift;
+ if ("$status" eq "on") {
+ system("touch /opt/pakfire/pakfire.lock");
+ system("chmod 777 /opt/pakfire/pakfire.lock");
+ logger("Created lock");
+ } else {
+ if (system("rm -f /opt/pakfire/pakfire.lock >/dev/null 2>&1")) {
+ logger("Successfully removed lock.");
+ } else {
+ logger("Couldn't remove lock.");
+ }
+ }
+ return 0;
+}
+
+sub checkcryptodb {
+ my $myid = "64D96617"; # Our own gpg-key
+ my $trustid = "65D0FD58"; # Id of CaCert
+ my $ret = system("gpg --list-keys | grep -q $myid");
+ unless ( "$ret" eq "0" ) {
+ message("The GnuPG isn't configured corectly. Trying now to fix this.");
+ system("gpg --keyserver wwwkeys.de.pgp.net --always-trust --recv-key $myid");
+ system("gpg --keyserver wwwkeys.de.pgp.net --always-trust --recv-key $trustid");
+ }
+}
+
1;