[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

lazy programming tool



Hi,
I have a slow dialup so I created a script to get the deb's I need
without doing an 'apt-get update'. Maybe it will help someone else.

--------------------------------------get_old_app.sh PKGNAME------------
apt-get -y --print-uris install $1 2>/dev/null|grep http|
awk '{print $1}'| cut -d"/" -f4-|cut -d\' -f1|while read line; do
        echo $line;
        URL3="$line"
        URL4=$(basename $URL3)
        URL1="http://snapshot.debian.net/archive/";
        i=0
        done="no"
        while [ "$done" == "no" ]; do 
                echo -n "$i ";
		URL2=$(date +"%Y/%m/%d/" --date="$i day ago")
                echo -n "["; 
		wget -c $URL1$URL2$URL3 
		STAT=$?  
		echo "]"; 
		if [ "$STAT" == "0" ]; then 
			done="yes" 
			echo moving $URL4 
			mv $URL4 /var/cache/apt/archives 
			STAT=$?  
			echo $STAT 
			if [ "$STAT" == "0" ]; then 
				done="yes" 
			else 
				done="no" 
			fi 
			URL5=$(echo $URL4|cut -d"_" -f1) 
			apt-get -y install $URL5 
			STAT2=$?  
			echo "status $STAT2" 
		else 
			if [ "$i" == "20" ]; then 
				done="yes" 
			fi 
		fi 
		i=$(( $i + 1)) 
	done 
done
------------------------------------------------------------
-Kev

Attachment: signature.asc
Description: Digital signature


Reply to: