mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 03:07:43 +02:00
Dem Silvio ein Applejuice/Java-Paket gebaut. Bitte testen.
Den Pakfire ein wenig weitergemacht... cURL-Libs in die ISO gepackt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@651 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -7,7 +7,7 @@ PROGS = iowrap
|
||||
SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \
|
||||
squidctrl restartssh ipfirereboot setaliases \
|
||||
ipsecctrl timectrl dhcpctrl snortctrl \
|
||||
restartapplejuice rebuildhosts \
|
||||
applejuicectrl rebuildhosts \
|
||||
restartsyslogd logwatch openvpnctrl outgoingfwctrl \
|
||||
restartwireless getipstat qosctrl launch-ether-wake \
|
||||
redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
|
||||
@@ -91,8 +91,8 @@ setfilters: setfilters.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
rebuildhosts: rebuildhosts.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ rebuildhosts.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
restartapplejuice: restartapplejuice.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ restartapplejuice.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
applejuicectrl: applejuicectrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ applejuicectrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
dhcpctrl: dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
44
src/misc-progs/applejuicectrl.c
Normal file
44
src/misc-progs/applejuicectrl.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* This file is part of the IPFire Firewall.
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include "setuid.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if (!(initsetuid()))
|
||||
exit(1);
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "\nNo argument given.\n\napplejuicectrl (start|stop|restart)\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "start") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/applejuice start");
|
||||
} else if (strcmp(argv[1], "stop") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/applejuice stop");
|
||||
} else if (strcmp(argv[1], "restart") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/applejuice restart");
|
||||
} else if (strcmp(argv[1], "enable") == 0) {
|
||||
safe_system("ln -fs ../init.d/applejuice /etc/rc.d/rc3.d/S99applejuice >/dev/null 2>&1");
|
||||
safe_system("ln -fs ../init.d/applejuice /etc/rc.d/rc0.d/K00applejuice >/dev/null 2>&1");
|
||||
safe_system("ln -fs ../init.d/applejuice /etc/rc.d/rc6.d/K00applejuice >/dev/null 2>&1");
|
||||
} else if (strcmp(argv[1], "disable") == 0) {
|
||||
safe_system("rm -f /etc/rc.d/rc*.d/*applejuice >/dev/null 2>&1");
|
||||
} else {
|
||||
fprintf(stderr, "\nBad argument given.\n\napplejuicectrl (start|stop|restart)\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/* IFire helper program - restartapplejuice
|
||||
*
|
||||
* Starts or stops the applejuice core
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include "setuid.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (!(initsetuid()))
|
||||
exit(1);
|
||||
|
||||
safe_system("/etc/init.d/applejuice stop");
|
||||
sleep(3);
|
||||
safe_system("/etc/init.d/applejuice start");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -28,8 +28,9 @@ sub logger {
|
||||
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(" <upgrade> - Installs the latest version of all paks.");
|
||||
&Pakfire::message(" <list> - Outputs a short list with all available paks.");
|
||||
&Pakfire::message("");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
@@ -80,12 +81,11 @@ sub fetchfile {
|
||||
my %proxysettings=();
|
||||
&General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
|
||||
|
||||
if ($_=$proxysettings{'UPSTREAM_PROXY'}) {
|
||||
my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
|
||||
if ($proxysettings{'UPSTREAM_PROXY'}) {
|
||||
if ($proxysettings{'UPSTREAM_USER'}) {
|
||||
$ua->proxy("http","http://$proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@"."$peer:$peerport/");
|
||||
$ua->proxy("http","http://$proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@"."$proxysettings{'UPSTREAM_PROXY'}/");
|
||||
} else {
|
||||
$ua->proxy("http","http://$peer:$peerport/");
|
||||
$ua->proxy("http","http://$proxysettings{'UPSTREAM_PROXY'}/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,7 @@ sub dblist {
|
||||
my $filter = shift;
|
||||
my $forweb = shift;
|
||||
my @meta;
|
||||
my @updatepaks;
|
||||
my $file;
|
||||
my $line;
|
||||
my $prog;
|
||||
@@ -247,6 +248,7 @@ sub dblist {
|
||||
foreach $prog (@db) {
|
||||
@templine = split(/\;/,$prog);
|
||||
if (("$name" eq "$templine[0]") && ("$release" < "$templine[2]" )) {
|
||||
push(@updatepaks,$name);
|
||||
if ("$forweb" eq "forweb") {
|
||||
print "<option value=\"$name\">Update: $name -- Version: $version -> $templine[1] -- Release: $release -> $templine[2]</option>\n";
|
||||
} else {
|
||||
@@ -255,6 +257,7 @@ sub dblist {
|
||||
}
|
||||
}
|
||||
}
|
||||
return @updatepaks;
|
||||
} else {
|
||||
my $line;
|
||||
my @templine;
|
||||
@@ -389,8 +392,8 @@ sub decryptpak {
|
||||
|
||||
my $file = getpak("$pak", "noforce");
|
||||
|
||||
my $return = system("cd $Conf::tmpdir/ && gpg -d < $Conf::cachedir/$file | cpio -i >/dev/null 2>&1");
|
||||
|
||||
my $return = system("cd $Conf::tmpdir/ && gpg -d < $Conf::cachedir/$file | tar x >/dev/null 2>&1");
|
||||
$return %= 255;
|
||||
logger("Decryption process returned the following: $return");
|
||||
if ($return != 0) { exit 1; }
|
||||
}
|
||||
@@ -438,7 +441,7 @@ sub setuppak {
|
||||
|
||||
decryptpak("$pak");
|
||||
|
||||
my $return = system("cd $Conf::tmpdir && ./install.sh >> $Conf::logdir/install-$pak.log 2>&1");
|
||||
my $return = system("cd $Conf::tmpdir && NAME=$pak ./install.sh >> $Conf::logdir/install-$pak.log 2>&1");
|
||||
$return %= 255;
|
||||
if ($return == 0) {
|
||||
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
|
||||
@@ -452,18 +455,20 @@ sub setuppak {
|
||||
return $return;
|
||||
}
|
||||
|
||||
sub updatepak {
|
||||
sub upgradepak {
|
||||
my $pak = shift;
|
||||
|
||||
message("We are going to update: $pak");
|
||||
message("We are going to upgrade: $pak");
|
||||
|
||||
decryptpak("$pak");
|
||||
|
||||
my $return = system("cd $Conf::tmpdir && ./update.sh >> $Conf::logdir/update-$pak.log 2>&1");
|
||||
my $return = system("cd $Conf::tmpdir && NAME=$pak ./update.sh >> $Conf::logdir/update-$pak.log 2>&1");
|
||||
$return %= 255;
|
||||
if ($return == 0) {
|
||||
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
|
||||
cleanup("tmp");
|
||||
message("Update completed. Congratulations!");
|
||||
copy("$Conf::dbdir/meta/meta-$pak","$Conf::dbdir/installed/");
|
||||
message("Upgrade completed. Congratulations!");
|
||||
} else {
|
||||
message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem.");
|
||||
exit $return;
|
||||
@@ -478,7 +483,8 @@ sub removepak {
|
||||
|
||||
decryptpak("$pak");
|
||||
|
||||
my $return = system("cd $Conf::tmpdir && ./uninstall.sh >> $Conf::logdir/uninstall-$pak.log 2>&1");
|
||||
my $return = system("cd $Conf::tmpdir && NAME=$pak ./uninstall.sh >> $Conf::logdir/uninstall-$pak.log 2>&1");
|
||||
$return %= 255;
|
||||
if ($return == 0) {
|
||||
open(FILE, "<$Conf::dbdir/rootfiles/$pak");
|
||||
my @file = <FILE>;
|
||||
@@ -530,7 +536,7 @@ sub makeuuid {
|
||||
}
|
||||
|
||||
sub senduuid {
|
||||
if ($pakfiresettings{'UUID'} eq "on") {
|
||||
if ($pakfiresettings{'UUID'} ne "off") {
|
||||
unless("$Conf::uuid") {
|
||||
$Conf::uuid = `cat $Conf::dbdir/uuid`;
|
||||
}
|
||||
|
||||
@@ -30,27 +30,42 @@
|
||||
if ("$ARGV[0]" eq "install") {
|
||||
&Pakfire::lock("on");
|
||||
shift;
|
||||
|
||||
### Make sure that the list is not outdated.
|
||||
&Pakfire::dbgetlist("noforce");
|
||||
|
||||
open(FILE, "<$Conf::dbdir/lists/packages_list.db");
|
||||
my @db = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
my $dep;
|
||||
my @deps;
|
||||
my $pak;
|
||||
my @paks;
|
||||
my @temp;
|
||||
my @templine;
|
||||
my $found = 0;
|
||||
my @all;
|
||||
foreach (@ARGV) {
|
||||
unless ("$_" =~ "^-") {
|
||||
push(@paks,$_) if $_;
|
||||
foreach $pak (@ARGV) {
|
||||
unless ("$pak" =~ "^-") {
|
||||
$found = 0;
|
||||
foreach (@db) {
|
||||
@templine = split(/;/,$_);
|
||||
if ("$templine[0]" eq "$pak" ) {
|
||||
push(@paks,$pak);
|
||||
push(@all,$pak);
|
||||
@temp = &Pakfire::resolvedeps("$pak");
|
||||
foreach $dep (@temp) {
|
||||
push(@deps,$dep) if $dep;
|
||||
push(@all,$dep) if $dep;
|
||||
}
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
&Pakfire::message("\nThe pak \"$pak\" is not known. Please try running \"pakfire update\".") if ($found == 0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (@paks) {
|
||||
@temp = &Pakfire::resolvedeps("$_");
|
||||
foreach (@temp) { push(@deps,$_) if $_; }
|
||||
}
|
||||
|
||||
foreach (@paks) {
|
||||
push(@all,$_) if $_;
|
||||
}
|
||||
foreach (@deps) {
|
||||
push(@all,$_) if $_;
|
||||
}
|
||||
|
||||
&Pakfire::message("\n\n### Packages to install:");
|
||||
foreach (sort @paks) {
|
||||
@@ -108,7 +123,38 @@
|
||||
|
||||
|
||||
} elsif ("$ARGV[0]" eq "upgrade") {
|
||||
&Pakfire::dblist("upgrade", "noweb");
|
||||
my @upgradepaks = &Pakfire::dblist("upgrade", "noweb");
|
||||
my @temp;
|
||||
|
||||
foreach (@upgradepaks) {
|
||||
@temp = &Pakfire::resolvedeps("$_");
|
||||
foreach (@temp) { push(@upgradepaks,$_) if $_; }
|
||||
}
|
||||
|
||||
if (@upgradepaks) {
|
||||
&Pakfire::message("");
|
||||
&Pakfire::message("We are going to install all packages listed above.");
|
||||
if ($interactive) {
|
||||
&Pakfire::message("Is this okay? [y/N]");
|
||||
my $ret = <STDIN>;
|
||||
chomp($ret);
|
||||
&Pakfire::logger("Answer: $ret");
|
||||
if ( $ret ne "y" ) {
|
||||
&Pakfire::message("Installation aborted.");
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### Download first
|
||||
foreach (sort @upgradepaks) {
|
||||
&Pakfire::message("# --> Downloading: $_");
|
||||
&Pakfire::getpak("$_", "");
|
||||
}
|
||||
|
||||
foreach (sort @upgradepaks) {
|
||||
&Pakfire::upgradepak("$_");
|
||||
}
|
||||
|
||||
} elsif ("$ARGV[0]" eq "list") {
|
||||
&Pakfire::dblist("all", "noweb");
|
||||
@@ -122,3 +168,5 @@
|
||||
} else {
|
||||
&Pakfire::usage;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
4
src/paks/applejuice/install.sh
Normal file
4
src/paks/applejuice/install.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
|
||||
extract_files
|
||||
2
src/paks/applejuice/uninstall.sh
Normal file
2
src/paks/applejuice/uninstall.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
|
||||
0
src/paks/applejuice/update.sh
Normal file
0
src/paks/applejuice/update.sh
Normal file
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
clamavctrl disable
|
||||
/usr/local/bin/clamavctrl disable
|
||||
|
||||
4
src/paks/java/install.sh
Normal file
4
src/paks/java/install.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
|
||||
extract_files
|
||||
2
src/paks/java/uninstall.sh
Normal file
2
src/paks/java/uninstall.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
|
||||
0
src/paks/java/update.sh
Normal file
0
src/paks/java/update.sh
Normal file
Reference in New Issue
Block a user