]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
DHCP und Squid-Initscripts optimiert fuer ein schnelleres starten und stoppen.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 1 Jul 2007 21:41:27 +0000 (21:41 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 1 Jul 2007 21:41:27 +0000 (21:41 +0000)
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

16 files changed:
config/menu/50-firewall.menu
config/rootfiles/common/gzip
config/rootfiles/common/lsof [new file with mode: 0644]
config/rootfiles/common/which [new file with mode: 0644]
config/rootfiles/packages/cups
config/updxlrator/updxlrator
doc/packages-list.txt
html/cgi-bin/pakfire.cgi
html/cgi-bin/updatexlrator.cgi
lfs/lsof [new file with mode: 0644]
make.sh
src/initscripts/init.d/dhcp
src/initscripts/init.d/squid
src/misc-progs/sambactrl.c
src/pakfire/lib/functions.pl
src/pakfire/pakfire

index 94b2f5e1bb63c593dc2e8519d3da055d3fb98487..019e1d6dceaf9c760508dfdb7d13838ba571437e 100644 (file)
@@ -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'},
index a62ee38852e83db3db4c2e84c95da8e14cc0da15..f01fb59fd11650d3cb64dec94827bbffd0d78c04 100644 (file)
@@ -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 (file)
index 0000000..6c6c6f2
--- /dev/null
@@ -0,0 +1 @@
+usr/bin/lsof
diff --git a/config/rootfiles/common/which b/config/rootfiles/common/which
new file mode 100644 (file)
index 0000000..08dc7a5
--- /dev/null
@@ -0,0 +1,3 @@
+usr/bin/which
+#usr/info/which.info
+#usr/man/man1/which.1
index 12b6bb7cdf33e987a20feae6cb49ef38c0222b4a..30f598c89c27b29303f92684fdd7ba7d3d66b0ac 100644 (file)
@@ -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
index a7a7358492287fd705d2a3c21188b8628438e20e..019e20f5ff5d3aaf4d6166c797d1561fea2ed50e 100644 (file)
@@ -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"); 
+       }
+       
+       # ----------------------------------------------------------- 
+
 
        }
 
index 865d46b637b58c0ffd11d9ecf0712dacba7aea4a..9ac7d6fd7538c3de5109501d35bb0a41f9ce8bc4 100644 (file)
 * mp3blaster-3.2.3
 * mpfire-ipfire
 * mpg123-0.59r
-* mpg123-0.60
 * mtd-CVS-20070507
 * mtools-3.9.10
 * mysql-5.0.24a
index f9144a316a329348c882ddad1fa50064be4fd159..478a490661423e68e01ae395dfb0521d9f66905b 100644 (file)
@@ -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 <<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>
+                               <img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' />&nbsp;
                        <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>
+               ### TO BE CONTINUED.... WE HAVE TO BEAUTIFY THIS A LITTLE BIT :D
+               <tr><td colspan='2' align='left'><pre>
+END
+my @output = `tail /var/log/messages | grep pakfire`;
+foreach (@output) {
+       print "$_";
+}
+print <<END;
+               </pre>
        </table>
 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 <<END;
        <table width='100%'>
                <tr><td width='40%' align="center">Verfuegbare Addons:<br />
index 8a175a72d74e88c136bce71c47e9d7b81addece7..5fc631a554ba1e58d81e64c5df27f88683856359 100644 (file)
@@ -462,6 +462,12 @@ END
                } elsif ($metadata[1] eq 'Avast')
                {
                        print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' />&nbsp;</td>\n";
+               } elsif ($metadata[1] eq 'IPFire')
+               {
+                       print "<img src='/images/updxl-src-ipfire.gif' alt='IPFire'}' />&nbsp;</td>\n";
+               } elsif ($metadata[1] eq 'Linux')
+               {
+                       print "<img src='/images/updxl-src-linux.gif' alt='Linux'}' />&nbsp;</td>\n";
                } else
                {
                        print "<img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' />&nbsp;</td>\n";
@@ -541,18 +547,22 @@ print <<END
                <td align='center'><img src='/images/updxl-src-symantec.gif' alt='Symantec' /></td>
                <td class='base'>Symantec</td>
                <td class='base'>&nbsp;</td>
-               <td align='center'><img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' /></td>
-               <td class='base'>$Lang::tr{'updxlrtr unknown'}</td>
+               <td align='center'><img src='/images/updxl-src-avira.gif' alt='Avira' /></td>
+               <td class='base'>Avira</td>
        </tr>
        <tr>
                <td class='base' colspan='2'>&nbsp;</td>
+               <td align='center'><img src='/images/updxl-src-ipfire.gif' alt='IPFire' /></td>
+               <td class='base'>IPFire</td>
+               <td class='base'>&nbsp;</td>
+               <td align='center'><img src='/images/updxl-src-linux.gif' alt='Linux' /></td>
+               <td class='base'>Linux</td>
+               <td class='base'>&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>
+               <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>
 </table>
 END
diff --git a/lfs/lsof b/lfs/lsof
new file mode 100644 (file)
index 0000000..a587513
--- /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 <rod@sunsetsystems.com>                        #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# 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 5ca18013dba51261c362774643097a09dfd30e35..61db8b885829657a2766ffd147eb73ad750a832d 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -536,6 +536,7 @@ buildipfire() {
   ipfiremake alsa
   ipfiremake mp3blaster
   ipfiremake which
+  ipfiremake lsof
 }
 
 buildinstaller() {
index 8258378481b25019c878f2f3fbecb1b73182ef7c..b9bd42442eaf24c2fc7233d10cf587fc6d288554 100644 (file)
@@ -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)
index 4930548539ea318cc0c8c10e92f92ece09852f33..2d3be648084f253b90f6e5ca912bb89d1b7722bd 100644 (file)
@@ -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
                ;;
 
index af25245b098bb6a20f448e9980928429cf0aad37..f5da9ec72013a14611f66a9046a496d332a79a18 100644 (file)
@@ -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;
index 8492e0d76fdfbd245f3a966f464e75d1ed285165..258cf01347325cec540dc8905b59f353fe3632bc 100644 (file)
@@ -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 = <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
index 008382ce7ed8230505ac355a880422338cb20f5f..06202c007216a87d6de4f8e8c78572c5ce275f24 100644 (file)
@@ -28,7 +28,6 @@
        }
 
        if ("$ARGV[0]" eq "install") {
-               &Pakfire::lock("on");
                shift;
                
                ### Make sure that the list is not outdated. 
                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(/;/,$_);
                                                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]");
                          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") {