diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hydra/functions | 2 | ||||
-rw-r--r-- | lib/hydra/provision | 45 |
2 files changed, 47 insertions, 0 deletions
diff --git a/lib/hydra/functions b/lib/hydra/functions index e6cf4a0..84590e5 100644 --- a/lib/hydra/functions +++ b/lib/hydra/functions @@ -10,6 +10,8 @@ source $APP_BASE/lib/hydra/usage source $APP_BASE/lib/hydra/action source $APP_BASE/lib/hydra/backup source $APP_BASE/lib/hydra/config +source $APP_BASE/lib/hydra/deploy +source $APP_BASE/lib/hydra/provision source $APP_BASE/lib/hydra/tmpfile # Setup environment diff --git a/lib/hydra/provision b/lib/hydra/provision new file mode 100644 index 0000000..5c85e04 --- /dev/null +++ b/lib/hydra/provision @@ -0,0 +1,45 @@ +#!/bin/bash + +# Load provision configuration +function hydra_provision_load_config { +if [ ! -z "$1" ]; then + if [ -f "$1" ]; then + echo "Using configuration from file $1..." + source "$1" + elif [ -f "$1.conf" ]; then + echo "Using configuration from file $1.conf..." + source "$1.conf" + elif [ -f "$HYDRA_FOLDER/config/provision/$1" ]; then + echo "Using configuration from $HYDRA_FOLDER/config/provision/$1..." + source "$HYDRA_FOLDER/config/provision/$1" + elif [ -f "$HYDRA_FOLDER/config/provision/$1.conf" ]; then + echo "Using configuration from $HYDRA_FOLDER/config/provision/$1.conf..." + source "$HYDRA_FOLDER/config/provision/$1.conf" + elif [ -f "$APP_BASE/share/config/provision/$1" ]; then + echo "Using configuration from $APP_BASE/share/config/provision/$1..." + source "$APP_BASE/share/config/provision/$1" + elif [ -f "$APP_BASE/share/config/provision/$1.conf" ]; then + echo "Using configuration from $APP_BASE/share/config/provision/$1.conf..." + source "$APP_BASE/share/config/provision/$1.conf" + else + echo "Profile not found: $1" + exit 1 + fi +fi +} + +# Networking. +function hydra_provision_networking { + echo "Doing a basic network config..." + cat <<-EOF | $SUDO tee $WORK/etc/network/interfaces > /dev/null +auto eth0 +allow-hotplug eth0 +iface eth0 inet dhcp +EOF +} + +function hydra_provision_fingerprints { + echo "OpenSSH fingerprints:" + hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub + hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub +} |