Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mbhangui
daemontools
_service:extract_file:archpkg.install
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:extract_file:archpkg.install of Package daemontools
pkgname=daemontools _prefix=/usr _servicedir=/service _qmaildir=/var/indimail _shareddir=/usr/share/indimail _logdir=/var/log/svc _libexecdir=/usr/libexec/indimail stop_service() { if [ -f ${_prefix}/sbin/initsvc ] ; then ${_prefix}/sbin/initsvc -status fi if [ -f ${_prefix}/bin/svok ] ; then # shutdown svscan before upgrade # create .svscan.down so that we # can restore state after upgrade in postinst ${_prefix}/bin/svok ${_servicedir}/.svscan/log 2>/dev/null if [ $? -eq 0 ] ; then touch ${_servicedir}/.svscan.down echo "Giving svscan exactly 5 seconds to exit nicely" if test -f ${confdir}/init/svscan.conf then /sbin/initctl emit qmailstop > /dev/null 2>&1 elif test -f ${confdir}/event.d/svscan then /sbin/initctl emit qmailstop > /dev/null 2>&1 elif test -f ${confdir}/systemd/system/multi-user.target.wants/svscan.service then /bin/systemctl stop svscan > /dev/null 2>&1 elif test -x ${_prefix}/sbin/initsvc then if [ -x ${confdir}/init.d/svscan ] ; then ${_prefix}/sbin/initsvc -status || ${confdir}/init.d/svscan stop || true else ${_prefix}/sbin/initsvc -status || true fi ${_prefix}/sbin/initsvc -off || true else if [ -x ${confdir}/init.d/svscan ] ; then ${confdir}/init.d/svscan stop fi /bin/grep "^SV:" ${confdir}/inittab |/bin/grep svscan |/bin/grep respawn >/dev/null if [ $? -eq 0 ] ; then sed -i 's{^SV:{#SV:{' ${confdir}/inittab if [ $? -eq 0 ] ; then /sbin/init q fi fi fi sleep 5 fi fi } pre_install() { ( stop_service /usr/bin/getent group nofiles > /dev/null || /usr/sbin/groupadd nofiles || true /usr/bin/getent passwd qmaill > /dev/null || /usr/sbin/useradd -M -g nofiles -d ${_logdir} -s /bin/nologin qmaill || true ) >> /var/log/${pkgname}-setup.log 2>&1 } post_install() { ${_libexecdir}/instcheck.${pkgname} ( echo "adding svscan startup" if [ ! -d ${_servicedir} -a ! -L ${_servicedir} ] ; then mkdir -p ${_servicedir} fi ${_prefix}/sbin/minisvc --config=add-boot # svscanlog service ${_prefix}/sbin/minisvc --svscanlog --servicedir=${_servicedir} --scanint=60 # save variables ${_prefix}/sbin/minisvc --servicedir=${_servicedir} --service-name=.svscan \ --export-variables=${_servicedir}/.svscan/variables/.variables --force # turn off automatic refresh for svscan service during first time installation ${_prefix}/sbin/minisvc --servicedir=${_servicedir} --autorefresh="0 /service/.svscan" if [ -x /bin/systemctl ] ; then /bin/systemctl enable svscan fi ) >> /var/log/${pkgname}-setup.log 2>&1 } pre_upgrade() { stop_service } post_upgrade() { ${_libexecdir}/instcheck.${pkgname} ( echo "checking if system boot scripts need upgrade" if [ -f ${confdir}/init.d/svscan ] ; then cmp -s ${_prefix}/bin/qmailctl ${confdir}/init.d/svscan >/dev/null 2>&1 if [ $? -ne 0 ] ; then cp ${_prefix}/bin/qmailctl ${confdir}/init.d/svscan fi fi if [ -x /bin/systemctl -a -d /lib/systemd/system ] ; then cmp -s ${_shareddir}/boot/systemd /lib/systemd/system/svscan.service >/dev/null 2>&1 if [ $? -ne 0 ] ; then cp ${_shareddir}/boot/systemd /lib/systemd/system/svscan.service /bin/systemctl daemon-reload fi elif [ -x /bin/systemctl -a -d /usr/lib/systemd/system ] ; then cmp -s ${_shareddir}/boot/systemd /usr/lib/systemd/system/svscan.service >/dev/null 2>&1 if [ $? -ne 0 ] ; then cp ${_shareddir}/boot/systemd /usr/lib/systemd/system/svscan.service /bin/systemctl daemon-reload fi elif [ -f /sbin/initctl -a -d ${confdir}/init ] ; then cmp -s ${_shareddir}/boot/upstart ${confdir}/init/svscan.conf >/dev/null 2>&1 if [ $? -ne 0 ] ; then cp ${_shareddir}/boot/upstart ${confdir}/init/svscan.conf fi elif [ -d ${confdir}/event.d ] ; then cmp -s ${_shareddir}/boot/upstart ${confdir}/event.d/upstart >/dev/null 2>&1 if [ $? -ne 0 ] ; then cp ${_shareddir}/boot/upstart ${confdir}/event.d fi fi if [ -f ${confdir}/inittab ] ; then # one of these days, this will disappear /bin/grep "^#SV:" ${confdir}/inittab |/bin/grep svscan |/bin/grep respawn >/dev/null 2>&1 if [ $? -eq 0 ] ; then sed -i 's{^#SV:{SV:{' ${confdir}/inittab fi fi # restart svscan service if we find .svscan.down if [ -f ${_servicedir}/.svscan.down ] ; then rm -f ${_servicedir}/.svscan.down echo "Starting svscan" if test -f ${confdir}/init/svscan.conf then /sbin/initctl emit qmailstart > /dev/null 2>&1 elif test -f ${confdir}/event.d/svscan then /sbin/initctl emit qmailstart > /dev/null 2>&1 elif test -f ${confdir}/systemd/system/multi-user.target.wants/svscan.service then /bin/systemctl start svscan > /dev/null 2>&1 elif test -x ${_prefix}/sbin/initsvc then if [ -x ${confdir}/init.d/svscan ] ; then ${_prefix}/sbin/initsvc -status || ${confdir}/init.d/svscan start || true else ${_prefix}/sbin/initsvc -status || true fi ${_prefix}/sbin/initsvc -on || true else if [ -x ${confdir}/init.d/svscan ] ; then ${confdir}/init.d/svscan start fi /bin/grep "^#SV:" ${confdir}/inittab |/bin/grep svscan |/bin/grep respawn >/dev/null if [ $? -eq 0 ] ; then sed -i 's{^#SV:{SV:{' ${confdir}/inittab if [ $? -eq 0 ] ; then /sbin/init q fi fi fi fi # refresh svscanlog services ${_prefix}/sbin/minisvc --servicedir=${servicedir} --refreshsvc="/service/.svscan" ) >> /var/log/${pkgname}-setup.log 2>&1 } pre_remove() { stop_service ( echo "shutting down and removing .svscan service" if [ -d ${_servicedir}/.svscan -o -L ${_servicedir}/.svscan ] ; then touch ${_servicedir}/.svscan/down svc -dx ${_servicedir}/.svscan || true fi if [ -d ${_servicedir}/.svscan/log -o -L ${_servicedir}/.svscan/log ] ; then touch ${_servicedir}/.svscan/log/down svc -dx ${_servicedir}/.svscan/log || true fi if [ -d ${_servicedir}/.svscan -o -L ${_servicedir}/.svscan ] ; then rm -rf ${_servicedir}/.svscan || true fi # Remove svscan being started on system boot echo "removing svscan startup" ${_prefix}/sbin/minisvc --config=rm-boot ) >> /var/log/${pkgname}-setup.log } post_remove() { ( # remove users / groups nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l` if [ $nscd_up -ge 1 ] ; then if [ -x ${confdir}/init.d/nscd ] ; then ${confdir}/init.d/nscd stop fi fi echo "Removing user qmaill" /usr/bin/getent passwd qmaill > /dev/null && /usr/sbin/userdel qmaill >/dev/null || true echo "Removing group nofiles" /usr/bin/getent group nofiles > /dev/null && /usr/sbin/groupdel nofiles >/dev/null || true if [ $nscd_up -ge 1 ] ; then if [ -x ${confdir}/init.d/nscd ] ; then ${confdir}/init.d/nscd start fi fi echo "removing logs" if [ -h ${_logdir} ] ; then log_dir=`/bin/ls -ld ${_logdir} | /usr/bin/awk '{print $10}'` else log_dir=${_logdir} fi [ "$log_dir" != "/" ] && rm -fr $log_dir ) >> /var/log/${pkgname}-setup.log }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor