Changeset View
Changeset View
Standalone View
Standalone View
head/sysutils/munin-master/pkg-install
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
move_www_dir() { | move_www_dir() { | ||||
if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ] | if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ] | ||||
then | then | ||||
echo Migrating ${PKG_PREFIX}/www/data/munin to ${PKG_PREFIX}/www/munin | echo Migrating ${PKG_PREFIX}/www/data/munin to ${PKG_PREFIX}/www/munin | ||||
mv ${PKG_PREFIX}/www/data/munin ${PKG_PREFIX}/www/munin | mv ${PKG_PREFIX}/www/data/munin ${PKG_PREFIX}/www/munin | ||||
fi | fi | ||||
} | } | ||||
move_newsyslog_conf() { | |||||
oldfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-master | |||||
newfile=${PKG_PREFIX}/etc/newsyslog.conf.d/munin-master.conf | |||||
samplefile=${PKG_PREFIX}/etc/munin/munin-master.newsyslog | |||||
if [ -f ${oldfile} ]; then | |||||
echo "Configuration file found in old location: ${oldfile}" | |||||
if cmp -s ${samplefile} ${newfile} > /dev/null; then | |||||
echo "Configuration file in new location has not been modified from the default: ${newfile}" | |||||
echo " => Moving old configuration file to new location" | |||||
mv -f ${oldfile} ${newfile} | |||||
else | |||||
echo "Configuration file in new location has been modified from the default: ${newfile}" | |||||
echo " => Deleting old configuration file" | |||||
rm ${oldfile} | |||||
fi | |||||
fi | |||||
} | |||||
######################################################################## | ######################################################################## | ||||
case $2 in | case $2 in | ||||
PRE-INSTALL) | PRE-INSTALL) | ||||
move_www_dir # at some point in the installation, the www dir is created | move_www_dir # at some point in the installation, the www dir is created | ||||
;; | ;; | ||||
POST-INSTALL) | POST-INSTALL) | ||||
if [ -z "${PACKAGE_BUILDING}" ] | if [ -z "${PACKAGE_BUILDING}" ] | ||||
then | then | ||||
create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT | create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT | ||||
#BEGIN_MUNIN_MAIN | #BEGIN_MUNIN_MAIN | ||||
MAILTO=root | MAILTO=root | ||||
*/5 * * * * ${PKG_PREFIX}/bin/munin-cron | */5 * * * * ${PKG_PREFIX}/bin/munin-cron | ||||
#END_MUNIN_MAIN | #END_MUNIN_MAIN | ||||
EOT | EOT | ||||
fi | fi | ||||
move_newsyslog_conf | |||||
;; | ;; | ||||
esac | esac |