From 940813f9f5f684b437cf3587843890df64030185 Mon Sep 17 00:00:00 2001 From: Dan Kelleher Date: Thu, 27 Aug 2015 09:59:30 -0400 Subject: [PATCH] SysV scripts now call /usr/sbin/one-contextd I was unable to make systemd scripts for Debian 7 and CentOS 6 so for backwards compatability made the SysV script call /usr/sbin/one-contextd. This should be revisited in the future. --- base_deb/etc/init.d/vmcontext | 39 +--------------------------------- base_rpm/etc/init.d/vmcontext | 40 +---------------------------------- 2 files changed, 2 insertions(+), 77 deletions(-) diff --git a/base_deb/etc/init.d/vmcontext b/base_deb/etc/init.d/vmcontext index 8ba3fcc..61d30de 100755 --- a/base_deb/etc/init.d/vmcontext +++ b/base_deb/etc/init.d/vmcontext @@ -30,47 +30,10 @@ # Short-Description: OpenNebula contextualization script ### END INIT INFO -function export_rc_vars -{ - if [ -f $1 ] ; then - ONE_VARS=`cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//'` - - . $1 - - for v in $ONE_VARS; do - export $v - done - fi -} - -function execute_scripts { - SCRIPTS_DIR="/etc/one-context.d" - for script in $SCRIPTS_DIR/*; do - $script - done -} case "$1" in "start") - CONTEXT_DEV=`blkid -l -t LABEL="CONTEXT" -o device` - if [ -e "$CONTEXT_DEV" ]; then - mount -t iso9660 -L CONTEXT -o ro /mnt - if [ -f /mnt/context.sh ]; then - export_rc_vars /mnt/context.sh - fi - - execute_scripts - - umount /mnt - else - if type vmtoolsd ; then - vmtoolsd --cmd 'info-get guestinfo.opennebula.context' | openssl base64 -d > /tmp/context.sh - export_rc_vars /tmp/context.sh - fi - - execute_scripts - fi - ;; + /usr/sbin/one-context start esac diff --git a/base_rpm/etc/init.d/vmcontext b/base_rpm/etc/init.d/vmcontext index 8ba3fcc..b2c6a47 100755 --- a/base_rpm/etc/init.d/vmcontext +++ b/base_rpm/etc/init.d/vmcontext @@ -30,47 +30,9 @@ # Short-Description: OpenNebula contextualization script ### END INIT INFO -function export_rc_vars -{ - if [ -f $1 ] ; then - ONE_VARS=`cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//'` - - . $1 - - for v in $ONE_VARS; do - export $v - done - fi -} - -function execute_scripts { - SCRIPTS_DIR="/etc/one-context.d" - for script in $SCRIPTS_DIR/*; do - $script - done -} - case "$1" in "start") - CONTEXT_DEV=`blkid -l -t LABEL="CONTEXT" -o device` - if [ -e "$CONTEXT_DEV" ]; then - mount -t iso9660 -L CONTEXT -o ro /mnt - if [ -f /mnt/context.sh ]; then - export_rc_vars /mnt/context.sh - fi - - execute_scripts - - umount /mnt - else - if type vmtoolsd ; then - vmtoolsd --cmd 'info-get guestinfo.opennebula.context' | openssl base64 -d > /tmp/context.sh - export_rc_vars /tmp/context.sh - fi - - execute_scripts - fi - ;; + /usr/sbin/one-context start esac