[csw-devel] SF.net SVN: gar:[14349] csw/mgar/pkg/bacula/trunk/files

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Wed Apr 20 17:30:27 CEST 2011


Revision: 14349
          http://gar.svn.sourceforge.net/gar/?rev=14349&view=rev
Author:   bdwalton
Date:     2011-04-20 15:30:26 +0000 (Wed, 20 Apr 2011)

Log Message:
-----------
bacula/trunk: add original package scripts

Added Paths:
-----------
    csw/mgar/pkg/bacula/trunk/files/postinstall
    csw/mgar/pkg/bacula/trunk/files/postremove
    csw/mgar/pkg/bacula/trunk/files/preremove

Added: csw/mgar/pkg/bacula/trunk/files/postinstall
===================================================================
--- csw/mgar/pkg/bacula/trunk/files/postinstall	                        (rev 0)
+++ csw/mgar/pkg/bacula/trunk/files/postinstall	2011-04-20 15:30:26 UTC (rev 14349)
@@ -0,0 +1,79 @@
+# Postinstall script for bacula
+# 2006-01-09 Add SMF capability
+# 2007-01-19 Add csw.conf support
+# 2007-09-11 Fix PKG_INSTALL_ROOT usage.  BASEDIR is not used for non
+#            relocatable packages.
+#
+# Copy configuration files if they do not exist
+#
+host=`hostname`
+if [ ! -f ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-dir.conf ]; then
+	echo "Creating initial copy of /opt/csw/etc/bacula/bacula-dir.conf"
+	sed -e "s/Name = ra/Name = $host/g" -e "s/Name = thor/Name = $host/g" -e "s/Address = ra/Address = $host/g" -e "s/Address = thor/Address = $host/g" -e "s/Client = ra/Client = $host/g" -e "s/Client = thor/Client = $host/g" -e "s/Client=ra/Client=$host/g" -e "s/Client=thor/Client=$host/g" ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-dir.conf.CSW >${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-dir.conf
+        chown root:bin ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-dir.conf
+fi
+
+if [ ! -f ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-sd.conf ]; then
+	echo "Creating initial copy of /opt/csw/etc/bacula/bacula-sd.conf"
+	sed -e "s/Name = ra/Name = $host/g" -e "s/Name = thor/Name = $host/g" -e "s/director = ra/director = $host/g" -e "s/director = thor/director = $host/g" ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-sd.conf.CSW >${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-sd.conf
+        chown root:bin ${PKG_INSTALL_ROOT}/opt/csw/etc/bacula/bacula-sd.conf
+fi
+
+# daemons are started by default
+enable_daemon=yes
+
+# Source csw.conf, if it exists
+if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
+fi
+if [ -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
+fi
+
+# If defined, autoenable for the specific daemon name takes precedence
+if [ "$autoenable_bacula" = "no" ] ; then
+  enable_daemon=no
+elif [ "$autoenable_daemons" = "no" -a ! -n "$autoenable_bacula" ] ; then
+  enable_daemon=no
+fi
+
+# Set variable for the availability of SMF
+smf=no
+if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] 
+  then 
+  smf=yes
+fi
+
+# Stop bacula if it is running.
+if [ "$enable_daemon" = "yes" -a x"$PKG_INSTALL_ROOT" = x"" ] ; then
+  echo " "
+  echo "Stopping bacula"
+  if [ $smf = no ]
+  then
+	/etc/init.d/cswbacula stop
+  else
+	/usr/sbin/svcadm disable svc:application/cswbacula
+  fi
+  sleep 3
+fi
+
+# Start bacula
+if [ "$enable_daemon" = "yes" -a x"$PKG_INSTALL_ROOT" = x"" ] ; then
+  echo "Starting bacula"
+  if [ $smf = no ]
+  then
+	/etc/init.d/cswbacula start
+  else
+	/usr/sbin/svcadm enable svc:application/cswbacula
+  fi
+fi
+
+echo
+echo "*** START OF IMPORTANT NOTICE ***"
+echo "  With bacula 2.2.7 and later, the MySQL version is changed"
+echo "  from 4.1 to 5.0.  See /opt/csw/share/doc/bacula/README.CSW"
+echo "  for notes on the database upgrade."
+echo "*** END OF IMPORTANT NOTICE ***"
+echo
+
+exit 0

Added: csw/mgar/pkg/bacula/trunk/files/postremove
===================================================================
--- csw/mgar/pkg/bacula/trunk/files/postremove	                        (rev 0)
+++ csw/mgar/pkg/bacula/trunk/files/postremove	2011-04-20 15:30:26 UTC (rev 14349)
@@ -0,0 +1,43 @@
+# bacula - postremove script
+# 2007-01-19 Initial version
+#
+# Since bacula_client is still installed; restart the init script.
+#
+# Start bacula if it is running.
+
+if [ ! x"$PKG_INSTALL_ROOT" = x"" -a ! x"$PKG_INSTALL_ROOT" = x"/" ] ; then exit 0 ; fi
+
+# daemons are started by default
+enable_daemon=yes
+
+# Source csw.conf, if it exists
+if [ -f /opt/csw/etc/csw.conf ] ; then
+  . /opt/csw/etc/csw.conf
+fi
+if [ -f /etc/opt/csw/csw.conf ] ; then
+  . /etc/opt/csw/csw.conf
+fi
+
+# If defined, autoenable for the specific daemon name takes precedence
+if [ "$autoenable_bacula" = "no" ] ; then
+  enable_daemon=no
+elif [ "$autoenable_daemons" = "no" -a ! -n "$autoenable_bacula" ] ; then
+  enable_daemon=no
+fi
+
+smf=no
+if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
+
+if [ "$enable_daemon" = "yes" ] ; then
+  echo "Starting bacula client"
+  if [ $smf = yes ]
+  then
+	# Enable service
+	/usr/sbin/svcadm enable svc:application/cswbacula:default >/dev/null 2>&1
+  else
+	/etc/init.d/cswbacula start >/dev/null 2>&1
+  fi
+  sleep 3
+fi
+
+exit 0

Added: csw/mgar/pkg/bacula/trunk/files/preremove
===================================================================
--- csw/mgar/pkg/bacula/trunk/files/preremove	                        (rev 0)
+++ csw/mgar/pkg/bacula/trunk/files/preremove	2011-04-20 15:30:26 UTC (rev 14349)
@@ -0,0 +1,24 @@
+# bacula - preremove script
+# 2007-08-18 Fix usage of $BASEDIR and $PKG_INSTALL_ROOT.  This package is
+#            not relocatable; so $BASEDIR is not used
+# 2006-01-09 Add SMF capability
+#
+
+# If removing package from a filesystem tree not running the OS; then exit.
+if [ ! x"$PKG_INSTALL_ROOT" = x"" ] ; then exit 0 ; fi
+
+# Stop bacula if it is running.
+smf=no
+if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
+
+  echo "Stopping bacula"
+  if [ $smf = yes ]
+  then
+	# Disable service
+	/usr/sbin/svcadm disable svc:application/cswbacula:default
+  else
+	/etc/init.d/cswbacula stop
+  fi
+  sleep 3
+
+exit 0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list