postplug/postplug.d/45updates

26 lines
693 B
Plaintext
Raw Normal View History

2011-04-27 19:57:03 +02:00
#!/bin/bash
#
# updates - perform one time updates at boot time using files in /etc/postplug/updates.d
#
# Copyright (c) 2010-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
me="updates"
. /etc/postplug/postplug.defs
for u in `ls /etc/postplug/updates.d/*.upd 2>/dev/null`; do
f=`basename $u`
grep $f $postpluglibdir/updates.cache 2>/dev/null >/dev/null || {
if [ ! -e $postpluglibdir/firsttime ]; then
logmsg "$me" "running updates script $u"
sh $u
[ $? -ne 0 ] && {
logmsg "$me" "error: $f update script failed with exit code $?"
continue
}
fi
echo "$f" >> $postpluglibdir/updates.cache
}
done