Am Pakfire weitergearbeitet.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 19 Jun 2007 18:40:52 +0000 (18:40 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 19 Jun 2007 18:40:52 +0000 (18:40 +0000)
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

21 files changed:
config/grub/grub.conf
config/updxlrator/download
config/updxlrator/updxlrator
doc/language_issues.de
doc/language_issues.en
html/cgi-bin/logs.cgi/log.dat
html/cgi-bin/pakfire.cgi
html/cgi-bin/updatexlrator.cgi
html/html/images/updxl-src-avast.gif [new file with mode: 0644]
html/html/images/updxl-src-avira.gif [new file with mode: 0644]
langs/de/install/lang_de.c
langs/en/install/lang_en.c
lfs/Config
lfs/mp3blaster
lfs/mpg123
src/install+setup/setup/dhcp.c
src/misc-progs/pakfire.c
src/pakfire/lib/functions.pl
src/pakfire/pakfire
src/paks/files [new file with mode: 0644]
tools/make-functions

index bfac863..6f86514 100644 (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)
index cc187f5..f2af9f8 100644 (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\""); }
index 4f54d42..839e5aa 100644 (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"); 
+       } 
+       
+       # ----------------------------------------------------------- 
 
        }
 
index 9487471..1ab1f1f 100644 (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
index de7c39f..98784d6 100644 (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
index 9aa37ed..5a2ef9b 100644 (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)\[.*\]'
         );
index 2c0d7dc..ccde029 100644 (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 />
index 7227de4..aa43951 100644 (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
 ;
diff --git a/html/html/images/updxl-src-avast.gif b/html/html/images/updxl-src-avast.gif
new file mode 100644 (file)
index 0000000..93bf625
Binary files /dev/null and b/html/html/images/updxl-src-avast.gif differ
diff --git a/html/html/images/updxl-src-avira.gif b/html/html/images/updxl-src-avira.gif
new file mode 100644 (file)
index 0000000..1ed0d81
Binary files /dev/null and b/html/html/images/updxl-src-avira.gif differ
index fefd9d6..6c608b5 100644 (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 */
index 035aa0c..2d583f0 100644 (file)
@@ -36,7 +36,7 @@ char *en_tr[] = {
 /* TR_AUTODETECT */
 "* AUTODETECT *",
 /* TR_BUILDING_INITRD */
-"Building INITRD...",
+"Building ramdisk...",
 /* TR_CANCEL */
 "Cancel",
 /* TR_CARD_ASSIGNMENT */
index 170f860..7260a06 100644 (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 \
index cd1ba95..b6701dd 100644 (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
index c08dbe0..f912b42 100644 (file)
@@ -36,6 +36,8 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = mpg123
 PAK_VER    = 1
 
+DEPS = "alsa"
+
 ###############################################################################
 # Top-level Rules
 ###############################################################################
index 8f7438e..f969759 100644 (file)
-/* SmoothWall setup program.\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence.  See the file COPYING for details.\r
- *\r
- * (c) Lawrence Manning, 2001\r
- * Stuff for setting up the DHCP server from the setup prog.\r
- * \r
- * $Id: dhcp.c,v 1.9.2.3 2004/12/03 06:46:50 eoberlander Exp $\r
- * \r
- */\r
\r
-#include "setup.h"\r
-\r
-#define TOP 4\r
-\r
-#define START_ADDRESS 0\r
-#define END_ADDRESS 1\r
-#define PRIMARY_DNS 2\r
-#define SECONDARY_DNS 3\r
-#define DEFAULT_LEASE_TIME 4\r
-#define MAX_LEASE_TIME 5\r
-#define DOMAIN_NAME_SUFFIX 6\r
-#define MAX_BOXES 7\r
-\r
-extern FILE *flog;\r
-extern char *mylog;\r
-\r
-extern char **ctr;\r
-\r
-extern int automode;\r
-\r
-newtComponent dhcpform;\r
-newtComponent entries[MAX_BOXES];\r
-newtComponent enabledcheckbox;\r
-\r
-void dhcpdialogcallbackdhcp(newtComponent cm, void *data);\r
-\r
-int handledhcp(void)\r
-{\r
-       char *results[MAX_BOXES];\r
-       char enabledresult;\r
-       char startenabled;\r
-       struct newtExitStruct es;\r
-       newtComponent header;\r
-       newtComponent labels[MAX_BOXES];\r
-       newtComponent ok, cancel;       \r
-       char message[1000];\r
-       char *labeltexts[MAX_BOXES] = { ctr[TR_START_ADDRESS], ctr[TR_END_ADDRESS],\r
-               ctr[TR_PRIMARY_DNS], ctr[TR_SECONDARY_DNS], ctr[TR_DEFAULT_LEASE],\r
-               ctr[TR_MAX_LEASE], ctr[TR_DOMAIN_NAME_SUFFIX] };\r
-       char *varnames[MAX_BOXES] = { "START_ADDR_GREEN", "END_ADDR_GREEN", \r
-               "DNS1_GREEN", "DNS2_GREEN",\r
-               "DEFAULT_LEASE_TIME_GREEN", "MAX_LEASE_TIME_GREEN", \r
-               "DOMAIN_NAME_GREEN"};\r
-       char defaults[MAX_BOXES][STRING_SIZE]; \r
-       int result;\r
-       int c;\r
-       char temp[STRING_SIZE];\r
-       struct keyvalue *mainkv = initkeyvalues();\r
-       struct keyvalue *dhcpkv = initkeyvalues();\r
-       struct keyvalue *ethernetkv = initkeyvalues();\r
-       int error;\r
-       FILE *file;\r
-       char greenaddress[STRING_SIZE]; \r
-       char greennetaddress[STRING_SIZE];\r
-       char greennetmask[STRING_SIZE];\r
-       \r
-       memset(defaults, 0, sizeof(char) * STRING_SIZE * MAX_BOXES);\r
-       \r
-       if (!(readkeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings")))\r
-       {\r
-               freekeyvalues(dhcpkv);\r
-               freekeyvalues(ethernetkv);\r
-               errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);\r
-               return 0;\r
-       }\r
-       if (!(readkeyvalues(ethernetkv, CONFIG_ROOT "/ethernet/settings")))\r
-       {\r
-               freekeyvalues(dhcpkv);\r
-               freekeyvalues(ethernetkv);\r
-               errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);\r
-               return 0;\r
-       }\r
-       if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))\r
-       {\r
-               freekeyvalues(dhcpkv);\r
-               freekeyvalues(ethernetkv);\r
-               freekeyvalues(mainkv);\r
-               errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);\r
-               return 0;\r
-       }\r
-\r
-       /* Set default values. */       \r
-       findkey(ethernetkv, "GREEN_ADDRESS", defaults[PRIMARY_DNS]);\r
-       findkey(mainkv, "DOMAINNAME", defaults[DOMAIN_NAME_SUFFIX]);\r
-       strcpy(defaults[DEFAULT_LEASE_TIME], "60");\r
-       strcpy(defaults[MAX_LEASE_TIME], "120");\r
-\r
-       sprintf(message, ctr[TR_DHCP_SERVER_CONFIGURATION]);\r
-       newtCenteredWindow(55, 18, message);\r
-\r
-       dhcpform = newtForm(NULL, NULL, 0);\r
-       \r
-       sprintf(message, ctr[TR_CONFIGURE_DHCP]);\r
-       header = newtTextboxReflowed(1, 1, message, 52, 0, 0, 0);\r
-       newtFormAddComponent(dhcpform, header);\r
-\r
-       strcpy(temp, ""); findkey(dhcpkv, "ENABLE_GREEN", temp);\r
-       if (strcmp(temp, "on") == 0)\r
-               startenabled = '*';\r
-       else\r
-               startenabled = ' ';\r
-       enabledcheckbox = newtCheckbox(2, TOP + 0, ctr[TR_ENABLED], startenabled, " *", &enabledresult);\r
-       newtFormAddComponent(dhcpform, enabledcheckbox);\r
-       newtComponentAddCallback(enabledcheckbox, dhcpdialogcallbackdhcp, NULL);                \r
-\r
-       for (c = 0; c < MAX_BOXES; c++)\r
-       {\r
-               labels[c] = newtTextbox(2, TOP + 2 + c, 33, 1, 0);\r
-               newtTextboxSetText(labels[c], labeltexts[c]);\r
-               newtFormAddComponent(dhcpform, labels[c]);                              \r
-               strcpy(temp, defaults[c]); findkey(dhcpkv, varnames[c], temp);\r
-               entries[c] = newtEntry(34, TOP + 2 + c, temp, 18, &results[c], 0);\r
-               newtFormAddComponent(dhcpform, entries[c]);             \r
-               if (startenabled == ' ')\r
-                       newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);                      \r
-               \r
-       }\r
-       \r
-       ok = newtButton(10, c + 7, ctr[TR_OK]);\r
-       cancel = newtButton(34, c + 7, ctr[TR_CANCEL]);\r
-\r
-       newtFormAddComponents(dhcpform, ok, cancel, NULL);\r
-       \r
-       do\r
-       {\r
-               error = 0;\r
-               newtFormRun(dhcpform, &es);\r
-       \r
-               if (es.u.co == ok)\r
-               {\r
-                       /* OK was pressed; verify the contents of each entry. */                \r
-                       if (enabledresult == '*')\r
-                       {\r
-                               strcpy(message, ctr[TR_INVALID_FIELDS]);                        \r
-                               if (inet_addr(results[START_ADDRESS]) == INADDR_NONE)\r
-                               {\r
-                                       strcat(message, ctr[TR_START_ADDRESS_CR]);\r
-                                       error = 1;\r
-                               }\r
-                               if (inet_addr(results[END_ADDRESS]) == INADDR_NONE)\r
-                               {\r
-                                       strcat(message, ctr[TR_END_ADDRESS_CR]);\r
-                                       error = 1;\r
-                               }\r
-                               if (strlen(results[SECONDARY_DNS]))\r
-                               {\r
-                                       if (inet_addr(results[PRIMARY_DNS]) == INADDR_NONE)\r
-                                       {\r
-                                               strcat(message, ctr[TR_PRIMARY_DNS_CR]);\r
-                                               error = 1;\r
-                                       }\r
-                               }\r
-                               if (strlen(results[SECONDARY_DNS]))\r
-                               {\r
-                                       if (inet_addr(results[SECONDARY_DNS]) == INADDR_NONE)\r
-                                       {\r
-                                               strcat(message, ctr[TR_SECONDARY_DNS_CR]);\r
-                                               error = 1;\r
-                                       }\r
-                               }\r
-                               if (!(atol(results[DEFAULT_LEASE_TIME])))\r
-                               {\r
-                                       strcat(message, ctr[TR_DEFAULT_LEASE_CR]);\r
-                                       error = 1;\r
-                               }\r
-                               if (!(atol(results[MAX_LEASE_TIME])))\r
-                               {\r
-                                       strcat(message, ctr[TR_MAX_LEASE_CR]);\r
-                                       error = 1;\r
-                               }\r
-                       }                               \r
-                       \r
-                       if (error)\r
-                               errorbox(message);\r
-                       else\r
-                       {\r
-                               for (c = 0; c < MAX_BOXES; c++)\r
-                                       replacekeyvalue(dhcpkv, varnames[c], results[c]);\r
-                               if (enabledresult == '*')\r
-                               {\r
-                                       replacekeyvalue(dhcpkv, "ENABLE_GREEN", "on");\r
-                                       fclose(fopen(CONFIG_ROOT "/dhcp/enable_green", "w"));\r
-                                       chown(CONFIG_ROOT "/dhcp/enable_green", 99, 99);\r
-                               }\r
-                               else\r
-                               {\r
-                                       replacekeyvalue(dhcpkv, "ENABLE_GREEN", "off");\r
-                                       unlink(CONFIG_ROOT "/dhcp/enable_green");\r
-                               }\r
-                               replacekeyvalue(dhcpkv, "VALID", "yes");\r
-                               writekeyvalues(dhcpkv, CONFIG_ROOT "/dhcp/settings");\r
-                               \r
-                               findkey(ethernetkv, "GREEN_ADDRESS", greenaddress);                             \r
-                               findkey(ethernetkv, "GREEN_NETADDRESS", greennetaddress);\r
-                               findkey(ethernetkv, "GREEN_NETMASK", greennetmask);\r
-                       \r
-                               file = fopen(CONFIG_ROOT "/dhcp/dhcpd.conf", "w");\r
-                               fprintf(file, "ddns-update-style none;\n");\r
-                               fprintf(file, "subnet %s netmask %s\n", greennetaddress, greennetmask);\r
-                               fprintf(file, "{\n");\r
-                               fprintf(file, "\toption subnet-mask %s;\n", greennetmask);\r
-                               fprintf(file, "\toption domain-name \"%s\";\n", results[DOMAIN_NAME_SUFFIX]);           \r
-                               fprintf(file, "\toption routers %s;\n", greenaddress);\r
-                               if (strlen(results[PRIMARY_DNS]))\r
-                               {\r
-                                       fprintf(file, "\toption domain-name-servers ");\r
-                                       fprintf(file, "%s", results[PRIMARY_DNS]);\r
-                                       if (strlen(results[SECONDARY_DNS]))\r
-                                               fprintf(file, ", %s", results[SECONDARY_DNS]);\r
-                                       fprintf(file, ";\n");\r
-                               }\r
-                               \r
-                               fprintf(file, "\trange %s %s;\n",       results[START_ADDRESS], results[END_ADDRESS]);\r
-                               fprintf(file, "\tdefault-lease-time %d;\n", (int) atol(results[DEFAULT_LEASE_TIME]) * 60);\r
-                               fprintf(file, "\tmax-lease-time %d;\n", (int) atol(results[MAX_LEASE_TIME]) * 60);\r
-                               fprintf(file, "}\n");\r
-                               fclose(file);\r
-                               chown(CONFIG_ROOT "/dhcp/dhcpd.conf", 99, 99);\r
-                               if (automode == 0)\r
-                                       mysystem("/usr/local/bin/restartdhcp");\r
-                       }\r
-                       result = 1;\r
-               }\r
-               else\r
-                       result = 0;\r
-       }               \r
-       while (error);\r
-       \r
-       newtFormDestroy(dhcpform);\r
-       newtPopWindow();\r
-       \r
-       freekeyvalues(dhcpkv);\r
-       freekeyvalues(ethernetkv);\r
-       freekeyvalues(mainkv);\r
-       \r
-       return result;\r
-}\r
-\r
-/* Called when enabled flag is toggled.  Toggle disabled state of other 3\r
- * controls. */\r
-void dhcpdialogcallbackdhcp(newtComponent cm, void *data)\r
-{\r
-       int c;\r
-       \r
-       for (c = 0; c < MAX_BOXES; c++)\r
-               newtEntrySetFlags(entries[c], NEWT_FLAG_DISABLED, NEWT_FLAGS_TOGGLE);\r
-               \r
-       newtRefresh();\r
-       newtDrawForm(dhcpform); \r
-}\r
+/* 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); 
+}
index 04e8f01..113216f 100644 (file)
 
 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);
-       
 }
index 000b2cf..e316207 100644 (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;
index ef395df..5c5dd6b 100644 (file)
        }
        
        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("$_");
                          exit 1;
                        }
                }
-               
-               &Pakfire::message("### Installing all packages:");
-               foreach (sort @all) { &Pakfire::message("# --> $_"); }
-               &Pakfire::message("");
 
                ### Download first
                foreach (sort @all) {
                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;
        }
diff --git a/src/paks/files b/src/paks/files
new file mode 100644 (file)
index 0000000..ce88096
--- /dev/null
@@ -0,0 +1,5 @@
+files
+install.sh
+uninstall.sh
+update.sh
+ROOTFILES
index d1b534d..36df4c1 100644 (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