|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: /etc/security to notice changes in installed packages
From: Frank Bax (fbax
sympatico.ca)
Date: Wed Jan 12 2005 - 15:42:32 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 04:13 PM 1/12/05, -f wrote:
>hi there,
>
>i am making a homegrown backup script ("tar cvzf b.tgz /")
>and i thoght that it would be nice to have a list of all the
>installed packages if the worst happens. i know that it is
>"ls /var/db/pkg" but it is good to have it in one file and
>it is really easy to plug this in into the backup framework...
>people who keep their daily/security mails archived may find
>it nice to see how the packages were added and when.
>
>
>amaaq> diff -u /etc/security
>./security
>--- /etc/security Fri Sep 17 19:59:13 2004
>+++ ./security Wed Jan 12 22:08:30 2005
>
-713,3 +713,26 
> fi
> rm -f $file
> done
>+
>+# Make list of installed packages
>+file=/var/backups/pkg_info
>+CUR=$file.current
>+BACK=$file.backup
>+
>+if pkg_info > $file 2>&1 ; then
>+ if [ -s $CUR ] ; then
>+ diff -u $CUR $file > $OUTPUT
>+ if [ -s $OUTPUT ] ; then
>+ echo "\n======\n${file} diffs (-OLD +NEW)\n======"
>+ cat $OUTPUT
>+ cp -p $CUR $BACK
>+ cp -p $file $CUR
>+ chown root:wheel $CUR $BACK
>+ fi
>+ else
>+ cp -p $file $CUR
>+ chown root:wheel $CUR
>+ fi
>+fi
>+rm -f $file
If instead of deleting "/var/backups/pkg_info", you add this filename to
/etc/changelist - you can remove lots of code - and are left with a single
line (which would have to be placed a bit sooner in the script):
pkg_info > /var/backups/pkg_info 2>&1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]