clone a debian install

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts



dpkg -l | awk '{print $2}' > installed_packages.txt (old dpkg)
dpkg --get-selections > /backup/installed_packages.txt

Little bit of clean up of the installed_packages.txt with VI....
(Might want to consider the boot-loader (grub vs lilo etc to not hose up booting).

(other kernels, obsolete versions of libs if this is an upgrade and not a clone install!)

apt-get install `cat installed_packages.txt` (old)

dpkg --set-selections < /backup/installed_packages.txt (new)
Follow up with dselect session and install away.

Might try this to remove specific versions of stuff:

cat installed_packages.txt | grep -v [0-9] > noversions.txt

Here is a little something to get it all going:

import os

packages = open('noversions.txt')

for pkg in packages:
  pkgname = pkg[:-1]
  os.system('apt-get install ' + str(pkgname))


If you like living on the edge (Y)es defaults to every question:

import os

packages = open('noversions.txt')

for pkg in packages:
  pkgname = pkg[:-1]
  os.system('apt-get --yes --force-yes install ' + str(pkgname))



[æ]