You are not logged in.

#1 2013-05-15 14:39:47

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

pacnanny: enforce good pacman discipline on yourself

This is yet another wrapper script for pacman. Unlike other wrappers, this script does not aim to make up for any perceived shortcomings in the functionality of pacman. Instead, it aims to make up for shortcomings in the users of pacman. The goal of pacnanny is to make it even harder to mess up a system update with pacman by making sure that you do not miss anything important.

At present, pacnanny does the following:

  • Before doing a system update, check for new Arch Linux news items since the last update and display them one at a time in the browser of your choosing (w3m by default). There is no confirmation to skip this. Your eyeballs are required to look at the news.

  • Reprint all scriptlet messages

  • Reprint all warnings again together after the update is completed.

  • List new .pacnew and .pacsave files.

  • Print a warning and ask for confirmation when using the --force option.

  • Prompt for a reboot when the kernel has been upgraded.

Each one of these features can be enabled or disabled in /etc/pacnanny.conf, so the level of nanny strictness is customizable.

Pacnanny also does some other handy things on its own:

  • Show the history of a package (dates of installation, upgrades, etc.)

  • Show the Pacman logs for a given date or range of dates

'pacnanny' is a thin wrapper that mostly looks at the arguments you pass before passing them on and at the output that pacman produces. You can simply use the 'pacnanny' command in place of 'pacman' and use all the familiar arguments. So, to do a system update, you would do 'pacnanny -Syu'.

Here is some sample output (slightly edited to remove the flood of dconf deprecation warnings that occured during that update). The most important information is found at the bottom, where it is most likely to be noticed by the user after the process finishes.

$ pacnanny -Syu
:: Checking for Arch Linux news...
Opening news item from 10 Apr 2013 14:09:06

netctl is now in [core]
2013-04-10 - Florian Pritz

Meet netctl: a profile based networking CLI using systemd. In the near future,
the old netcfg will be removed from [core]. Anyone using it is urged to move to
netctl. Migration is a manual process during which you might not have access to
the Internet, so take care and read the man pages (netctl(1), netctl.profile(5)
and netctl.special(7)).

The design of netctl is so that systemd enthusiasts will appreciate its usage
and netcfg users will be familiar with its profile files. Shipped with netctl
comes a ncurses-based wifi connection assistant called wifi-menu.

As you install netctl, netcfg will be removed, but the enabled systemd services
will remain until manually disabled. The netctl wiki holds some additional
information on migrating from netcfg.

[normal pacman output would be here]

Messages:
g_module_open() failed for /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so: libpng15.so.15: cannot open shared object file: No such file or directory
>>> Updating module dependencies. Please wait ...
>>> Generating initial ramdisk, using mkinitcpio.  Please wait...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 3.8.11-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 3.8.11-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: aic94xx
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
>>> updating the filename database for texlive...
>>> The kernel-mode plugin has a new place.
>>> It's now located under /usr/lib/rp-pppoe/rp-pppoe.so
>>> Change LINUX_PLUGIN to the new path in your /etc/ppp/pppoe.conf
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
recreating all formats... done.
 (logs are under /var/lib/texmf/web2c/<engine>/<formatname>.log)
>>> texlive: saving updmap.cfg as /tmp/tmp.EAbwR2eDCb...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: recreating all formats...
 done.
 (logs are under /var/lib/texmf/web2c/<engine>/<formatname>.log)
NB: To setup ConTeXt and the lua(la)tex font db,
    see http://wiki.archlinux.org/index.php/TeX_Live
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: saving updmap.cfg as /tmp/tmp.xA8IuEl0a2...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: saving updmap.cfg as /tmp/tmp.OECw4EqdnM...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: saving updmap.cfg as /tmp/tmp.a1xv5JIKiB...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: saving updmap.cfg as /tmp/tmp.hXq3ABO1Pr...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: saving updmap.cfg as /tmp/tmp.FJRH31f2Gl...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: saving updmap.cfg as /tmp/tmp.IW9RGL8z2a...
>>> texlive: regenerating updmap.cfg (custom additions should go
             into /etc/texmf/web2c/updmap-local.cfg
>>> texlive: updating the filename database...
mktexlsr: Updating /etc/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf/ls-R... 
mktexlsr: Updating /usr/share/texmf-dist/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.
>>> texlive: updating the fontmap files with updmap...
 done.
==> Rebuilding font cache... done
Please add the following line to your .emacs.
(require 'jabber)

  Check for dead symlinks and leftover files 
  in /etc/fonts/conf.d/
  
  If you have been using freetype2-infinality from the AUR,
  the runtime file that came with it has been saved as
  /etc/profile.d/infinality-settings.sh.pacsave and the new
  one was installed in its place. You can manually delete
  infinality-settings.sh.pacsave as it is not needed anymore.

  If you are using [multilib], please install/upgrade
  lib32-freetype2-infinality-ultimate, too.
  
  Fontconfig-ultimate configuration is done via 
  /etc/fonts/conf.avail, /etc/fonts/conf.avail.infinality and 
  conf.d. Read /etc/fonts/conf.d/README for more information.

  Configuration via /etc/fonts/local.conf is still possible,
  but is no longer recommended for options available in conf.avail.

  Main systemwide configuration should be done by symlinks, e.g.
  
  # cd /etc/fonts/conf.d
  # ln -s ../conf.avail/XX-foo.conf

  In most cases default settings should suffice.

  Custom user based configuration should be done in the same way,
  using XDG directory structure, e.g.

  $ cd /root/.config/fontconfig/conf.d
  $ ln -s ../conf.avail/XX-foo.conf

  A few examples can be found in
    /usr/share/doc/fontconfig/infinality-ultimate/fontconfig.
  
  For further information about fontconfig-infiinality-ultimate, see
    /usr/share/doc/fontconfig-infinality-ultimate/README.html
  Check also https://wiki.archlinux.org/index.php/Fonts.

updating font cache... done.
Updating font cache... done.
==> Rebuilding font cache... done
Updating font cache... done
Updating font cache... done.
Updating font cache... done.
Note: terminus-font is in /usr/share/fonts/local/

Warnings:
warning: /usr/lib/avahi/service-types.db installed as /usr/lib/avahi/service-types.db.pacnew
warning: Schema 'org.gnome.system.proxy' has path '/system/proxy/'.  Paths starting with '
/apps/', '/desktop/' or '/system/' are deprecated.
warning: Schema 'org.gnome.system.proxy.http' has path '/system/proxy/http/'.  Paths start
ing with '/apps/', '/desktop/' or '/system/' are deprecated.
warning: /etc/makepkg.conf installed as /etc/makepkg.conf.pacnew
warning: /etc/profile.d/infinality-settings.sh saved as /etc/profile.d/infinality-settings.sh.pacsave

New pacsave files:
/etc/profile.d/infinality-settings.sh.pacsave

New pacnew files:
/usr/lib/avahi/service-types.db.pacnew
/etc/makepkg.conf.pacnew

The kernel was updated. Reboot now? (y/N)

Are there other places that we can help the user avoid shooting himself in the foot? I'm open to ideas. Contributions are welcome as long as they stick to the basic idea of only trying to correct/prevent user-error/carelessness. Also, I'm not great at shell scripting, so please point out any mistakes or places for improvement.

https://github.com/brandoninvergo/pacnanny
https://aur.archlinux.org/packages/pacnanny/

Last edited by jakobcreutzfeldt (2013-10-21 11:04:32)

Offline

#2 2013-05-15 14:51:55

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

One idea that I'm considering is prompting for a reboot after updating the kernel.

Last edited by jakobcreutzfeldt (2013-05-15 14:54:14)

Offline

#3 2013-05-15 15:18:01

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: pacnanny: enforce good pacman discipline on yourself

jakobcreutzfeldt wrote:

One idea that I'm considering is prompting for a reboot after updating the kernel.

Ooh... Although I've been good at remembering to do that recently, I'm embarrassed to say that problem has bitten me in the past. "Why won't my TrueCrypt volume mount??"... sad

Offline

#4 2013-05-15 15:57:54

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

drcouzelis wrote:
jakobcreutzfeldt wrote:

One idea that I'm considering is prompting for a reboot after updating the kernel.

Ooh... Although I've been good at remembering to do that recently, I'm embarrassed to say that problem has bitten me in the past. "Why won't my TrueCrypt volume mount??"... sad

Added!

I also added a warning against using "--force". It seems unnecessary but we still see problems from time to time from people using it. I think the warning fits with the overall idea of pacnanny.

Last edited by jakobcreutzfeldt (2013-05-15 15:59:20)

Offline

#5 2013-05-16 10:19:33

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

I added some example output to the original post to give a better idea of what pacnanny is doing.

I've also added reprinting of scriplet messages. Also, all features can now be disabled via a configuration file, letting you adjust the level of strictness of the script.

Offline

#6 2013-05-16 11:05:26

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

Offline

#7 2013-05-17 13:43:20

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: pacnanny: enforce good pacman discipline on yourself

What is the improvement over pacmatic?

Offline

#8 2013-05-17 13:56:19

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

I have no idea. I've never used pacmatic.

edit: Huh. Well, I guess we had the same idea (granted, the muse hit me a few years too late). The main differences are that pacnanny doesn't check the mailing list, it can reprint messages and warnings for you, and it lists the pac{save,new} files without automatically calling vimdiff or whatever. The mailing list thing is a good idea; I might implement that. I decided against automatically launching a diff resolution program; I think it suffices to just remind you which ones were generated during an update. Also, pacnanny automatically prompts for a reboot after a kernel upgrade and it optionally warns against using --force.

Last edited by jakobcreutzfeldt (2013-05-17 14:04:48)

Offline

#9 2013-06-03 13:41:29

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

I haven't been announcing releases here but we're up to 1.1.1 now. Several little behaviors have been improved, such as handling a diverse array of possible -Sy{,y}u combinations, doing a better job of finding the last update, using more portable escape characters and improving the overall coherence of Pacnanny's printed output.

Also, in my README I acknowledge the existence of pacmatic, which I was completely unaware of when I wrote Pacnanny. The two scripts are similar but they have their differences. I don't think either one is better than the other. So, at least give Pacnanny a try and let me know if there is anything that needs work!

Offline

#10 2013-06-03 14:28:42

Spyhawk
Member
Registered: 2006-07-07
Posts: 485

Re: pacnanny: enforce good pacman discipline on yourself

Haven't thoroughly tested it yet, but you can replace wget by curl. As curl is used by pacman, it is already installed on each Arch system - so that would be one extra dependency less.

Offline

#11 2013-06-03 14:30:01

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: pacnanny: enforce good pacman discipline on yourself

Spyhawk wrote:

Haven't thoroughly tested it yet, but you can replace wget by curl. As curl is used by pacman, it is already installed on each Arch system - so that would be one extra dependency less.

Well, it would still be a dependency; it would just be one that's likely already installed for everyone. Having said that, some people prefer `wget`, to all their own.

All the best,

-HG

Offline

#12 2013-06-03 15:02:32

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: pacnanny: enforce good pacman discipline on yourself

HalosGhost wrote:

it would just be one that's likely already installed for everyone.

If it's required by pacman, then I guarantee that every single Arch Linux user has curl installed. Well, every TRUE Arch Linux user. big_smile

...But I don't see any problem with using wget. Think about it this way: Nobody will say, "I want to use pacnanny but I don't want to install wget", because anyone who doesn't want "bloat" like wget would also not want "bloat" like pacnanny. wink

Offline

#13 2013-06-03 15:27:37

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

Spyhawk wrote:

Haven't thoroughly tested it yet, but you can replace wget by curl. As curl is used by pacman, it is already installed on each Arch system - so that would be one extra dependency less.

Sure, might as well do that. I have no inherent preference for wget over curl.

Offline

#14 2013-06-04 21:03:41

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

OK, I've just pushed version 1.2:

  • add the --history option to show the installation history of a package or packages

  • add the --log option to show the Pacman logs from a given date or range of dates

  • use curl instead of wget

  • improve the method of specifying the browser to use (i.e. now you can do stuff like "lynx -dump %s | less"

  • change default news display to just dumping to standard out (via w3m)

Regarding the first one, here's some sample output:

$ pacnanny --history vim emacs
:: Package history for vim:
2012-06-19 21:21: installed (7.3.547-1)
2012-07-22 11:05: upgraded (7.3.547-1 -> 7.3.600-1)
2012-09-07 09:56: upgraded (7.3.600-1 -> 7.3.659-1)
2012-09-19 00:19: upgraded (7.3.659-1 -> 7.3.661-1)
2012-10-22 22:54: upgraded (7.3.661-1 -> 7.3.709-1)
2012-10-24 20:36: upgraded (7.3.709-1 -> 7.3.712-1)
2012-12-06 19:36: removed (7.3.712-1)
:: Package history for emacs:
2012-06-19 21:22: installed (24.1-2)
2012-08-29 18:41: upgraded (24.1-2 -> 24.2-1)
2012-10-28 23:30: upgraded (24.2-1 -> 24.2-2)
2012-11-18 23:03: upgraded (24.2-2 -> 24.2-3)
2013-01-23 21:32: upgraded (24.2-3 -> 24.2-4)
2013-03-23 13:00: upgraded (24.2-4 -> 24.3-1)
2013-03-25 22:00: upgraded (24.3-1 -> 24.3-1)
2013-03-25 22:14: upgraded (24.3-1 -> 24.3-1)
2013-03-25 22:53: upgraded (24.3-1 -> 24.3-1)
2013-03-25 22:53: upgraded (24.3-1 -> 24.3-1)
2013-05-14 21:32: upgraded (24.3-1 -> 24.3-2)

As for the new "--log" option, you can pass any kind of date that is recognizable by the 'date' command.  This means you can do things like:

$ pacnanny --log 2013-06-04
$ pacnanny --log yesterday
$ pacnanny --log 2013-06-01:2013-06-04
$ pacnanny --log "last month:yesterday"

Enjoy!

Offline

#15 2013-10-21 11:06:09

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

I pushed a minor update to 1.3 yesterday. Really all it does is clean up the default news presentation a bit. The default is still to use w3m to dump it to stdout but I added a bit of post-processing to remove a bit of noise and to otherwise improve the readability.

Offline

#16 2013-10-30 11:39:47

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: pacnanny: enforce good pacman discipline on yourself

Another minor update to 1.3.1 that fixes a bug which would cause a reboot prompt after updating linux-firmware (should only need to be after the kernel itself). Some code was otherwise cleaned up as well.

Offline

Board footer

Powered by FluxBB