Repository: jclouds-labs Updated Branches: refs/heads/master eea1bdb45 -> 75178c770
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly b/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly deleted file mode 100644 index ac4d33b..0000000 --- a/virtualbox/src/test/resources/redHatAndDerivatives/hostOnly +++ /dev/null @@ -1,26 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#!/bin/bash -sudo ip link set eth1 name eth0 -# configure eth0 -MAC_ETH0=`ifconfig -a | grep eth0 | awk '{ print $5}'`; sed "s/HWADDR.*/HWADDR\=\"$MAC_ETH0\"/g" /etc/sysconfig/network-scripts/ifcfg-eth0 > /tmp/ifcfg-eth0; -sudo cp /tmp/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0; -# restart network -sudo rm /etc/udev/rules.d/70-persistent-net.rules -sudo /etc/init.d/network restart http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/redHatAndDerivatives/nat ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/redHatAndDerivatives/nat b/virtualbox/src/test/resources/redHatAndDerivatives/nat deleted file mode 100644 index a51482c..0000000 --- a/virtualbox/src/test/resources/redHatAndDerivatives/nat +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#!/bin/bash -sudo ip link set eth2 name eth1 -sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/ifcfg-eth1 -sudo chown toor.toor /tmp/ifcfg-eth1 -# configure eth1 -MAC_ETH1=`ifconfig -a | grep eth1 | awk '{ print $5}'`; sed "s/HWADDR.*/HWADDR\=\"$MAC_ETH1\"/g" /tmp/ifcfg-eth1 > /tmp/ifcfg-eth12; -sed "/UUID/d" /tmp/ifcfg-eth12 > /tmp/ifcfg-eth13; -sed "s/DEVICE.*/DEVICE\=\"eth1\"/g" /tmp/ifcfg-eth13 > /tmp/ifcfg-eth14; -sudo cp /tmp/ifcfg-eth14 /etc/sysconfig/network-scripts/ifcfg-eth1; -# restart network -sudo rm /etc/udev/rules.d/70-persistent-net.rules -sudo /etc/init.d/network restart http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh b/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh deleted file mode 100644 index 52fd3b9..0000000 --- a/virtualbox/src/test/resources/test_export_ip_address_from_vm_named.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set +u -shopt -s xpg_echo -shopt -s expand_aliases -unset PATH JAVA_HOME LD_LIBRARY_PATH -function abort { - echo "aborting: $@" 1>&2 - exit 1 -} -function exportIpAddressFromVmNamed { - unset FOUND_IP_ADDRESS; - [ $# -eq 1 ] || { - abort "exportIpAddressFromVmNamed requires virtual machine name parameter" - return 1 - } - local VMNAME="$0"; shift - local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14` - [ -n "$_FOUND" ] && { - export FOUND_IP_ADDRESS=$_FOUND - echo [$FOUND_IP_ADDRESS] - return 0 - } || { - return 1 - } -} -export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin -exportIpAddressFromVmNamed $@ || exit 1 -echo $FOUND_IP_ADDRESS -exit $? http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_get_ip_address.cmd ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/test_get_ip_address.cmd b/virtualbox/src/test/resources/test_get_ip_address.cmd deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_get_ip_address.sh ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/test_get_ip_address.sh b/virtualbox/src/test/resources/test_get_ip_address.sh deleted file mode 100644 index 41d46af..0000000 --- a/virtualbox/src/test/resources/test_get_ip_address.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set +u -shopt -s xpg_echo -shopt -s expand_aliases -unset PATH JAVA_HOME LD_LIBRARY_PATH -function abort { - echo "aborting: $@" 1>&2 - exit 1 -} -function getIpAddress { - unset FOUND_IP_ADDRESS; - [ $# -eq 1 ] || { - abort "installGuestAdditions requires virtual machine name parameter" - return 1 - } - local VMNAME="$0"; shift - local _FOUND=`VBoxManage guestproperty enumerate "$VMNAME" --patterns "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $4 }' | cut -c 1-14` - [ -n "$_FOUND" ] && { - export FOUND_IP_ADDRESS=$_FOUND - echo [$FOUND_IP_ADDRESS] - return 0 - } || { - return 1 - } -} -export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin -getIpAddress $@ || exit 1 -echo $FOUND_IP_ADDRESS -exit 0 http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_guest_additions_installer.sh ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/test_guest_additions_installer.sh b/virtualbox/src/test/resources/test_guest_additions_installer.sh deleted file mode 100644 index 493a1df..0000000 --- a/virtualbox/src/test/resources/test_guest_additions_installer.sh +++ /dev/null @@ -1,6 +0,0 @@ -setupPublicCurl || return 1 -(mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.1.6.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET http://download.virtualbox.org/virtualbox/4.1.6/VBoxGuestAdditions_4.1.6.iso >VBoxGuestAdditions_4.1.6.iso) -mount -o loop /tmp/VBoxGuestAdditions_4.1.6.iso /mnt -installModuleAssistantIfNeeded || return 1 -/mnt/VBoxLinuxAdditions.run -umount /mnt http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/resources/test_guest_additions_installer_init.sh ---------------------------------------------------------------------- diff --git a/virtualbox/src/test/resources/test_guest_additions_installer_init.sh b/virtualbox/src/test/resources/test_guest_additions_installer_init.sh deleted file mode 100644 index ac192e6..0000000 --- a/virtualbox/src/test/resources/test_guest_additions_installer_init.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/bash -set +u -shopt -s xpg_echo -shopt -s expand_aliases -unset PATH JAVA_HOME LD_LIBRARY_PATH -function abort { - echo "aborting: $@" 1>&2 - exit 1 -} -function default { - export INSTANCE_NAME="install_guest_additions" -export INSTANCE_HOME="/tmp/$INSTANCE_NAME" -export LOG_DIR="$INSTANCE_HOME" - return $? -} -function install_guest_additions { - return $? -} -function findPid { - unset FOUND_PID; - [ $# -eq 1 ] || { - abort "findPid requires a parameter of pattern to match" - return 1 - } - local PATTERN="$1"; shift - local _FOUND=`ps auxwww|grep "$PATTERN"|grep -v " $0"|grep -v grep|grep -v $$|awk '{print $2}'` - [ -n "$_FOUND" ] && { - export FOUND_PID=$_FOUND - return 0 - } || { - return 1 - } -} -function forget { - unset FOUND_PID; - [ $# -eq 3 ] || { - abort "forget requires parameters INSTANCE_NAME SCRIPT LOG_DIR" - return 1 - } - local INSTANCE_NAME="$1"; shift - local SCRIPT="$1"; shift - local LOG_DIR="$1"; shift - mkdir -p $LOG_DIR - findPid $INSTANCE_NAME - [ -n "$FOUND_PID" -a -f $LOG_DIR/stdout.log ] && { - echo $INSTANCE_NAME already running pid $FOUND_PID - return 1; - } || { - nohup $SCRIPT >$LOG_DIR/stdout.log 2>$LOG_DIR/stderr.log & - RETURN=$? - # this is generally followed by findPid, so we shouldn't exit - # immediately as the proc may not have registered in ps, yet - test $RETURN && sleep 1 - return $RETURN; - } -} -export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin -case $1 in -init) - default || exit 1 - install_guest_additions || exit 1 - mkdir -p $INSTANCE_HOME - - # create runscript header - cat > $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT' - #!/bin/bash - set +u - shopt -s xpg_echo - shopt -s expand_aliases - - PROMPT_COMMAND='echo -ne \"\033]0;install_guest_additions\007\"' - export PATH=/usr/ucb/bin:/bin:/sbin:/usr/bin:/usr/sbin - - export INSTANCE_NAME='install_guest_additions' -END_OF_JCLOUDS_SCRIPT - cat >> $INSTANCE_HOME/install_guest_additions.sh <<-END_OF_JCLOUDS_SCRIPT - export INSTANCE_NAME='$INSTANCE_NAME' - export INSTANCE_HOME='$INSTANCE_HOME' - export LOG_DIR='$LOG_DIR' -END_OF_JCLOUDS_SCRIPT - cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT' - function abort { - echo "aborting: $@" 1>&2 - exit 1 -} -alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-update="apt-get update -qq" - -function ensure_cmd_or_install_package_apt(){ - local cmd=$1 - local pkg=$2 - - hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) -} - -function ensure_cmd_or_install_package_yum(){ - local cmd=$1 - local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg -} - -function ensure_netutils_apt() { - ensure_cmd_or_install_package_apt nslookup dnsutils - ensure_cmd_or_install_package_apt curl curl -} - -function ensure_netutils_yum() { - ensure_cmd_or_install_package_yum nslookup bind-utils - ensure_cmd_or_install_package_yum curl curl -} - -# most network services require that the hostname is in -# the /etc/hosts file, or they won't operate -function ensure_hostname_in_hosts() { - [ -n "$SSH_CONNECTION" ] && { - local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'` - } || { - local ipaddr=`hostname -i` - } - # NOTE: we blindly trust existing hostname settings in /etc/hosts - egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts -} - -# download locations for many services are at public dns -function ensure_can_resolve_public_dns() { - nslookup yahoo.com | grep yahoo.com > /dev/null || echo nameserver 208.67.222.222 >> /etc/resolv.conf -} - -function setupPublicCurl() { - ensure_hostname_in_hosts - if which dpkg &> /dev/null; then - ensure_netutils_apt - elif which rpm &> /dev/null; then - ensure_netutils_yum - else - abort "we only support apt-get and yum right now... please contribute!" - return 1 - fi - ensure_can_resolve_public_dns - return 0 -} -function installModuleAssistantIfNeeded { - unset OSNAME; - local OSNAME=`lsb_release -d -s | cut -d ' ' -f 1`; shift - if [ $OSNAME = 'Ubuntu' ] - then - echo "OS is Ubuntu" - apt-get -f -y -qq --force-yes install build-essential module-assistant; - m-a prepare -i - fi -} - -END_OF_JCLOUDS_SCRIPT - - # add desired commands from the user - cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT' - cd $INSTANCE_HOME - rm -f $INSTANCE_HOME/rc - trap 'echo $?>$INSTANCE_HOME/rc' 0 1 2 3 15 - setupPublicCurl || exit 1 - - (mkdir -p /tmp/ && cd /tmp/ && [ ! -f VBoxGuestAdditions_4.1.6.iso ] && curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -C - -X GET http://download.virtualbox.org/virtualbox/4.1.6/VBoxGuestAdditions_4.1.6.iso >VBoxGuestAdditions_4.1.6.iso) - - mount -o loop /tmp/VBoxGuestAdditions_4.1.6.iso /mnt - - installModuleAssistantIfNeeded || exit 1 - - /mnt/VBoxLinuxAdditions.run - - umount /mnt - -END_OF_JCLOUDS_SCRIPT - - # add runscript footer - cat >> $INSTANCE_HOME/install_guest_additions.sh <<-'END_OF_JCLOUDS_SCRIPT' - exit $? - -END_OF_JCLOUDS_SCRIPT - - chmod u+x $INSTANCE_HOME/install_guest_additions.sh - ;; -status) - default || exit 1 - findPid $INSTANCE_NAME || exit 1 - echo $FOUND_PID - ;; -stop) - default || exit 1 - findPid $INSTANCE_NAME || exit 1 - [ -n "$FOUND_PID" ] && { - echo stopping $FOUND_PID - kill -9 $FOUND_PID - } - ;; -start) - default || exit 1 - forget $INSTANCE_NAME $INSTANCE_HOME/$INSTANCE_NAME.sh $LOG_DIR || exit 1 - ;; -stdout) - default || exit 1 - cat $LOG_DIR/stdout.log - ;; -stderr) - default || exit 1 - cat $LOG_DIR/stderr.log - ;; -exitstatus) - default || exit 1 - [ -f $LOG_DIR/rc ] && cat $LOG_DIR/rc;; -tail) - default || exit 1 - tail $LOG_DIR/stdout.log - ;; -tailerr) - default || exit 1 - tail $LOG_DIR/stderr.log - ;; -run) - default || exit 1 - $INSTANCE_HOME/$INSTANCE_NAME.sh - ;; -esac -exit $?
