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

Re: Install matching set of software while preserving aptitude auto/manual install info



On Wed, Nov 5, 2008 at 3:30 PM, green <greenfreedom10@gmail.com> wrote:
> On Wed, 2008.11.05, 310, Brian McKee wrote:
>> I'd like to 'clone' the installed software on a machine.   I can find
>> lots of references to this procedure
>> > Backup installed package list on current machine
>> > dpkg --get-selections > selections.txt
>> > move selections.txt to the new machine Set package list on new machine and install packages
>> > dpkg --set-selections < selections.txt
>> > apt-get update
>> > apt-get upgrade
>>
>> What I can't find, but I know I've seen, is a way to do it using
>> aptitude that preserves aptitude's knowledge of what was installed
>> manually vs automatically.
>> Can someone throw me a link (or a cluestick)
>
> If you want to preserve auto-install information, use aptitude only, not dpkg
> or apt-get.
>
> Note that I have almost never actually restored the package selections using
> the commands under [restore] but the [save] ones are run with each backup.
> Understand what the [restore] commands do before you use them.  And if this
> works, maybe someone could put it on the wiki.
>
> [save]
> # Save a list of all installed packages
> aptitude -F "%?p" --disable-columns search \~i >| installed-all
> # Save a list of all installed packages with their versions
> aptitude -F "%?p=%?V" --disable-columns search \~i >| installed-all-ver
> # Save a list of all automatically installed packages
> aptitude -F "%?p" --disable-columns search \~i\~M >| installed-auto
>
> [restore]
> # Install all essential, important, required, or standard packages
> aptitude -R --schedule-only install $( aptitude -F "%?p" search \!\~i?or(\~E,\~pimportant,\~prequired,\~pstandard) )
> # Mark as manually installed all essential, important, required, or standard priority packages
> aptitude -R --schedule-only unmarkauto $( aptitude -F "%?p" search \~i?or(\~E,\~pimportant,\~prequired,\~pstandard) )
> # Mark as automatically installed all packages that are not essential, important, required, or standard priority
> aptitude --schedule-only markauto $( aptitude -F "%?p" search \~i\!\~E\!\~pimportant\!\~prequired\!\~pstandard )
> # Install all the packages in the installed package list (manual + automatic)
> aptitude -R --schedule-only install $( cat installed-all )
> # Mark as automatically installed all packages in that list
> aptitude --schedule-only markauto $( cat installed-auto )
>

Thanks for that.  I'm not sure of the implications of marking
'essential, important, required, or standard priority packages' as
manually installed and the rest as automatically installed.  I mean,
how did I get to that spot - from the install disc I'm assuming.  Is
that a manual or automatic install?.  If I look at initscripts say,
it's required, but automatic right now.  If I follow your logic
correctly, you'd be marking it manual.

I also wonder about too many arguments if I do
> aptitude -R --schedule-only install $( cat installed-all )
with a lot of packages on that list.

I like the idea of creating the lists as a cron job - thanks for that thought.
Florian's suggestion looks simpler at the moment.

Food for thought for sure.

Brian


Reply to: