]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
make.sh: Rewrite uploadsrc with rsync
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Oct 2021 17:46:37 +0000 (17:46 +0000)
committerArne Fitzenreiter <arne_f@ipfire.org>
Fri, 22 Oct 2021 10:36:46 +0000 (10:36 +0000)
Instead of having a very dodgy diff of filelists, this rsync call does
everything automatically and only requires authentication once.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
make.sh

diff --git a/make.sh b/make.sh
index 4a966ab2a33f5b30ac416766623baa26584d2dc3..f6a7440405e209840c7aaddaaf4aecf8a523293f 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -1904,24 +1904,24 @@ gettoolchain)
        fi
        ;;
 uploadsrc)
-       PWD=`pwd`
        if [ -z $IPFIRE_USER ]; then
                echo -n "You have to setup IPFIRE_USER first. See .config for details."
                print_status FAIL
                exit 1
        fi
 
-       URL_SOURCE=$(grep URL_SOURCE lfs/Config | awk '{ print $3 }')
-       REMOTE_FILES=$(echo "ls -1" | sftp -C ${IPFIRE_USER}@${URL_SOURCE})
+       URL_SOURCE="$(awk '/^URL_SOURCE/ { print $3 }' lfs/Config)"
+
+       rsync \
+               --recursive \
+               --update \
+               --ignore-existing \
+               --progress \
+               --human-readable \
+               --exclude="toolchains/" \
+               "${BASEDIR}/cache/" \
+               "${IPFIRE_USER}@${URL_SOURCE}"
 
-       for file in ${BASEDIR}/cache/*; do
-               [ -d "${file}" ] && continue
-               grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
-               NEW_FILES="$NEW_FILES $file"
-       done
-       [ -n "$NEW_FILES" ] && scp -2 $NEW_FILES ${IPFIRE_USER}@${URL_SOURCE}
-       cd $BASEDIR
-       cd $PWD
        exit 0
        ;;
 lang)