I would like to install all the packages i have on my other pc, is there an automated way to do so?
i have tried dpkg --get-selections > selections.txt on my pc,
then on the mac intel
dpkg --set-selections < selections.txt
i get only errors package not found in the state database and not avaible or so (in italian, sorry pacchetto non presente nel database di stato nè di disponibilità)
#!/usr/bin/env python3
import subprocess, re
def run(*args, **kwargs):
return str(subprocess.check_output(*args, **kwargs), 'utf_8')
def getManualPkgs():
installerPkgs=run(['zcat', '/var/log/installer/initial-status.gz']).split('\n')
manualPkgs=run(['apt-mark', 'showmanual']).split('\n')
for raw_line in installerPkgs:
if not(raw_line.startswith('Package:')): continue
line=re.sub(r'^Package:\s*', '', raw_line, flags=re.I)
if line in manualPkgs: manualPkgs.remove(line)
return manualPkgs
if __name__ == '__main__':
print('\n'.join(getManualPkgs()))
Save it, say to lstpkg.py file, run it like python3 lstpkg.py > my-packages.txt and get the list of your manually installed packages in the mentioned text file.
To install them from the list try some of the methods discussed here:
Not that simple, I'm afraid, for dpkg --get-selections |grep -v deinstall |grep install |cut -f1 returns exactly what apt-mark showmanual does. And the list contains a lot of packages belonging to the system itself, say xorg, xserver, etc.
Cited script strips down system packages from the list using /var/log/installer/initial-status.gz as the reference.