Am Pakfire weitergearbeitet.

CGI erweitert und mit neuen Funktionen versehen.
Paketformat grundlegend geaendert.
UpdateBooster gefixt.
Avira+Avast als Updatequelle eingefuegt.
VPN-Watch ins log.dat.
DHCP-Server startet nach der Installation.
Einen String im Installer verschoenert :D


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@639 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-06-19 18:40:52 +00:00
parent afabe9f7d1
commit 5b2a12ff8a
21 changed files with 469 additions and 332 deletions

View File

@@ -5,7 +5,7 @@ background = ffffff
gfxmenu /grub/message
title IPFire (1024x768)
root (hd0,0)
kernel /vmlinuz-ipfire root=ROOT panic=10 vga=791 splash=silent MOUNT
kernel /vmlinuz-ipfire root=ROOT panic=10 vga=791 MOUNT
initrd /ipfirerd.img
savedefault 0
title IPFire (VESA)
@@ -15,7 +15,7 @@ title IPFire (VESA)
savedefault 1
title IPFire SMP (1024x768)
root (hd0,0)
kernel /vmlinuz-ipfire-smp root=ROOT panic=10 acpi=off vga=791 splash=silent MOUNT
kernel /vmlinuz-ipfire-smp root=ROOT panic=10 acpi=off vga=791 MOUNT
initrd /ipfirerd-smp.img
savedefault 2
title IPFire SMP (VESA)
@@ -25,7 +25,7 @@ title IPFire SMP (VESA)
savedefault 3
title IPFire SMP-HT (Intel Pentium 4) (1024x768)
root (hd0,0)
kernel /vmlinuz-ipfire-smp root=ROOT panic=10 acpi=ht vga=791 splash=silent MOUNT
kernel /vmlinuz-ipfire-smp root=ROOT panic=10 acpi=ht vga=791 MOUNT
initrd /ipfirerd-smp.img
savedefault 4
title IPFire SMP-HT (Intel Pentium 4) (VESA)

View File

@@ -9,9 +9,8 @@
use strict;
my $apphome="/var/ipfire/updatexlrator";
my $logfile="/var/log/updatexlrator/download.log";
my $debug=(-e "$apphome/debug");
my $debug = 0;
my $updcachedir="/srv/web/ipfire/html/updatecache";
my $updfile='';
my @metadata=();
@@ -30,10 +29,10 @@ $updfile = substr($dsturl,rindex($dsturl,"/")+1);
if ($debug)
{
&writelog("Retrieving file for local cache: $updfile");
`$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl >>$logfile 2>&1`;
`/usr/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl >>$logfile 2>&1`;
} else
{
`$apphome/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl 2>&1`;
`/usr/bin/wget -nc -nd -nv -P $updcachedir/download $dsturl 2>&1`;
}
if ($debug) { &writelog("Moving file into the cache directory -> \"$updcachedir/$updfile\""); }

View File

@@ -107,8 +107,26 @@ while (<>) {
{
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Symantec");
}
# -----------------------------------------------------------
# Section: Avira Downloads
# -----------------------------------------------------------
if ($dsturl =~ m@^http://dl[0-9]\.avgate\.net/.*\.(htm|html|gz)$@i)
{
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Avira");
}
# -----------------------------------------------------------
# Section: Avast Downloads
# -----------------------------------------------------------
if ($dsturl =~ m@^http://download[0-99]\.avast\.com/.*\.(exe|zip|vps|stamp|vpu)$@i)
{
$from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Avast");
}
# -----------------------------------------------------------
}

View File

@@ -389,3 +389,6 @@ WARNING: translation string unused: xtaccess bad transfert
WARNING: translation string unused: year
WARNING: translation string unused: yearly firewallhits
WARNING: untranslated string: OVPN
WARNING: untranslated string: abort
WARNING: untranslated string: aktiv
WARNING: untranslated string: reload

View File

@@ -392,3 +392,6 @@ WARNING: translation string unused: written sectors
WARNING: translation string unused: year
WARNING: translation string unused: yearly firewallhits
WARNING: untranslated string: OVPN
WARNING: untranslated string: abort
WARNING: untranslated string: aktiv
WARNING: untranslated string: reload

View File

@@ -62,7 +62,7 @@ my %sections = (
'ssh' => '(sshd(?:\(.*\))?\[.*\])',
'auth' => '(\w+\(pam_unix\)\[.*\])',
'kernel' => '(kernel)',
'ipsec' => '(ipsec_[\w_]+|pluto\[.*\])',
'ipsec' => '(ipsec_[\w_]+|pluto\[.*\]|vpnwatch)',
'snort' => '(snort)',
'openvpn' => '(openvpnserver)\[.*\]'
);

View File

@@ -6,9 +6,6 @@
#
# This code is distributed under the terms of the GPL
#
# (c) Eric Oberlander June 2002
#
# (c) Darren Critchley June 2003 - added real time clock setting, etc
#
use strict;
@@ -24,8 +21,6 @@ require "/opt/pakfire/lib/functions.pl";
my %pakfiresettings=();
my $errormessage = '';
my @instlist = `ls /opt/pakfire/cache`;
my $uninstall = 'yes';
&Header::showhttpheaders();
@@ -42,20 +37,53 @@ $pakfiresettings{'AUTOUPDATE'} = '';
&Header::openbigbox('100%', 'left', '', $errormessage);
if ($pakfiresettings{'ACTION'} eq 'install'){
print "Going to install $pakfiresettings{'INSPAKS'}";
system("/opt/pakfire/pakfire installi $pakfiresettings{'INSPAKS'}")
}elsif ($pakfiresettings{'ACTION'} eq 'remove'){
foreach (@instlist){
my @pakname = split(/-/,$_);
my $dependency = `grep "Dependencies.*$pakfiresettings{'DELPAKS'}" /opt/pakfire/db/meta/*$pakname[0]`;
if ($dependency){$errormessage = "We have depending Paket $pakname[0] nothing will be done.<br />";$uninstall='no';last;}else{$uninstall='yes';}
}
if ($uninstall eq 'yes'){
print "Going to uninstall $pakfiresettings{'DELPAKS'}";
system("/opt/pakfire/pakfire uninstalli $pakfiresettings{'DELPAKS'}")
}
} elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}")
{
if ("$pakfiresettings{'FORCE'}" eq "on") {
system("/usr/local/bin/pakfire", "install", "--non-interactive", "$pakfiresettings{'INSPAKS'}", "&");
sleep(1);
} else {
&Header::openbox("100%", "center", "Abfrage");
my @output = `/usr/local/bin/pakfire resolvedeps $pakfiresettings{'INSPAKS'}`;
print <<END;
<table><tr><td colspan='2'>Sie maechten folgende Pakete installieren: $pakfiresettings{'INSPAKS'}. Moeglicherweise haben diese Pakete Abhaengigkeiten, d.h. andere Pakete muessen zusaetzlich installiert werden. Dazu sehen sie unten eine Liste.
<pre>
END
foreach (@output) {
print "$_\n";
}
print <<END;
</pre>
<tr><td colspan='2'>Moechten Sie der Installation aller Pakete zustimmen?
<tr><td colspan='2'>&nbsp;
<tr><td align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='INSPAKS' value='$pakfiresettings{'INSPAKS'}' />
<input type='hidden' name='FORCE' value='on' />
<input type='hidden' name='ACTION' value='install' />
<input type='image' alt='$Lang::tr{'install'}' src='/images/go-next.png' />
</form>
<td align='left'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='' />
<input type='image' alt='$Lang::tr{'abort'}' src='/images/dialog-error.png' />
</form>
</table>
END
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit;
}
} elsif ($pakfiresettings{'ACTION'} eq 'remove') {
} elsif ($pakfiresettings{'ACTION'} eq 'update') {
system("/usr/local/bin/pakfire update --force");
} elsif ($pakfiresettings{'ACTION'} eq 'unlock') {
&Pakfire::lock("off");
} elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {
&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
}
@@ -73,7 +101,30 @@ if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<font class='base'>$errormessage&nbsp;</font>\n";
&Header::closebox();
}
}
if ( -e "/opt/pakfire/pakfire.lock" ) {
&Header::openbox("100%", "center", "Aktiv");
print <<END;
<table>
<tr><td>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='unlock' />
<input type='image' src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' />&nbsp;
</form>
<td>
Pakfire fuehrt gerade eine Aufgabe aus... Bitte warten sie, bis diese erfolgreich beendet wurde.
<tr><td colspan='2' align='center'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'reload'}' src='/images/view-refresh.png' />
</form>
</table>
END
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit;
}
&Header::openbox("100%", "center", "Pakfire");
@@ -94,6 +145,7 @@ print <<END;
</form><br />
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='update' />
<input type='submit' value='Liste aktualisieren' /><br />
</form>
@@ -104,11 +156,10 @@ print <<END;
<td width='40%' align="center">Installierte Addons:<br />
<select name="DELPAKS" size="10" multiple>
END
foreach (@instlist){
my @pakname = split(/-/,$_);
print "<option value='$pakname[0]'>$pakname[0]</option>";
}
print <<END;
&Pakfire::dblist("installed", "forweb");
print <<END;
</select>
</table></form>
<br /><hr /><br />

View File

@@ -175,7 +175,7 @@ if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr save and restart'})
&savesettings;
system('/usr/local/bin/restartsquid');
system('/usr/local/bin/squidctrl restart');
}
if ($xlratorsettings{'ACTION'} eq $Lang::tr{'updxlrtr remove file'})
@@ -456,6 +456,12 @@ END
} elsif ($metadata[1] eq 'Symantec')
{
print "<img src='/images/updxl-src-symantec.gif' alt='Symantec'}' />&nbsp;</td>\n";
} elsif ($metadata[1] eq 'Avira')
{
print "<img src='/images/updxl-src-avira.gif' alt='Avira'}' />&nbsp;</td>\n";
} elsif ($metadata[1] eq 'Avast')
{
print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
} else
{
print "<img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' />&nbsp;</td>\n";
@@ -538,6 +544,16 @@ print <<END
<td align='center'><img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' /></td>
<td class='base'>$Lang::tr{'updxlrtr unknown'}</td>
</tr>
<tr>
<td class='base' colspan='2'>&nbsp;</td>
<td align='center'><img src='/images/updxl-src-avast.gif' alt='Avast' /></td>
<td class='base'>Avast</td>
<td class='base'>&nbsp;</td>
<td align='center'><img src='/images/updxl-src-avira.gif' alt='Avira' /></td>
<td class='base'>Avira</td>
<td class='base'>&nbsp;</td>
<td class='base' colspan='5'>&nbsp;</td>
</tr>
</table>
END
;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -40,7 +40,7 @@ char *de_tr[] = {
/* TR_AUTODETECT */
"* AUTOMATISCHE ERKENNUNG *",
/* TR_BUILDING_INITRD */
"Erzeuge INITRD...",
"Erzeuge Ramdisk...",
/* TR_CANCEL */
"Abbrechen",
/* TR_CARD_ASSIGNMENT */

View File

@@ -36,7 +36,7 @@ char *en_tr[] = {
/* TR_AUTODETECT */
"* AUTODETECT *",
/* TR_BUILDING_INITRD */
"Building INITRD...",
"Building ramdisk...",
/* TR_CANCEL */
"Cancel",
/* TR_CARD_ASSIGNMENT */

View File

@@ -157,21 +157,14 @@ endef
define PAK
# Bringing the files to their right place.
@rm -rf /install/packages/package /tmp/* /packagetmp.tar
@rm -rf /install/packages/package
@mkdir -p /install/packages/package
@cp -f /usr/src/src/paks/$(PROG)/{,un}install.sh /install/packages/package
@cp -f /usr/src/src/paks/$(PROG)/update.sh /install/packages/package
@cp -f /usr/src/config/rootfiles/packages/$(PROG) /install/packages/package/ROOTFILES
@cp -f /usr/src/src/paks/$(PROG)/{,un}install.sh /usr/src/src/paks/$(PROG)/update.sh \
/install/packages/package
-grep -v "#" < /usr/src/config/rootfiles/packages/$(PROG) > /install/packages/package/ROOTFILES
@chmod 755 /install/packages/package/{,un}install.sh
cd / && tar --create --directory=/ --files-from=/install/packages/package/ROOTFILES \
--file=/packagetmp.tar --exclude='#*'
cd / && tar -x -C /tmp -f /packagetmp.tar
rm -f /packagetmp.tar
cd /tmp && tar cjvf /install/packages/package/files.tbz2 *
cd / && rm -rf /tmp/*
-cd /install/packages/package && cat ROOTFILES | grep -v "#" > ROOTFILES
cd /install/packages/package && tar cfj ../$(PROG)-$(VER)-$(PAK_VER).ipfire \
files.tbz2 install.sh uninstall.sh update.sh ROOTFILES
@cd / && cpio -o < /install/packages/package/ROOTFILES > /install/packages/package/files
cd /install/packages/package && cpio -o < /usr/src/src/paks/files > ../$(PROG)-$(VER)-$(PAK_VER).ipfire
rm -rf /install/packages/package
sed -e s/NAME/$(PROG)/g \
-e s/VER/$(VER)/g \

View File

@@ -38,7 +38,7 @@ PAK_VER = 1
DESCDE = "MP3Blaster ist kleine Software um Musik abzuspielen."
DESCEN = "MP3Blaster is piece of software that plays your music on the box."
DEPS = "libvorbis"
DEPS = "alsa libvorbis"
###############################################################################
# Top-level Rules

View File

@@ -36,6 +36,8 @@ TARGET = $(DIR_INFO)/$(THISAPP)
PROG = mpg123
PAK_VER = 1
DEPS = "alsa"
###############################################################################
# Top-level Rules
###############################################################################

View File

@@ -1,262 +1,262 @@
/* SmoothWall setup program.
*
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
* (c) Lawrence Manning, 2001
* Stuff for setting up the DHCP server from the setup prog.
*
* $Id: dhcp.c,v 1.9.2.3 2004/12/03 06:46:50 eoberlander Exp $
*
*/
#include "setup.h"
#define TOP 4
#define START_ADDRESS 0
#define END_ADDRESS 1
#define PRIMARY_DNS 2
#define SECONDARY_DNS 3
#define DEFAULT_LEASE_TIME 4
#define MAX_LEASE_TIME 5
#define DOMAIN_NAME_SUFFIX 6
#define MAX_BOXES 7
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
newtComponent dhcpform;
newtComponent entries[MAX_BOXES];
newtComponent enabledcheckbox;
void dhcpdialogcallbackdhcp(newtComponent cm, void *data);
int handledhcp(void)
{
char *results[MAX_BOXES];
char enabledresult;
char startenabled;
struct newtExitStruct es;
newtComponent header;
newtComponent labels[MAX_BOXES];
newtComponent ok, cancel;
char message[1000];
char *labeltexts[MAX_BOXES] = { ctr[TR_START_ADDRESS], ctr[TR_END_ADDRESS],
ctr[TR_PRIMARY_DNS], ctr[TR_SECONDARY_DNS], ctr[TR_DEFAULT_LEASE],
ctr[TR_MAX_LEASE], ctr[TR_DOMAIN_NAME_SUFFIX] };
char *varnames[MAX_BOXES] = { "START_ADDR_GREEN", "END_ADDR_GREEN",
"DNS1_GREEN", "DNS2_GREEN",
"DEFAULT_LEASE_TIME_GREEN", "MAX_LEASE_TIME_GREEN",
"DOMAIN_NAME_GREEN"};
char defaults[MAX_BOXES][STRING_SIZE];
int result;
int c;
char temp[STRING_SIZE];
struct keyvalue *mainkv = initkeyvalues();
struct keyvalue *dhcpkv = initkeyvalues();
struct keyvalue *ethernetkv = initkeyvalues();
int error;
FILE *file;
char greenaddress[STRING_SIZE];
char greennetaddress[STRING_SIZE];
char greennetmask[STRING_SIZE];
memset(defaults, 0, sizeof(char) * STRING_SIZE * MAX_BOXES);
if (!(readkeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
if (!(readkeyvalues(ethernetkv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
freekeyvalues(mainkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
/* Set default values. */
findkey(ethernetkv, "GREEN_ADDRESS", defaults[PRIMARY_DNS]);
findkey(mainkv, "DOMAINNAME", defaults[DOMAIN_NAME_SUFFIX]);
strcpy(defaults[DEFAULT_LEASE_TIME], "60");
strcpy(defaults[MAX_LEASE_TIME], "120");
sprintf(message, ctr[TR_DHCP_SERVER_CONFIGURATION]);
newtCenteredWindow(55, 18, message);
dhcpform = newtForm(NULL, NULL, 0);
sprintf(message, ctr[TR_CONFIGURE_DHCP]);
header = newtTextboxReflowed(1, 1, message, 52, 0, 0, 0);
newtFormAddComponent(dhcpform, header);
strcpy(temp, ""); findkey(dhcpkv, "ENABLE_GREEN", temp);
if (strcmp(temp, "on") == 0)
startenabled = '*';
else
startenabled = ' ';
enabledcheckbox = newtCheckbox(2, TOP + 0, ctr[TR_ENABLED], startenabled, " *", &enabledresult);
newtFormAddComponent(dhcpform, enabledcheckbox);
newtComponentAddCallback(enabledcheckbox, dhcpdialogcallbackdhcp, NULL);
for (c = 0; c < MAX_BOXES; c++)
{
labels[c] = newtTextbox(2, TOP + 2 + c, 33, 1, 0);
newtTextboxSetText(labels[c], labeltexts[c]);
newtFormAddComponent(dhcpform, labels[c]);
strcpy(temp, defaults[c]); findkey(dhcpkv, varnames[c], temp);
entries[c] = newtEntry(34, TOP + 2 + c, temp, 18, &results[c], 0);
newtFormAddComponent(dhcpform, entries[c]);
if (startenabled == ' ')
newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
}
ok = newtButton(10, c + 7, ctr[TR_OK]);
cancel = newtButton(34, c + 7, ctr[TR_CANCEL]);
newtFormAddComponents(dhcpform, ok, cancel, NULL);
do
{
error = 0;
newtFormRun(dhcpform, &es);
if (es.u.co == ok)
{
/* OK was pressed; verify the contents of each entry. */
if (enabledresult == '*')
{
strcpy(message, ctr[TR_INVALID_FIELDS]);
if (inet_addr(results[START_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_START_ADDRESS_CR]);
error = 1;
}
if (inet_addr(results[END_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_END_ADDRESS_CR]);
error = 1;
}
if (strlen(results[SECONDARY_DNS]))
{
if (inet_addr(results[PRIMARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_PRIMARY_DNS_CR]);
error = 1;
}
}
if (strlen(results[SECONDARY_DNS]))
{
if (inet_addr(results[SECONDARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_SECONDARY_DNS_CR]);
error = 1;
}
}
if (!(atol(results[DEFAULT_LEASE_TIME])))
{
strcat(message, ctr[TR_DEFAULT_LEASE_CR]);
error = 1;
}
if (!(atol(results[MAX_LEASE_TIME])))
{
strcat(message, ctr[TR_MAX_LEASE_CR]);
error = 1;
}
}
if (error)
errorbox(message);
else
{
for (c = 0; c < MAX_BOXES; c++)
replacekeyvalue(dhcpkv, varnames[c], results[c]);
if (enabledresult == '*')
{
replacekeyvalue(dhcpkv, "ENABLE_GREEN", "on");
fclose(fopen(CONFIG_ROOT "/dhcp/enable_green", "w"));
chown(CONFIG_ROOT "/dhcp/enable_green", 99, 99);
}
else
{
replacekeyvalue(dhcpkv, "ENABLE_GREEN", "off");
unlink(CONFIG_ROOT "/dhcp/enable_green");
}
replacekeyvalue(dhcpkv, "VALID", "yes");
writekeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings");
findkey(ethernetkv, "GREEN_ADDRESS", greenaddress);
findkey(ethernetkv, "GREEN_NETADDRESS", greennetaddress);
findkey(ethernetkv, "GREEN_NETMASK", greennetmask);
file = fopen(CONFIG_ROOT "/dhcp/dhcpd.conf", "w");
fprintf(file, "ddns-update-style none;\n");
fprintf(file, "subnet %s netmask %s\n", greennetaddress, greennetmask);
fprintf(file, "{\n");
fprintf(file, "\toption subnet-mask %s;\n", greennetmask);
fprintf(file, "\toption domain-name \"%s\";\n", results[DOMAIN_NAME_SUFFIX]);
fprintf(file, "\toption routers %s;\n", greenaddress);
if (strlen(results[PRIMARY_DNS]))
{
fprintf(file, "\toption domain-name-servers ");
fprintf(file, "%s", results[PRIMARY_DNS]);
if (strlen(results[SECONDARY_DNS]))
fprintf(file, ", %s", results[SECONDARY_DNS]);
fprintf(file, ";\n");
}
fprintf(file, "\trange %s %s;\n", results[START_ADDRESS], results[END_ADDRESS]);
fprintf(file, "\tdefault-lease-time %d;\n", (int) atol(results[DEFAULT_LEASE_TIME]) * 60);
fprintf(file, "\tmax-lease-time %d;\n", (int) atol(results[MAX_LEASE_TIME]) * 60);
fprintf(file, "}\n");
fclose(file);
chown(CONFIG_ROOT "/dhcp/dhcpd.conf", 99, 99);
if (automode == 0)
mysystem("/usr/local/bin/restartdhcp");
}
result = 1;
}
else
result = 0;
}
while (error);
newtFormDestroy(dhcpform);
newtPopWindow();
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
freekeyvalues(mainkv);
return result;
}
/* Called when enabled flag is toggled. Toggle disabled state of other 3
* controls. */
void dhcpdialogcallbackdhcp(newtComponent cm, void *data)
{
int c;
for (c = 0; c < MAX_BOXES; c++)
newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_TOGGLE);
newtRefresh();
newtDrawForm(dhcpform);
}
/* SmoothWall setup program.
*
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
* (c) Lawrence Manning, 2001
* Stuff for setting up the DHCP server from the setup prog.
*
*/
#include "setup.h"
#define TOP 4
#define START_ADDRESS 0
#define END_ADDRESS 1
#define PRIMARY_DNS 2
#define SECONDARY_DNS 3
#define DEFAULT_LEASE_TIME 4
#define MAX_LEASE_TIME 5
#define DOMAIN_NAME_SUFFIX 6
#define MAX_BOXES 7
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
newtComponent dhcpform;
newtComponent entries[MAX_BOXES];
newtComponent enabledcheckbox;
void dhcpdialogcallbackdhcp(newtComponent cm, void *data);
int handledhcp(void)
{
char *results[MAX_BOXES];
char enabledresult;
char startenabled;
struct newtExitStruct es;
newtComponent header;
newtComponent labels[MAX_BOXES];
newtComponent ok, cancel;
char message[1000];
char *labeltexts[MAX_BOXES] = { ctr[TR_START_ADDRESS], ctr[TR_END_ADDRESS],
ctr[TR_PRIMARY_DNS], ctr[TR_SECONDARY_DNS], ctr[TR_DEFAULT_LEASE],
ctr[TR_MAX_LEASE], ctr[TR_DOMAIN_NAME_SUFFIX] };
char *varnames[MAX_BOXES] = { "START_ADDR_GREEN", "END_ADDR_GREEN",
"DNS1_GREEN", "DNS2_GREEN",
"DEFAULT_LEASE_TIME_GREEN", "MAX_LEASE_TIME_GREEN",
"DOMAIN_NAME_GREEN"};
char defaults[MAX_BOXES][STRING_SIZE];
int result;
int c;
char temp[STRING_SIZE];
struct keyvalue *mainkv = initkeyvalues();
struct keyvalue *dhcpkv = initkeyvalues();
struct keyvalue *ethernetkv = initkeyvalues();
int error;
FILE *file;
char greenaddress[STRING_SIZE];
char greennetaddress[STRING_SIZE];
char greennetmask[STRING_SIZE];
memset(defaults, 0, sizeof(char) * STRING_SIZE * MAX_BOXES);
if (!(readkeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
if (!(readkeyvalues(ethernetkv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
freekeyvalues(mainkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
return 0;
}
/* Set default values. */
findkey(ethernetkv, "GREEN_ADDRESS", defaults[PRIMARY_DNS]);
findkey(mainkv, "DOMAINNAME", defaults[DOMAIN_NAME_SUFFIX]);
strcpy(defaults[DEFAULT_LEASE_TIME], "60");
strcpy(defaults[MAX_LEASE_TIME], "120");
sprintf(message, ctr[TR_DHCP_SERVER_CONFIGURATION]);
newtCenteredWindow(55, 18, message);
dhcpform = newtForm(NULL, NULL, 0);
sprintf(message, ctr[TR_CONFIGURE_DHCP]);
header = newtTextboxReflowed(1, 1, message, 52, 0, 0, 0);
newtFormAddComponent(dhcpform, header);
strcpy(temp, ""); findkey(dhcpkv, "ENABLE_GREEN", temp);
if (strcmp(temp, "on") == 0)
startenabled = '*';
else
startenabled = ' ';
enabledcheckbox = newtCheckbox(2, TOP + 0, ctr[TR_ENABLED], startenabled, " *", &enabledresult);
newtFormAddComponent(dhcpform, enabledcheckbox);
newtComponentAddCallback(enabledcheckbox, dhcpdialogcallbackdhcp, NULL);
for (c = 0; c < MAX_BOXES; c++)
{
labels[c] = newtTextbox(2, TOP + 2 + c, 33, 1, 0);
newtTextboxSetText(labels[c], labeltexts[c]);
newtFormAddComponent(dhcpform, labels[c]);
strcpy(temp, defaults[c]); findkey(dhcpkv, varnames[c], temp);
entries[c] = newtEntry(34, TOP + 2 + c, temp, 18, &results[c], 0);
newtFormAddComponent(dhcpform, entries[c]);
if (startenabled == ' ')
newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
}
ok = newtButton(10, c + 7, ctr[TR_OK]);
cancel = newtButton(34, c + 7, ctr[TR_CANCEL]);
newtFormAddComponents(dhcpform, ok, cancel, NULL);
do
{
error = 0;
newtFormRun(dhcpform, &es);
if (es.u.co == ok)
{
/* OK was pressed; verify the contents of each entry. */
if (enabledresult == '*')
{
strcpy(message, ctr[TR_INVALID_FIELDS]);
if (inet_addr(results[START_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_START_ADDRESS_CR]);
error = 1;
}
if (inet_addr(results[END_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_END_ADDRESS_CR]);
error = 1;
}
if (strlen(results[SECONDARY_DNS]))
{
if (inet_addr(results[PRIMARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_PRIMARY_DNS_CR]);
error = 1;
}
}
if (strlen(results[SECONDARY_DNS]))
{
if (inet_addr(results[SECONDARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_SECONDARY_DNS_CR]);
error = 1;
}
}
if (!(atol(results[DEFAULT_LEASE_TIME])))
{
strcat(message, ctr[TR_DEFAULT_LEASE_CR]);
error = 1;
}
if (!(atol(results[MAX_LEASE_TIME])))
{
strcat(message, ctr[TR_MAX_LEASE_CR]);
error = 1;
}
}
if (error)
errorbox(message);
else
{
for (c = 0; c < MAX_BOXES; c++)
replacekeyvalue(dhcpkv, varnames[c], results[c]);
if (enabledresult == '*')
{
replacekeyvalue(dhcpkv, "ENABLE_GREEN", "on");
fclose(fopen(CONFIG_ROOT "/dhcp/enable_green", "w"));
chown(CONFIG_ROOT "/dhcp/enable_green", 99, 99);
mysystem("/usr/local/bin/dhcpctrl enable");
}
else
{
replacekeyvalue(dhcpkv, "ENABLE_GREEN", "off");
unlink(CONFIG_ROOT "/dhcp/enable_green");
mysystem("/usr/local/bin/dhcpctrl disable");
}
replacekeyvalue(dhcpkv, "VALID", "yes");
writekeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings");
findkey(ethernetkv, "GREEN_ADDRESS", greenaddress);
findkey(ethernetkv, "GREEN_NETADDRESS", greennetaddress);
findkey(ethernetkv, "GREEN_NETMASK", greennetmask);
file = fopen(CONFIG_ROOT "/dhcp/dhcpd.conf", "w");
fprintf(file, "ddns-update-style none;\n");
fprintf(file, "subnet %s netmask %s\n", greennetaddress, greennetmask);
fprintf(file, "{\n");
fprintf(file, "\toption subnet-mask %s;\n", greennetmask);
fprintf(file, "\toption domain-name \"%s\";\n", results[DOMAIN_NAME_SUFFIX]);
fprintf(file, "\toption routers %s;\n", greenaddress);
if (strlen(results[PRIMARY_DNS]))
{
fprintf(file, "\toption domain-name-servers ");
fprintf(file, "%s", results[PRIMARY_DNS]);
if (strlen(results[SECONDARY_DNS]))
fprintf(file, ", %s", results[SECONDARY_DNS]);
fprintf(file, ";\n");
}
fprintf(file, "\trange %s %s;\n", results[START_ADDRESS], results[END_ADDRESS]);
fprintf(file, "\tdefault-lease-time %d;\n", (int) atol(results[DEFAULT_LEASE_TIME]) * 60);
fprintf(file, "\tmax-lease-time %d;\n", (int) atol(results[MAX_LEASE_TIME]) * 60);
fprintf(file, "}\n");
fclose(file);
chown(CONFIG_ROOT "/dhcp/dhcpd.conf", 99, 99);
if (automode == 0)
mysystem("/usr/local/bin/dhcpctrl enable");
}
result = 1;
}
else
result = 0;
}
while (error);
newtFormDestroy(dhcpform);
newtPopWindow();
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
freekeyvalues(mainkv);
return result;
}
/* Called when enabled flag is toggled. Toggle disabled state of other 3
* controls. */
void dhcpdialogcallbackdhcp(newtComponent cm, void *data)
{
int c;
for (c = 0; c < MAX_BOXES; c++)
newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_TOGGLE);
newtRefresh();
newtDrawForm(dhcpform);
}

View File

@@ -15,19 +15,18 @@
int main(int argc, char *argv[]) {
int i;
char command; // Add size here
char add; // Add size here
char command[1024];
char add[STRING_SIZE];
if (!(initsetuid()))
exit(1);
sprintf(command, "/opt/pakfire/pakfire");
snprintf(command, STRING_SIZE, "/opt/pakfire/pakfire");
for (i = 0; i < argc - 1; i++) {
for (i = 1; i < argc; i++) {
sprintf(add, " %s", argv[i]);
strcat(command, add);
}
return safe_system(command);
}

View File

@@ -21,6 +21,14 @@ sub logger {
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;
@@ -163,7 +171,7 @@ sub dbgetlist {
}
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");
}
@@ -188,7 +196,11 @@ sub dblist {
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 {
@@ -471,4 +483,20 @@ sub senduuid {
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;
}
1;

View File

@@ -16,19 +16,21 @@
}
unless (@ARGV) {
&Pakfire::message("Usage: pakfire <install|remove> <pak(s)>");
&Pakfire::message(" <update>");
&Pakfire::message(" <upgrade>");
exit 1;
&Pakfire::usage;
}
if ("$ARGV[0]" eq "install") {
&Pakfire::lock("on");
shift;
my @deps;
my @paks;
my @temp;
foreach (@ARGV) {
push(@paks,$_);
if ("$_" =~ "^--") {
$interactive = 0 if ("$_" eq "--non-interactive");
} else {
push(@paks,$_);
}
}
foreach (@paks) {
@temp = &Pakfire::resolvedeps("$_");
@@ -71,10 +73,6 @@
exit 1;
}
}
&Pakfire::message("### Installing all packages:");
foreach (sort @all) { &Pakfire::message("# --> $_"); }
&Pakfire::message("");
### Download first
foreach (sort @all) {
@@ -85,16 +83,28 @@
foreach (sort @all) {
&Pakfire::setuppak("$_");
}
&Pakfire::lock("off");
} elsif ("$ARGV[0]" eq "remove") {
} elsif ("$ARGV[0]" eq "update") {
my $force = "noforce";
&Pakfire::makeuuid();
&Pakfire::senduuid();
&Pakfire::getmirrors();
$force = "force" if ("$ARGV[1]" eq "--force");
&Pakfire::dbgetlist("$force");
} elsif ("$ARGV[0]" eq "list") {
&Pakfire::dblist("noweb");
&Pakfire::dblist("all", "noweb");
} elsif ("$ARGV[0]" eq "resolvedeps") {
foreach (@ARGV) {
next if ("$_" eq "resolvedeps");
&Pakfire::resolvedeps("$_");
}
} else {
&Pakfire::usage;
}

5
src/paks/files Normal file
View File

@@ -0,0 +1,5 @@
files
install.sh
uninstall.sh
update.sh
ROOTFILES

View File

@@ -717,7 +717,17 @@ sign_packages() {
cd $BASEDIR/packages
for i in `ls $BASEDIR/packages/*.ipfire`; do
echo -n "Signing $i"
echo $GPG_PASSPHRASE | gpg --sign --armor -u 64D96617 --passphrase-fd 0 $i
echo $GPG_PASSPHRASE | gpg --compress-algo 3 --sign --armor -u 64D96617 --passphrase-fd 0 $i
if [ "$?" -eq "0" ]; then
beautify message DONE
mv -f $i.asc $i
else
beautify message FAIL
fi
done
for i in `ls $BASEDIR/packages/meta-*`; do
echo -n "Signing $i"
echo $GPG_PASSPHRASE | gpg --clearsign --armor -u 64D96617 --passphrase-fd 0 $i
if [ "$?" -eq "0" ]; then
beautify message DONE
mv -f $i.asc $i