mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
Merge pull request #345 from crawford/ami
Clean up AKI lists and bump to 1.04
This commit is contained in:
commit
edae8bb5e0
@ -5,24 +5,11 @@
|
|||||||
# mad props to Eric Hammond for the initial script
|
# mad props to Eric Hammond for the initial script
|
||||||
# https://github.com/alestic/alestic-hardy-ebs/blob/master/bin/alestic-hardy-ebs-build-ami
|
# https://github.com/alestic/alestic-hardy-ebs/blob/master/bin/alestic-hardy-ebs-build-ami
|
||||||
|
|
||||||
# AKI ids from:
|
|
||||||
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
|
|
||||||
# we need pv-grub-hd00 x86_64
|
|
||||||
|
|
||||||
# Set pipefail along with -e in hopes that we catch more errors
|
# Set pipefail along with -e in hopes that we catch more errors
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
declare -A AKI
|
DIR=$(dirname $0)
|
||||||
AKI["us-east-1"]=aki-b4aa75dd
|
source $DIR/regions.sh
|
||||||
AKI["us-west-1"]=aki-eb7e26ae
|
|
||||||
AKI["us-west-2"]=aki-f837bac8
|
|
||||||
AKI["eu-west-1"]=aki-8b655dff
|
|
||||||
AKI["eu-central-1"]=aki-184c7a05
|
|
||||||
AKI["ap-southeast-1"]=aki-fa1354a8
|
|
||||||
AKI["ap-southeast-2"]=aki-3d990e07
|
|
||||||
AKI["ap-northeast-1"]=aki-40992841
|
|
||||||
AKI["sa-east-1"]=aki-c88f51d5
|
|
||||||
# AKI["gov-west-1"]=aki-75a4c056
|
|
||||||
|
|
||||||
readonly COREOS_EPOCH=1372636800
|
readonly COREOS_EPOCH=1372636800
|
||||||
VERSION="master"
|
VERSION="master"
|
||||||
@ -110,7 +97,7 @@ description="CoreOS $GROUP $VERSION"
|
|||||||
zoneurl=http://instance-data/latest/meta-data/placement/availability-zone
|
zoneurl=http://instance-data/latest/meta-data/placement/availability-zone
|
||||||
zone=$(curl --fail -s $zoneurl)
|
zone=$(curl --fail -s $zoneurl)
|
||||||
region=$(echo $zone | sed 's/.$//')
|
region=$(echo $zone | sed 's/.$//')
|
||||||
akiid=${AKI[$region]}
|
akiid=${ALL_AKIS[$region]}
|
||||||
|
|
||||||
if [ -z "$akiid" ]; then
|
if [ -z "$akiid" ]; then
|
||||||
echo "$0: Can't identify AKI, using region: $region" >&2
|
echo "$0: Can't identify AKI, using region: $region" >&2
|
||||||
|
@ -12,17 +12,8 @@
|
|||||||
# Set pipefail along with -e in hopes that we catch more errors
|
# Set pipefail along with -e in hopes that we catch more errors
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
declare -A AKI
|
DIR=$(dirname $0)
|
||||||
AKI["us-east-1"]=aki-b4aa75dd
|
source $DIR/regions.sh
|
||||||
AKI["us-west-1"]=aki-eb7e26ae
|
|
||||||
AKI["us-west-2"]=aki-f837bac8
|
|
||||||
AKI["eu-west-1"]=aki-8b655dff
|
|
||||||
AKI["eu-central-1"]=aki-184c7a05
|
|
||||||
AKI["ap-southeast-1"]=aki-fa1354a8
|
|
||||||
AKI["ap-southeast-2"]=aki-3d990e07
|
|
||||||
AKI["ap-northeast-1"]=aki-40992841
|
|
||||||
AKI["sa-east-1"]=aki-c88f51d5
|
|
||||||
# AKI["gov-west-1"]=aki-75a4c056
|
|
||||||
|
|
||||||
USAGE="Usage: $0 -a ami-id
|
USAGE="Usage: $0 -a ami-id
|
||||||
-a ami-id ID of the AMI to be coppied.
|
-a ami-id ID of the AMI to be coppied.
|
||||||
@ -42,7 +33,7 @@ GROUP="alpha"
|
|||||||
REGIONS=()
|
REGIONS=()
|
||||||
|
|
||||||
add_region() {
|
add_region() {
|
||||||
if [[ -z "${AKI[$1]}" ]]; then
|
if [[ -z "${ALL_REGIONS[$1]}" ]]; then
|
||||||
echo "Invalid region '$1'" >&2;
|
echo "Invalid region '$1'" >&2;
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -105,7 +96,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${#REGIONS[@]} -eq 0 ]]; then
|
if [[ ${#REGIONS[@]} -eq 0 ]]; then
|
||||||
REGIONS=( "${!AKI[@]}" )
|
REGIONS=( "${ALL_REGIONS[@]}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The name has a limited set of allowed characterrs
|
# The name has a limited set of allowed characterrs
|
||||||
|
@ -3,17 +3,8 @@
|
|||||||
# Set pipefail along with -e in hopes that we catch more errors
|
# Set pipefail along with -e in hopes that we catch more errors
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
REGIONS=(
|
DIR=$(dirname $0)
|
||||||
us-east-1
|
source $DIR/regions.sh
|
||||||
us-west-1
|
|
||||||
us-west-2
|
|
||||||
eu-west-1
|
|
||||||
eu-central-1
|
|
||||||
ap-southeast-1
|
|
||||||
ap-southeast-2
|
|
||||||
ap-northeast-1
|
|
||||||
sa-east-1
|
|
||||||
)
|
|
||||||
|
|
||||||
USAGE="Usage: $0 -V 100.0.0
|
USAGE="Usage: $0 -V 100.0.0
|
||||||
-V VERSION Find AMI by CoreOS version. (required)
|
-V VERSION Find AMI by CoreOS version. (required)
|
||||||
@ -63,7 +54,7 @@ fi
|
|||||||
|
|
||||||
search_name=$(clean_version "CoreOS-$GROUP-$VER")
|
search_name=$(clean_version "CoreOS-$GROUP-$VER")
|
||||||
declare -A AMIS HVM_AMIS
|
declare -A AMIS HVM_AMIS
|
||||||
for r in "${REGIONS[@]}"; do
|
for r in "${ALL_REGIONS[@]}"; do
|
||||||
AMI=$(ec2-describe-images --region=${r} -F name="${search_name}" \
|
AMI=$(ec2-describe-images --region=${r} -F name="${search_name}" \
|
||||||
| grep -m1 ^IMAGE | cut -f2) || true
|
| grep -m1 ^IMAGE | cut -f2) || true
|
||||||
if [[ -z "$AMI" ]]; then
|
if [[ -z "$AMI" ]]; then
|
||||||
|
16
oem/ami/regions.sh
Normal file
16
oem/ami/regions.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# AKI ids from:
|
||||||
|
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
|
||||||
|
# These are pv-grub-hd0_1.04-x86_64
|
||||||
|
|
||||||
|
declare -A ALL_AKIS
|
||||||
|
ALL_AKIS["us-east-1"]=aki-919dcaf8
|
||||||
|
ALL_AKIS["us-west-1"]=aki-880531cd
|
||||||
|
ALL_AKIS["us-west-2"]=aki-fc8f11cc
|
||||||
|
ALL_AKIS["eu-west-1"]=aki-52a34525
|
||||||
|
ALL_AKIS["eu-central-1"]=aki-184c7a05
|
||||||
|
ALL_AKIS["ap-southeast-1"]=aki-503e7402
|
||||||
|
ALL_AKIS["ap-southeast-2"]=aki-c362fff9
|
||||||
|
ALL_AKIS["ap-northeast-1"]=aki-176bf516
|
||||||
|
ALL_AKIS["sa-east-1"]=aki-5553f448
|
||||||
|
|
||||||
|
ALL_REGIONS=( "${!ALL_AKIS[@]}" )
|
Loading…
x
Reference in New Issue
Block a user