Offline apt-get update to age of cache
        Posted  
        
            by 
                James Haigh
            
        on Ask Ubuntu
        
        See other posts from Ask Ubuntu
        
            or by James Haigh
        
        
        
        Published on 2013-06-26T15:08:35Z
        Indexed on 
            2013/06/26
            16:29 UTC
        
        
        Read the original article
        Hit count: 349
        
I have a script to quickly upgrade a Live or fresh system from cached files on a flash drive. In essence, it looks like this:
# *Code to remove and symlink /var/cache/apt/ if currently empty of packages.*
sudo apt-get dist-upgrade  # Quick offline cached upgrade; not limited by slow WANs.
echo $'\nMake sure Internet is reachable and press enter for complete online upgrade.'; read
sudo apt-get update
sudo apt-get dist-upgrade  # Complete online upgrade.
The problem is that the ‘cached upgrade’ seems to ignore the cached pkgcache.bin and srcpkgcache.bin which is where I assume apt-get update stores its changes, so the upgrade completes as if the system is up-to-date. Useless.
So in that case, I need some code to apt-get update to the age of the package cache on my flash drive. This code would be placed between the 1st and 2nd lines of the code above.
© Ask Ubuntu or respective owner