michael@13: #!@l_prefix@/bin/openpkg rc michael@13: ## michael@13: ## rc.openpkg -- Run-Commands 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@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@13: # automatic (re-)registration michael@13: reregister=0 michael@13: # re-register if previously registered michael@13: @l_prefix@/bin/openpkg register --printstatus >/dev/null 2>&1 && reregister=1 michael@13: # re-register if "openpkg" executable from community series michael@13: [ $reregister -eq 0 ] && @l_prefix@/bin/openpkg --license 2>/dev/null \ michael@13: | sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C' >/dev/null && reregister=1 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@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@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: