diff options
author | Scott Moser <smoser@ubuntu.com> | 2010-01-29 13:19:09 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2010-01-29 13:19:09 -0500 |
commit | 994a9a7d53fcbba2c3804633f80775970ece1a80 (patch) | |
tree | 55b358108803443b696688d5e45e949d1fdac2ac /ec2-is-compat-env | |
parent | df2da98467e14d3e999495e8abfa3727dae63cf0 (diff) | |
download | vyos-cloud-init-994a9a7d53fcbba2c3804633f80775970ece1a80.tar.gz vyos-cloud-init-994a9a7d53fcbba2c3804633f80775970ece1a80.zip |
remove ec2-is-compat-env and minor changes to setup.py
Diffstat (limited to 'ec2-is-compat-env')
-rw-r--r-- | ec2-is-compat-env | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/ec2-is-compat-env b/ec2-is-compat-env deleted file mode 100644 index c987fe6f..00000000 --- a/ec2-is-compat-env +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# vi: ts=4 noexpandtab syntax=sh - -ETC_CONFIG=/etc/ec2-init/is-compat-env -CONFIG_ACTIVE_VAR="compat" -CMDLINE_EC2_COMPAT=ec2init -CR=" -" -VERBOSE=1 -META_DATA_URL=http://169.254.169.254/2009-04-04 -check_md=0 - -Usage() { - cat <<EOF -Usage: ${0##*/} [options] - indicate whether or not this appears to be an ec2 environment - a exit value: - 0 indicates this is ec2 - 1 indicates this is not ec2 - -options: - -h | --help display usage - -m | --meta-data check metadata service - -q | --quiet do not output 'yes' or 'no', only exit properly -EOF -} - -xit() { - ret=${1:-1} - if [ "${VERBOSE}" != "0" ]; then - [ "$ret" = "0" ] && echo yes || echo no - fi - exit "$ret"; -} - -while [ $# -ne 0 ]; do - case "$1" in - -q|--quiet) VERBOSE=0;; - -h|--help) Usage; exit 0;; - -m|--use-meta-data) check_md=1;; - *) Usage 1>&2; exit 2;; - esac - shift; -done - -if [ ${check_md} -ne 0 ]; then - # if we are to check for meta data service - # then check first that there was something there. - index=$(wget --connect-timeout=2 --tries 2 -O - -q "${META_DATA_URL}") || - xit 1 - - # exit true if content of url a line with 'meta-data' at start - [ "${index#*${CR}meta-data}" = "${index}" ] || xit 0 - xit 1 -fi - -# if /proc/cmdline exists and has certain tokens, trust them -# even before looking at config file -if [ -e /proc/cmdline ] && read cmdline < /proc/cmdline; then - # if cmdline has certain tokens in it, trust them - case " ${cmdline} " in - *\ ${CMDLINE_EC2_COMPAT}=1\ *) xit 0;; - *\ ${CMDLINE_EC2_COMPAT}=0\ *) xit 1;; - esac -fi - -# if the config file exists and has a non-empty value set for -# CONFIG_ACTIVE_VAR trust it as definitive source. If no value is set -# fall through -if [ -e "${ETC_CONFIG}" ] && - active=$(sh -c "unset ${CONFIG_ACTIVE_VAR}; - . '${ETC_CONFIG}'; echo \${${CONFIG_ACTIVE_VAR}}") && - [ -n "${active}" ]; then - [ "$active" = "1" ] && xit 0 - xit 1 -fi - -xit 1 |