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

Re: New to Debian (Gentoo user) - package management



Brian wrote:
> Tanstaafl wrote:
> > eix packagename
> > shows all available versions of that package, and what repo they
> > reside in (stable, testing, etc)
> 
>    apt-cache <packagename>

Typo: apt-cache show <packagename>

> and
>    apt-cache policy <packagename>
> 
> > emerge --pretend -vuDN world
> > results in a list of all available updates, as well as any
> > dependencies that would be installed, which I can then pick and
> > choose from. I usually wait until newly available updates have been
> > available for at least a few days before installing them, to avoid
> > nasty surprises.
> 
>    apt-get upgrade -s
> 
> or
> 
>    apt-get dist-upgrade -s
> 
> The '-s' can be omitted if more than one package is to installed.

I find that using "apt-get dist-upgrade -d -y" to be useful too.  It
doesn't install anything but downloads the packages that will be
installed.  It tells me what will be installed while also doing useful
work.

I have a crontab in cron daily so that when I manually install these
then everything is ready and fast and I don't have to wait on the
download part to happen.

  apt-get -q update && apt-get -q autoclean && apt-get -q upgrade -d -y && apt-get -q dist-upgrade -d -y

================================================================

Some fun details that may spark some ideas...

I have a lot of systems to maintain.  Therefore I automate as much as
I can to make things happen for me.  I have the following in
/etc/cron.daily/apt-dist-upgrade-download file:

  #!/bin/sh
  # At least once a day update the index package lists and download
  # pending upgrades.
  {
    apt-get -q update && apt-get -q autoclean && apt-get -q upgrade -d -y && apt-get -q dist-upgrade -d -y
  } 2>&1 | mailx -s "apt download output" root
  exit 0

The above does not install anything.  But it does update the apt index
files (aka Packages) daily and it automatically downloads the packages
so that things are ready to go when I come to them later.

And it always sends an email from the machine.  This is a heartbeat
for me to keep track of the machine.  If I don't get the email then I
know something is wrong.  So I have cron that looks for missing email.

If you are using procmail it is convenient to have procmail filter out
mail that says nothing needs to be done.  Nothing needs to be done if
the mail says "0 upgraded, 0 newly installed, 0 to remove and 0 not
upgraded."  File those off into a folder per machine.

  :0HB
  * ^Subject: Cron <root@example>
  * ^/etc/cron.daily/apt-get-update-download:
  * ^0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  machines/example/

  :0HBc
  * ^Subject: Cron <root@example>
  * ^/etc/cron.daily/apt-get-update-download:
  machines/example/

Then I check that folder by cron.  If I don't have a new message then
I know the machine did not email me and I have to go check it.  If
there is a problem I can check the history in the appropriate mailbox.

  #!/bin/sh
  # Use the daily mail as a keepalive.
  if [ $(find $HOME/Mail/machines/example -type f -cmin -1440 -print | wc -l) -eq 0 ]; then
    echo "example failed to email us recently"
  fi
  # Prune older messages.
  find $HOME/Mail/machines/example -type f -mtime +30 -delete
  exit 0

The above is for one single machine "example".  I didn't show the
expanded parameterized versions for any machine because that is not as
clear what is happening.  But you get the idea.  Always automate as
much as possible. :-)

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: