LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   [slackpkg patch] link files to work dir when mirror is local (https://www.linuxquestions.org/questions/slackware-14/%5Bslackpkg-patch%5D-link-files-to-work-dir-when-mirror-is-local-767592/)

grissiom 11-07-2009 06:48 PM

[slackpkg patch] link files to work dir when mirror is local
 
This can avoid some io transfers and save your hard disk a bit. Some one may want a try ;)
Code:

diff -u slackpkg-2.80.2-noarch-3/usr/libexec/slackpkg/core-functions.sh /usr/libexec/slackpkg/core-functions.sh
--- slackpkg-2.80.2-noarch-3/usr/libexec/slackpkg/core-functions.sh    2009-07-27 09:33:49.000000000 +0800     
+++ /usr/libexec/slackpkg/core-functions.sh    2009-11-08 08:28:36.824255477 +0800                             
@@ -656,8 +667,8 @@

 function getfile() {
        if [ "$LOCAL" = "1" ]; then
-                echo -e "\t\t\tCopying $1..."
-                cp ${SOURCE}$1 $2 2>/dev/null
+                echo -e "\t\t\tLinking $1..."
+                ln -s ${SOURCE}$1 $2 2>/dev/null
        else
                echo -e "\t\t\tDownloading $1..."
                wget ${WGETFLAGS} ${SOURCE}$1 -O $2
@@ -691,10 +702,10 @@
                # put then in CACHEPATH
                #
                if [ "${LOCAL}" = "1" ]; then
-                      echo -e "\tCopying $NAMEPKG..."
-                      cp ${SOURCE}${FULLPATH}/${NAMEPKG} ${CACHEPATH}
+                      echo -e "\tLinking $NAMEPKG..."
+                      ln -s ${SOURCE}${FULLPATH}/${NAMEPKG} ${CACHEPATH}
                        if [ "$CHECKGPG" = "on" ]; then
-                              cp ${SOURCE}${FULLPATH}/${NAMEPKG}.asc ${CACHEPATH}
+                              ln -s ${SOURCE}${FULLPATH}/${NAMEPKG}.asc ${CACHEPATH}
                        fi
                else
                        echo -e "\tDownloading $NAMEPKG..."


lumak 11-07-2009 10:51 PM

Thanks, for pointing this out. I only recently started updating by using the mirror-slackware.sh and setting slackpkg to a local web server. That seems odd that it would be using a cp command when the files are local :/


All times are GMT -5. The time now is 09:09 AM.