Linode StackScript Functions Library

by forinfor
0 deployments · 0 still active · last rev. 2 months ago

This StackScript is a reusable library of Linode StackScript-specific bash functions. Include in other bash StackScripts with a "source <ssinclude StackScriptID=36214>" line.

Does nothing on its own. Do not deploy directly!

Compatible with: Arch 2016.06.01, CentOS 7, Debian 7, Debian 8, Fedora 24, Gentoo 2014.12, openSUSE Leap 42.1, Slackware 14.1, Ubuntu 14.04 LTS, Ubuntu 16.04 LTS
						#!/bin/bash
# Copyright (c) 2016 Forinfor / Steve Kovacs <steve.kovacs@forinfor.com>
# Distributed under the terms of the GNU General Public License v2
# Linode StackScript - Additional Linode specific functions library
#-------------------------------------------------------------------------------------

# -----------------------------------
# Datacenter facts that can be used in a StackScript without utilizing the API
# For example use a region specific mirror or download site.
# -----------------------------------
function datacenter_facts () {
	case "${LINODE_DATACENTERID}" in
		2|3|4|6)
			datacenter_region="North America"
			case "${LINODE_DATACENTERID}" in
				2)
					datacenter_location="Dallas TX, USA"
					datacenter_timezone="Central"
					;;
				3)
					datacenter_location="Freemont CA, USA"
					datacenter_timezone="Pacific"
					;;
				4)
					datacenter_location="Atlanta GA, USA"
					datacenter_timezone="Eastern"
					;;
				6)
					datacenter_location="Newark, NJ, USA"
					datacenter_timezone="Eastern"
					;;
			esac
			;;
		7|10)
			datacenter_region="Europe"
			case "${LINODE_DATACENTERID}" in
				7)
					datacenter_location="London, England, UK"
					datacenter_timezone="London"
					;;
				10)
					datacenter_location="Frankfurt, DE"
					datacenter_timezone="Berlin"
					;;
			esac
			;;
		8|9)
			datacenter_region="Asia"
			case "${LINODE_DATACENTERID}" in
				8)
					datacenter_location="Tokyo, JP"
					datacenter_timezone="Tokyo"
					;;
				9)
					datacenter_location="Singapore, SG"
					datacenter_timezone="Singapore"
					;;
			esac
			;;
	esac

}