From 186e3d2cf87d3277f20d8e2deeb9bde5a80f09b3 Mon Sep 17 00:00:00 2001 From: ms Date: Sun, 1 Jul 2007 21:41:27 +0000 Subject: [PATCH] DHCP und Squid-Initscripts optimiert fuer ein schnelleres starten und stoppen. Which und lsof zur ISO hinzugefuegt. Update-XLrator cacht unsere Pakfire-Pakete und rpm/deb-Pakete. Pakfire weitergebaut. UPnP aus dem Menue genommen. Samba-Symlinks korrigiert. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@657 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/menu/50-firewall.menu | 2 +- config/rootfiles/common/gzip | 2 +- config/rootfiles/common/lsof | 1 + config/rootfiles/common/which | 3 ++ config/rootfiles/packages/cups | 15 ++++--- config/updxlrator/updxlrator | 19 ++++++++ doc/packages-list.txt | 1 - html/cgi-bin/pakfire.cgi | 25 ++++++++--- html/cgi-bin/updatexlrator.cgi | 22 +++++++--- lfs/lsof | 79 ++++++++++++++++++++++++++++++++++ make.sh | 1 + src/initscripts/init.d/dhcp | 2 +- src/initscripts/init.d/squid | 5 ++- src/misc-progs/sambactrl.c | 8 ++-- src/pakfire/lib/functions.pl | 75 +++++++++++++++++++++----------- src/pakfire/pakfire | 60 ++++++++++++++++++-------- 16 files changed, 245 insertions(+), 75 deletions(-) create mode 100644 config/rootfiles/common/lsof create mode 100644 config/rootfiles/common/which create mode 100644 lfs/lsof diff --git a/config/menu/50-firewall.menu b/config/menu/50-firewall.menu index 94b2f5e1bb..019e1d6dce 100644 --- a/config/menu/50-firewall.menu +++ b/config/menu/50-firewall.menu @@ -32,7 +32,7 @@ 'caption' => 'UPnP', 'uri' => '/cgi-bin/upnp.cgi', 'title' => "Universal Plug and Play", - 'enabled' => 1, + 'enabled' => 0, }; $subfirewall->{'70.fwopts'} = { 'caption' => $Lang::tr{'options fw'}, diff --git a/config/rootfiles/common/gzip b/config/rootfiles/common/gzip index a62ee38852..f01fb59fd1 100644 --- a/config/rootfiles/common/gzip +++ b/config/rootfiles/common/gzip @@ -2,7 +2,7 @@ bin/gunzip bin/gzip bin/uncompress -#bin/zcat +bin/zcat #usr/bin/gzexe #usr/bin/zcmp #usr/bin/zdiff diff --git a/config/rootfiles/common/lsof b/config/rootfiles/common/lsof new file mode 100644 index 0000000000..6c6c6f232f --- /dev/null +++ b/config/rootfiles/common/lsof @@ -0,0 +1 @@ +usr/bin/lsof diff --git a/config/rootfiles/common/which b/config/rootfiles/common/which new file mode 100644 index 0000000000..08dc7a59b2 --- /dev/null +++ b/config/rootfiles/common/which @@ -0,0 +1,3 @@ +usr/bin/which +#usr/info/which.info +#usr/man/man1/which.1 diff --git a/config/rootfiles/packages/cups b/config/rootfiles/packages/cups index 12b6bb7cdf..30f598c89c 100644 --- a/config/rootfiles/packages/cups +++ b/config/rootfiles/packages/cups @@ -1,4 +1,5 @@ etc/pam.d/cups +etc/rc.d/init.d/cups #etc/rc0.d #etc/rc0.d/K00cups #etc/rc2.d @@ -563,9 +564,9 @@ usr/share/cups/templates/test-page.tmpl usr/share/cups/templates/trailer.tmpl usr/share/cups/templates/users.tmpl #usr/share/doc/cups -#usr/share/doc/cups/cups-printable.css -#usr/share/doc/cups/cups.css -#usr/share/doc/cups/de +usr/share/doc/cups/cups-printable.css +usr/share/doc/cups/cups.css +usr/share/doc/cups/de #usr/share/doc/cups/de/images #usr/share/doc/cups/de/images/button-accept-jobs.gif #usr/share/doc/cups/de/images/button-add-class.gif @@ -675,7 +676,7 @@ usr/share/cups/templates/users.tmpl #usr/share/doc/cups/es/images/button-view-printable-version.gif #usr/share/doc/cups/es/index.html #usr/share/doc/cups/favicon.ico -#usr/share/doc/cups/help +usr/share/doc/cups/help #usr/share/doc/cups/help/api-array.html #usr/share/doc/cups/help/api-cups.html #usr/share/doc/cups/help/api-filedir.html @@ -740,7 +741,7 @@ usr/share/cups/templates/users.tmpl #usr/share/doc/cups/help/standard.html #usr/share/doc/cups/help/translation.html #usr/share/doc/cups/help/whatsnew.html -#usr/share/doc/cups/images +usr/share/doc/cups/images #usr/share/doc/cups/images/bottom-left.gif #usr/share/doc/cups/images/bottom-right.gif #usr/share/doc/cups/images/button-accept-jobs.gif @@ -815,7 +816,7 @@ usr/share/cups/templates/users.tmpl #usr/share/doc/cups/images/web-printer-status.gif #usr/share/doc/cups/images/web-set-printer-options.gif #usr/share/doc/cups/images/web-test-page.gif -#usr/share/doc/cups/index.html +usr/share/doc/cups/index.html #usr/share/doc/cups/ja #usr/share/doc/cups/ja/images #usr/share/doc/cups/ja/images/button-accept-jobs.gif @@ -922,7 +923,7 @@ usr/share/cups/templates/users.tmpl #usr/share/doc/cups/pl/images/button-view-page-log.gif #usr/share/doc/cups/pl/images/button-view-printable-version.gif #usr/share/doc/cups/pl/index.html -#usr/share/doc/cups/robots.txt +usr/share/doc/cups/robots.txt #usr/share/doc/cups/sv #usr/share/doc/cups/sv/images #usr/share/doc/cups/sv/images/button-accept-jobs.gif diff --git a/config/updxlrator/updxlrator b/config/updxlrator/updxlrator index a7a7358492..019e20f5ff 100644 --- a/config/updxlrator/updxlrator +++ b/config/updxlrator/updxlrator @@ -124,9 +124,28 @@ while (<>) { if ($dsturl =~ m@^http://download[0-99]\.avast\.com/.*\.(exe|zip|vps|stamp|vpu)$@i) { $from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Avast"); + } + + # ----------------------------------------------------------- + # Section: IPFire Downloads + # ----------------------------------------------------------- + + if ($dsturl =~ m@^[f|h]t?tp://.*\.(ipfire)$@i) + { + $from_local_cache = &cache_access($dsturl,$hostaddr,$username,"IPFire"); } # ----------------------------------------------------------- + # Section: Linux Downloads + # ----------------------------------------------------------- + + if ($dsturl =~ m@^[f|h]t?tp://.*\.(deb|rpm)$@i) + { + $from_local_cache = &cache_access($dsturl,$hostaddr,$username,"Linux"); + } + + # ----------------------------------------------------------- + } diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 865d46b637..9ac7d6fd75 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -176,7 +176,6 @@ * mp3blaster-3.2.3 * mpfire-ipfire * mpg123-0.59r -* mpg123-0.60 * mtd-CVS-20070507 * mtools-3.9.10 * mysql-5.0.24a diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index f9144a316a..478a490661 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -79,9 +79,9 @@ END system("/usr/local/bin/pakfire update --force"); -} elsif ($pakfiresettings{'ACTION'} eq 'unlock') { +} elsif ($pakfiresettings{'ACTION'} eq 'upgrade') { - &Pakfire::lock("off"); + system("/usr/local/bin/pakfire upgrade -y"); } elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") { @@ -108,23 +108,32 @@ if ($errormessage) { &Header::closebox(); } -if ( -e "/opt/pakfire/pakfire.lock" ) { +my $return = `pidof pakfire`; +chomp($return); +if ($return) { &Header::openbox("100%", "center", "Aktiv"); print < -
- -   -
+ $Lang::tr{  Pakfire fuehrt gerade eine Aufgabe aus... Bitte warten sie, bis diese erfolgreich beendet wurde.
+ ### TO BE CONTINUED.... WE HAVE TO BEAUTIFY THIS A LITTLE BIT :D +
+END
+my @output = `tail /var/log/messages | grep pakfire`;
+foreach (@output) {
+	print "$_";
+}
+print <
 	
 END
+  	### TO BE CONTINUED.... WE HAVE TO BEAUTIFY THIS A LITTLE BIT :D
 	&Header::closebox();
 	&Header::closebigbox();
 	&Header::closepage();
@@ -133,6 +142,8 @@ END
 
 &Header::openbox("100%", "center", "Pakfire");
 
+system("pakfire update &>dev/null");
+
 print <
 		Verfuegbare Addons:
diff --git a/html/cgi-bin/updatexlrator.cgi b/html/cgi-bin/updatexlrator.cgi index 8a175a72d7..5fc631a554 100644 --- a/html/cgi-bin/updatexlrator.cgi +++ b/html/cgi-bin/updatexlrator.cgi @@ -462,6 +462,12 @@ END } elsif ($metadata[1] eq 'Avast') { print "Avast \n"; + } elsif ($metadata[1] eq 'IPFire') + { + print "IPFire \n"; + } elsif ($metadata[1] eq 'Linux') + { + print "Linux \n"; } else { print "$Lang::tr{ \n"; @@ -541,18 +547,22 @@ print <Symantec Symantec   - $Lang::tr{ - $Lang::tr{'updxlrtr unknown'} + Avira + Avira   + IPFire + IPFire +   + Linux + Linux +   Avast Avast   - Avira - Avira -   -   + $Lang::tr{ + $Lang::tr{'updxlrtr unknown'} END diff --git a/lfs/lsof b/lfs/lsof new file mode 100644 index 0000000000..a5875131ec --- /dev/null +++ b/lfs/lsof @@ -0,0 +1,79 @@ +############################################################################### +# This file is part of the IPCop Firewall. # +# # +# IPCop is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPCop is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPCop; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Makefiles are based on LFSMake, which is # +# Copyright (C) 2002 Rod Roard # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 4.78 + +THISAPP = lsof-$(VER) +DL_FILE = $(THISAPP).tar.bz2 +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 0f8aac305454e8cd8e0ac534c6daccea + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && ./Configure linux -n + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && install -m 4750 -o root -g nobody lsof /usr/bin + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index 5ca18013db..61db8b8858 100755 --- a/make.sh +++ b/make.sh @@ -536,6 +536,7 @@ buildipfire() { ipfiremake alsa ipfiremake mp3blaster ipfiremake which + ipfiremake lsof } buildinstaller() { diff --git a/src/initscripts/init.d/dhcp b/src/initscripts/init.d/dhcp index 8258378481..b9bd42442e 100644 --- a/src/initscripts/init.d/dhcp +++ b/src/initscripts/init.d/dhcp @@ -25,7 +25,7 @@ case "$1" in boot_mesg "Starting DHCP Server..." loadproc /usr/sbin/dhcpd -q ${devices} - sleep 20 && chmod 644 /var/run/dhcpd.pid # Fix because silly dhcpd creates its pid with mode 640 + (sleep 20 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640 ;; stop) diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid index 4930548539..2d3be64808 100644 --- a/src/initscripts/init.d/squid +++ b/src/initscripts/init.d/squid @@ -69,13 +69,14 @@ case "$1" in iptables -t nat -F SQUID squid -k shutdown >/dev/null 2>&1 evaluate_retval - killproc /usr/sbin/squid >/dev/null killproc /usr/bin/squidGuard >/dev/null + killproc /usr/sbin/updxlrator >/dev/null + killproc /usr/sbin/squid >/dev/null ;; restart) $0 stop - sleep 1 + sleep 5 $0 start ;; diff --git a/src/misc-progs/sambactrl.c b/src/misc-progs/sambactrl.c index af25245b09..f5da9ec720 100644 --- a/src/misc-progs/sambactrl.c +++ b/src/misc-progs/sambactrl.c @@ -178,8 +178,9 @@ if (strcmp(argv[1], "enable")==0) { safe_system("touch /var/ipfire/samba/enable"); safe_system("/etc/rc.d/init.d/samba start"); -safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/S50samba"); -safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/K50samba"); +safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc3.d/S45samba"); +safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc0.d/K48samba"); +safe_system("ln -snf /etc/rc.d/init.d/samba /etc/rc.d/rc6.d/K48samba"); return 0; } @@ -187,8 +188,7 @@ if (strcmp(argv[1], "disable")==0) { safe_system("unlink /var/ipfire/samba/enable"); safe_system("/etc/rc.d/init.d/samba stop"); -safe_system("unlink /etc/rc.d/rc3.d/S50samba"); -safe_system("unlink /etc/rc.d/rc3.d/K50samba"); +safe_system("rm -rf /etc/rc.d/rc*.d/*samba"); return 0; } return 0; diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 8492e0d76f..258cf01347 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -82,8 +82,10 @@ sub fetchfile { &General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings); if ($proxysettings{'UPSTREAM_PROXY'}) { + logger("Using upstream proxy: \"$proxysettings{'UPSTREAM_PROXY'}\""); if ($proxysettings{'UPSTREAM_USER'}) { $ua->proxy("http","http://$proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@"."$proxysettings{'UPSTREAM_PROXY'}/"); + logger(" Logging in with: \"$proxysettings{'UPSTREAM_USER'}\" - \"$proxysettings{'UPSTREAM_PASSWORD'}\""); } else { $ua->proxy("http","http://$proxysettings{'UPSTREAM_PROXY'}/"); } @@ -101,9 +103,17 @@ sub fetchfile { } if ($response->is_success) { - if (open(FILE, ">$Conf::cachedir/$bfile")) { + if (open(FILE, ">$Conf::tmpdir/$bfile")) { print FILE $response->content; close(FILE); + logger("File received. Start checking signature..."); + if (system("gpg --verify \"$Conf::tmpdir/$bfile\" &>/dev/null") eq 0) { + logger("Signature of $bfile is fine."); + move("$Conf::tmpdir/$bfile","$Conf::cachedir/$bfile"); + } else { + message("The downloaded file ($file) wasn't verified by IPFire.org. Sorry - Exiting..."); + exit 1; + } logger("Download successfully done from $host (file: $file)."); $allok = 1; return 0; @@ -282,14 +292,19 @@ sub resolvedeps { getmetafile("$pak"); - message("\n## Resolving dependencies for $pak..."); + message(""); + message("## Resolving dependencies for $pak..."); + #if (&isinstalled($pak) eq 0) { + # my @empty; + # return @empty; + #} open(FILE, "<$Conf::dbdir/meta/meta-$pak"); my @file = ; close(FILE); my $line; - my (@templine, @deps, @tempdeps); + my (@templine, @deps, @tempdeps, @all); foreach $line (@file) { @templine = split(/\: /,$line); if ("$templine[0]" eq "Dependencies") { @@ -299,8 +314,14 @@ sub resolvedeps { chomp (@deps); foreach (@deps) { if ($_) { - message("### Found dependency: $_"); - push(@tempdeps,$_); + my $return = &isinstalled($_); + if ($return eq 0) { + message("### Dependency is already installed: $_"); + } else { + message("### Need to install dependency: $_"); + push(@tempdeps,$_); + push(@all,$_); + } } } @@ -310,14 +331,19 @@ sub resolvedeps { my @newdeps = resolvedeps("$_"); foreach(@newdeps) { unless (($_ eq " ") || ($_ eq "")) { - message("### Found dependency: $_"); - push(@deps,$_); + my $return = &isinstalled($_); + if ($return eq 0) { + message("### Dependency is already installed: $_"); + } else { + message("### Need to install dependency: $_"); + push(@all,$_); + } } } } } - chomp (@deps); - return @deps; + chomp (@all); + return @all; } sub cleanup { @@ -437,7 +463,9 @@ sub getpak { sub setuppak { my $pak = shift; - message("We are going to install: $pak"); + message("################################################################################"); + message("# --> Installing: $pak"); + message("################################################################################"); decryptpak("$pak"); @@ -448,6 +476,7 @@ sub setuppak { cleanup("tmp"); copy("$Conf::dbdir/meta/meta-$pak","$Conf::dbdir/installed/"); message("Setup completed. Congratulations!"); + message("################################################################################"); } else { message("Setup returned: $return. Sorry. Please search our forum to find a solution for this problem."); exit $return; @@ -455,6 +484,16 @@ sub setuppak { return $return; } +sub isinstalled { + my $pak = shift; + if ( open(FILE,"<$Conf::dbdir/installed/meta-$pak") ) { + close(FILE); + return 0; + } else { + return 1; + } +} + sub upgradepak { my $pak = shift; @@ -546,22 +585,6 @@ sub senduuid { } } -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 diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index 008382ce7e..06202c0072 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -28,7 +28,6 @@ } if ("$ARGV[0]" eq "install") { - &Pakfire::lock("on"); shift; ### Make sure that the list is not outdated. @@ -45,9 +44,15 @@ my @temp; my @templine; my $found = 0; + my $return; my @all; foreach $pak (@ARGV) { unless ("$pak" =~ "^-") { + $return = &Pakfire::isinstalled($pak); + if ($return eq 0) { + &Pakfire::message("Package $pak is already installed."); + next; + } $found = 0; foreach (@db) { @templine = split(/;/,$_); @@ -63,30 +68,45 @@ break; } } - &Pakfire::message("\nThe pak \"$pak\" is not known. Please try running \"pakfire update\".") if ($found == 0); + &Pakfire::message(""); + &Pakfire::message("The pak \"$pak\" is not known. Please try running \"pakfire update\".") if ($found == 0); } } + + unless (@paks) { + &Pakfire::message("No packages to install. Exiting..."); + exit 1; + } - &Pakfire::message("\n\n### Packages to install:"); - foreach (sort @paks) { - my $size = &Pakfire::getsize("$_"); + &Pakfire::message(""); + &Pakfire::message(""); + &Pakfire::message("### Packages to install:"); + foreach $pak (sort @paks) { + my $size = &Pakfire::getsize("$pak"); $size = &Pakfire::beautifysize($size); - &Pakfire::message("# $_ \t\t - $size"); + &Pakfire::message("# $pak \t\t - $size"); } - &Pakfire::message("\n### Packages to install for dependencies:") if @deps; - foreach (sort @deps) { - my $size = &Pakfire::getsize("$_"); + if (@deps) { + my %sort = map{ $_, 1 } @deps; + @deps = sort keys %sort; + &Pakfire::message(""); + &Pakfire::message("### Packages to install for dependencies:"); + } + foreach $dep (sort @deps) { + my $size = &Pakfire::getsize("$dep"); $size = &Pakfire::beautifysize($size); - &Pakfire::message("# $_ \t\t - $size"); + &Pakfire::message("# $dep \t\t - $size"); } my $totalsize; - foreach (@all) { - $totalsize = ($totalsize + &Pakfire::getsize("$_")); + foreach $pak (@all) { + $totalsize = ($totalsize + &Pakfire::getsize("$pak")); } $totalsize = &Pakfire::beautifysize($totalsize); - &Pakfire::message("\n### Total size: \t ~ $totalsize\n"); + &Pakfire::message(""); + &Pakfire::message("### Total size: \t ~ $totalsize"); + &Pakfire::message(""); if ($interactive) { &Pakfire::message("Is this okay? [y/N]"); @@ -98,17 +118,19 @@ exit 1; } } + + my %sort = map{ $_, 1 } @all; + @all = sort keys %sort; ### Download first - foreach (sort @all) { - &Pakfire::message("# --> Downloading: $_"); - &Pakfire::getpak("$_", ""); + foreach $pak (sort @all) { + &Pakfire::message("# --> Downloading: $pak"); + &Pakfire::getpak("$pak", ""); } - foreach (sort @all) { - &Pakfire::setuppak("$_"); + foreach $pak (sort @all) { + &Pakfire::setuppak("$pak") if ($pak ne ""); } - &Pakfire::lock("off"); } elsif ("$ARGV[0]" eq "remove") { -- 2.39.2