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

Re: Question about get-selections



I have done more experiments and have come up with these notes for now.

#BACKUP
dpkg --get-selections | awk '$2 == "install"' > packagesNG_installed
aptitude -F '%p' search '~i~M' > packagesNG_autoinstalled
debconf-get-selections | grep -Ev '^[[:space:]]*(#|$)' > packagesNG_debconf

# RESTORE
# make sure the system is quite up-to-date (sources.list must match old system)
aptitude update
aptitude upgrade

# forget package state
dpkg --clear-selections
# also forget aptitude's extended states
aptitude -F '%p' search '~M' > /tmp/autopacks.$$
xargs -r -- aptitude --schedule-only unmarkauto < /tmp/autopacks.$$
rm /tmp/autopacks.$$

# load the states from backup
dpkg --set-selections < packagesNG_installed
# load extended states
xargs -r -- aptitude --schedule-only markauto < packagesNG_autoinstalled
debconf-set-selections < packagesNG_debconf

# better let the following run inside a screen
aptitude install


*************************************
ASSERTIONS

packages that are installed AND are not going to be removed 	'~i!~aremove'
PLUS
packages that will be installed 				'~ainstall'
( '~i!~aremove | ~ainstall' )
SHOULD EQUAL
packages that are installed on source				'~i'

autoinstall packages should match on source and destination
aptitude -F '%p' search '~M' ( | wc -l )
*************************************

All of this seems to work, except of course for locally created/obsolete
packages and such, which might be 

indicated by a difference in the package count as mentioned in the previous
assertions.

Additionally, from a base/fresh install of a Debian system I suppose there would
not be many conflicts. On my test system (desktop system to be converted to
server system via this method of saved metadata) I have a large negative score
for conflict resolution.


Reply to: