michael@13: #!@l_prefix@/bin/openpkg rc michael@13: ## michael@428: ## rc.openpkg -- Run-Commands michael@428: ## Copyright (c) 2000-2012 OpenPKG GmbH michael@428: ## michael@428: ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. michael@428: ## All rights reserved. Licenses which grant limited permission to use, michael@428: ## copy, modify and distribute this software are available from the michael@428: ## OpenPKG GmbH. michael@428: ## michael@428: ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED michael@428: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@428: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@428: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@428: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@428: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@428: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@428: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@428: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@428: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@428: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@428: ## SUCH DAMAGE. michael@13: ## michael@13: michael@13: %config michael@13: openpkg_rc_def="yes" michael@13: openpkg_rc_all="$openpkg_rc_def" michael@13: openpkg_enable="$openpkg_rc_def" michael@13: openpkg_envprio="high" michael@13: openpkg_reghour="3" michael@13: openpkg_regrand="1" michael@13: michael@13: %status -o michael@13: openpkg_usable="unknown" michael@13: openpkg_active="unknown" michael@13: echo "openpkg_enable=\"$openpkg_enable\"" michael@13: echo "openpkg_usable=\"$openpkg_usable\"" michael@13: echo "openpkg_active=\"$openpkg_active\"" michael@13: michael@13: %info -o michael@13: @l_prefix@/bin/openpkg uuid info michael@13: michael@13: %start -p0 michael@13: rcService openpkg enable yes || exit 0 michael@428: michael@13: # update UUID information (in background to not slow down boot sequences) michael@13: (nohup @l_prefix@/bin/openpkg uuid update /dev/null 2>&1 &) >/dev/null 2>&1 michael@13: michael@13: %hourly -u @l_musr@ michael@13: rcService openpkg enable yes || exit 0 michael@428: michael@13: # automatic (re-)registration michael@13: reregister=0 michael@428: michael@13: # re-register if previously registered michael@13: @l_prefix@/bin/openpkg register --printstatus >/dev/null 2>&1 && reregister=1 michael@428: michael@13: # re-register if "openpkg release" configured to pull packages directly from openpkg.(org|com|net) michael@13: [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg release --fmt='%u' \ michael@13: | egrep '^[^:]*://(([^:]*:)?([^@]*@)?)?([^/]*\.)?openpkg\.(com|org|net)/' >/dev/null && reregister=1 michael@428: michael@13: # perform (re-)registration michael@13: if [ $reregister -eq 1 ]; then michael@13: [ $openpkg_reghour -lt 00 -o $openpkg_reghour -gt 23 ] && openpkg_reghour="3" michael@13: now=`date '+%H'` michael@13: [ $openpkg_reghour -eq $now ] || exit 0 michael@13: [ $openpkg_regrand -lt 01 -o $openpkg_regrand -gt 04 ] && openpkg_regrand="1" michael@13: rnd=`expr $RANDOM \* 3600 \* $openpkg_regrand / 32768` michael@13: (nohup @l_prefix@/lib/openpkg/bash -c "sleep $rnd; @l_prefix@/bin/openpkg register" /dev/null 2>&1 &) >/dev/null 2>&1 michael@13: fi michael@13: michael@13: %daily -p0 michael@13: rcService openpkg enable yes || exit 0 michael@428: michael@13: # update UUID information michael@13: @l_prefix@/bin/openpkg uuid update >/dev/null 2>&1 || true michael@13: michael@13: %env -p0 michael@13: rcService openpkg enable yes || exit 0 michael@13: michael@13: # determine append (low prio) or prepend (high prio) mode michael@13: opt_prepend="" michael@13: if [ ".$openpkg_envprio" = ".high" ]; then michael@13: opt_prepend="-p" michael@13: fi michael@13: michael@13: # make sure the software package executables are found michael@13: export PATH michael@13: rcPath -a -e PATH \ michael@13: /bin /sbin /usr/bin /usr/sbin michael@13: rcPath -a ${opt_prepend} PATH \ michael@13: @l_prefix@/bin @l_prefix@/sbin \ michael@13: @l_prefix@/local/bin @l_prefix@/local/sbin michael@13: michael@13: # make sure the software package manual pages are found michael@13: export MANPATH michael@13: rcPath -a -e MANPATH \ michael@13: /usr/man /usr/share/man michael@13: rcPath -a ${opt_prepend} MANPATH \ michael@13: @l_prefix@/man @l_prefix@/local/man michael@13: michael@13: # make sure the software package info pages are found michael@13: export INFOPATH michael@13: rcPath -a -e INFOPATH \ michael@13: /usr/info /usr/share/info michael@13: rcPath -a ${opt_prepend} INFOPATH \ michael@13: @l_prefix@/info @l_prefix@/local/info michael@13: michael@13: # make sure the software package libraries are found michael@13: export LD_LIBRARY_PATH michael@13: rcPath -a -e LD_LIBRARY_PATH \ michael@13: /lib /usr/lib michael@13: rcPath -a ${opt_prepend} LD_LIBRARY_PATH \ michael@13: @l_prefix@/lib @l_prefix@/local/lib michael@13: michael@13: # cleanup michael@13: unset opt_prepend michael@13: