APT Cache Synchronization Script
December 16, 2010 5 Comments
Sometimes I use Linux to do my works. I was Arch Linux user and recently migrated to Ubuntu. A friend of mine uses Ubuntu for years and has a large APT cache so I decided to use it instead of downloading 3-4 GBs of packages. Although APTonCD can backup APT cache in simple intuitive GUI, just in case I decided to write a shell script to synchronize our caches. I like it better because you can use your USB flash memory to sync your APT cache in this way:
#!/bin/bash
function pause(){
read -p "$*"
}
echo Please Wait...
CPATH=`pwd`"/APT-CACHE/"
mkdir -p $CPATH
cd /var/cache/apt/; sudo tar cf - . | (cd $CPATH; tar xf -)
cd $CPATH; tar cf - . | (cd /var/cache/apt/; sudo tar xf -)
echo Done.
pause "Press Enter to Close..."
Hope it helps
