Friday, August 10, 2012

Use lftp mirror feature to keep track of slackware-current

As Slackware is approaching 14.0 release, I searched for a tool to keep my local copy of slackware-current to be up to date. I downloaded the packages manually with wget's mirror feature before, but it lacks the ability to synchronous my local copy with remote server.

After searched the internet and modified a script, I has the follow script to keep my local copy in sync with official update.
#!/bin/bash    
HOST="slackware.mirrors.tds.net"
VERSION="current"
LSLACKWARE="/home/ftp/slackware-$VERSION"
LSLACKWARE64="/home/ftp/slackware64-$VERSION"

SLACKWARE="/pub/slackware/slackware-$VERSION"
SLACKWARE64="/pub/slackware/slackware64-$VERSION"
COMMON_OPTIONS="mirror --delete \
       --ignore-time \
       --verbose \
       --exclude-glob kernels/ \
       --exclude-glob pasture/ \
       --exclude-glob patches/ \
       --exclude-glob source/"

if [ ! -d $LSLACKWARE ]; then
    mkdir -p $LSLACKWARE
fi

if [ ! -d $LSLACKWARE64 ]; then
    mkdir -p $LSLACKWARE64
fi

lftp -c "set ftp:list-options -a;
set ftp:passive-mode true;
open ftp://$HOST; 
lcd $LSLACKWARE;
cd $SLACKWARE;
$COMMON_OPTIONS"


lftp -c "set ftp:list-options -a;
set ftp:passive-mode true;
open ftp://$HOST; 
lcd $LSLACKWARE64;
cd $SLACKWARE64;
$COMMON_OPTIONS"
Reference: How to use rsync over FTP
Post a Comment