Skip to content

Commit

Permalink
Move non-user facing files to scripts/
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielThomas committed Oct 30, 2016
1 parent f32dcda commit 4de1e57
Show file tree
Hide file tree
Showing 23 changed files with 14 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ec2gaming.ovpn
ec2gaming.rdp
ec2gaming.auth
ec2gaming.bat
ec2gaming-permissionpolicy.json
scripts/ec2gaming-permissionpolicy.json
scripts/ec2gaming.ovpn
scripts/ec2gaming.rdp

3 changes: 2 additions & 1 deletion ec2gaming
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
source "$(dirname "$0")/ec2gaming.header"
set -e
cd "$(dirname "$0")/scripts" || exit

COMMANDS=($(find . -name 'ec2gaming-*.sh' | sed 's/.*ec2gaming-//;s/\.sh//'))

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 1 addition & 7 deletions ec2gaming-start.sh → scripts/ec2gaming-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ source "$(dirname "$0")/ec2gaming.header"

BOOTSTRAP=0

if [ ! -f ec2gaming.auth ]; then
echo "ec2gaming.auth file not found!"
fi

echo -n "Getting lowest $INSTANCE_TYPE bid... "
PRICE_AND_ZONE=($(./ec2gaming-price.sh))
PRICE=${PRICE_AND_ZONE[0]}
Expand Down Expand Up @@ -50,9 +46,7 @@ if ! aws s3api head-bucket --bucket "$BUCKET" &> /dev/null; then
REGION=$(aws configure get region)
aws s3api create-bucket --bucket "$BUCKET" --region "$REGION" --create-bucket-configuration LocationConstraint="$REGION" > /dev/null
fi
USERNAME=$(head -1 ec2gaming.auth)
PASSWORD=$(tail -1 ec2gaming.auth)
sed "s/BUCKET/$BUCKET/g;s/USERNAME/$USERNAME/g;s/PASSWORD/$PASSWORD/g" ec2gaming.bat.template > ec2gaming.bat
sed "s/BUCKET/$BUCKET/g;s/USERNAME/$USERNAME/g;s/PASSWORD/$PASSWORD/g" ec2gaming.bat.template > ../ec2gaming.bat
echo "$BUCKET"

PROFILE_NAME="ec2gaming"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions ec2gaming-vnc.sh → scripts/ec2gaming-vnc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env bash
source "$(dirname "$0")/ec2gaming.header"

USERNAME=$(head -1 ec2gaming.auth)
PASSWORD=$(tail -1 ec2gaming.auth)
open "vnc://$USERNAME:$PASSWORD@10.8.0.1"
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions ec2gaming-vpnup.sh → scripts/ec2gaming-vpnup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ source "$(dirname "$0")/ec2gaming.header"

echo -n "Connecting VPN (you may see an authentication prompt)... "
IP=$(./ec2gaming-ip.sh)
AUTH=$(realpath "$(pwd)/../ec2gaming.auth")
BACKING_CONFIG=~/Library/Application\ Support/Tunnelblick/Configurations/ec2gaming.tblk/Contents/Resources/config.ovpn
if [ ! -f "$BACKING_CONFIG" ]; then
sed "s#IP#$IP#g;s#AUTH#$(pwd)/ec2gaming.auth#g" ec2gaming.ovpn.template > ec2gaming.ovpn
sed "s#IP#$IP#g;s#AUTH#$AUTH#g" ec2gaming.ovpn.template > ec2gaming.ovpn
open ec2gaming.ovpn
echo "Waiting 10 seconds for import..."
sleep 10
else
# the authentication prompt on copy will block, avoids the messy sleep
sed "s#IP#$IP#g;s#AUTH#$(pwd)/ec2gaming.auth#g" ec2gaming.ovpn.template > "$BACKING_CONFIG"
sed "s#IP#$IP#g;s#AUTH#$AUTH#g" ec2gaming.ovpn.template > "$BACKING_CONFIG"
fi

osascript ec2gaming-vpnup.scpt
File renamed without changes.
5 changes: 4 additions & 1 deletion ec2gaming.header → scripts/ec2gaming.header
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
set -e
cd "$(dirname "$0")" || exit
source ec2gaming.cfg
source ../ec2gaming.cfg

USERNAME=$(head -1 ../ec2gaming.auth)
PASSWORD=$(tail -1 ../ec2gaming.auth)

describe_gaming_image() {
aws ec2 describe-images --owner "$1" --filters Name=name,Values=ec2gaming
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4de1e57

Please sign in to comment.