Sophie

Sophie

distrib > Mageia > 3 > i586 > by-pkgid > debb56189752d9c41a25117429a5bc4d > scriptlet

389-ds-base-1.3.0.5-2.mga3.i586.rpm

PREUN

/bin/sh
if [ $1 -eq 0 ]; then # Final removal
    # Package removal, not upgrade
    %systemd_preun dirsrv-snmp.service dirsrv.target
    # remove instance specific service files/links
    rm -rf /etc/systemd/system/dirsrv.target.wants/* > /dev/null 2>&1 || :
fi

POSTIN

/bin/sh
output=/dev/null
/usr/share/rpm-helper/add-service 389-ds-base $1 dirsrv-snmp 
# reload to pick up any changes to systemd files
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
# reload to pick up any shared lib changes
/sbin/ldconfig
# restart the snmp subagent if needed
/bin/systemctl try-restart dirsrv-snmp.service > $output 2>&1 || :
# find all instances
instances="" # instances that require a restart after upgrade
ninst=0 # number of instances found in total
if [ -n "$DEBUGPOSTTRANS" ] ; then
   output=$DEBUGPOSTTRANS
fi
echo looking for services in /etc/systemd/system/dirsrv.target.wants/* > $output 2>&1 || :
for service in /etc/systemd/system/dirsrv.target.wants/* ; do
    if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
    inst=`echo $service | sed -e 's,/etc/systemd/system/dirsrv.target.wants/,,'`
    echo found instance $inst - getting status > $output 2>&1 || :
    if /bin/systemctl -q is-active $inst ; then
       echo instance $inst is running > $output 2>&1 || :
       instances="$instances $inst"
    else
       echo instance $inst is not running > $output 2>&1 || :
    fi
    ninst=`expr $ninst + 1`
done
if [ $ninst -eq 0 ] ; then
    echo no instances to upgrade > $output 2>&1 || :
    exit 0 # have no instances to upgrade - just skip the rest
fi
# shutdown all instances
echo shutting down all instances . . . > $output 2>&1 || :
/bin/systemctl stop dirsrv.target > $output 2>&1 || :
echo remove pid files . . . > $output 2>&1 || :
/bin/rm -f /var/run/dirsrv*.pid /var/run/dirsrv*.startpid
# do the upgrade
echo upgrading instances . . . > $output 2>&1 || :
/usr/sbin/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || :
# restart instances that require it
for inst in $instances ; do
    echo restarting instance $inst > $output 2>&1 || :
    /bin/systemctl start $inst > $output 2>&1 || :
done
exit 0

POSTUN

/bin/sh
/sbin/ldconfig
if [ $1 = 0 ]; then # Final removal
    rm -rf /var/run/dirsrv
fi