Wednesday, January 28, 2009

Download kde4 from slackware-current

This is a script to mirror the kde4 packages from slackware-current. For now, those packages works for slackware 12.2 too.

The script may be executed multiple times from the same directory. It will detect the changes made in the repositoty, it will remove the obsolete local files and will only download the newer files that are not present in the local copy.

#!/bin/sh

# Copyright 2008-2009 Nikos Skalkotos, Athens, Greece
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


server=ftp://ftp.ntua.gr
url_path=pub/linux/slackware/slackware-current/testing/packages/kde4
url=$server/$url_path
dirs="deps extragear kde kde3-compat kde-l10n"
files="remove-kde3.sh remove-kde4.sh"

if [ "$1" = "--clean" ]; then
echo -n "Cleaning up..."
rm -fr $files $dirs
echo "done"
exit 0
fi

remove_obsolete() {
echo "Checking local directory \"$1\" for obsolete files..."
(cd $1
for i in `ls`; do
exists=`echo "$2" | grep $i`

if [ $i != "" -a "$exists" = "" ] ; then
echo "Removing file: $1/$i"
rm -f $i
fi
done
)
}


for filename in $files; do
#Those are small scripts, so I'll download them every time
rm -f $filename
wget -c $url/$filename
done

for dir in $dirs; do

#I need to create the dir the first time
mkdir -p "$dir"

echo
#Clean old files no longer listened in the repository
echo -n "Listing kde4/$dir content..."
dir_content=`curl -sl $url/$dir/`
echo "done"
remove_obsolete $dir "$dir_content"

#Now mirror the directory
(cd $dir; wget --mirror -nH -nd $url/$dir/)
done

5 comments:

FRLinux said...

Hey nice little script, really appreciated. Might want to tell people to use a close mirror. We have 2 in Ireland here providing full speed :) Thanks again.

sateaf said...

passez sur ce site Web répliques de sacs à main Ysl contenu Fendi Dolabuy ressource Celine Dolabuy

seshe said...

discover this info here Dior Dolabuy Continue Ysl replica Continued dolabuy gucci

Unknown said...

replica bags chicago gucci fake z9t42f0o79 replica bags review click to investigate v1u43n9t22 replica louis vuitton bags replica bags in delhi replica bags delhi find this f6p23d0f16 replica bags nancy

Anonymous said...

hermes
jordan 6
kyrie 6 shoes
kd 14
golden goose
goyard bags
bape
off white nike
hermes outlet
supreme