Branding updates to training-labs
* Rename folder oslabs to labs. * Updates due to folder rename. * Update branding to training-labs. * Update sphinx build related content. Change-Id: I47721636102f01c007a61074ee843caadb4baaf4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/labs.git
|
||||
project=openstack/training-labs.git
|
||||
|
||||
@@ -30,10 +30,9 @@ Pre-requisite
|
||||
How to run the scripts
|
||||
----------------------
|
||||
|
||||
.. TODO(psalunke: fix me)
|
||||
1. Clone the training-labs repository:
|
||||
|
||||
$
|
||||
$ git clone git://git.openstack.org/openstack/training-labs.git
|
||||
|
||||
This will take some time to run the first time.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
: ${VBM_EXE:=$(which VBoxManage)}
|
||||
|
||||
# VirtualBox VM group
|
||||
: ${VM_GROUP:=oslabs}
|
||||
: ${VM_GROUP:=labs}
|
||||
|
||||
# VirtualBox VM GUI type
|
||||
: ${VM_UI:=headless}
|
||||
@@ -5,13 +5,13 @@ About
|
||||
-----
|
||||
|
||||
By default, osbash will put into this directory its base disk images
|
||||
(base-*-<distro>.vdi), the VM export images (oslabs-<distro>.ova),
|
||||
(base-*-<distro>.vdi), the VM export images (labs-<distro>.ova),
|
||||
and all installation ISO images it may download.
|
||||
|
||||
- 'img' folder stores all the base disk and ISO images.
|
||||
- To find individual virtualbox disk images, please look into the
|
||||
virtualbox default machine folder.
|
||||
- For Linux: "~/VirtualBox/oslabs/"
|
||||
- For Linux: "~/VirtualBox/labs/"
|
||||
- In case your default folder is at another location (manually set)
|
||||
please get the location by opening the VirtualBox GUI at this location
|
||||
"File>Preferences>General>Default Machine Folder"
|
||||
@@ -88,9 +88,9 @@ while getopts :be:g:-:hnt:w opt; do
|
||||
case $opt in
|
||||
e)
|
||||
if [ "$OPTARG" = ova ]; then
|
||||
EXPORT_OVA=$IMG_DIR/oslabs-$DISTRO.ova
|
||||
EXPORT_OVA=$IMG_DIR/labs-$DISTRO.ova
|
||||
elif [ "$OPTARG" = dir ]; then
|
||||
EXPORT_VM_DIR=$IMG_DIR/oslabs-$DISTRO
|
||||
EXPORT_VM_DIR=$IMG_DIR/labs-$DISTRO
|
||||
else
|
||||
echo -e "${CError:-}Error: -e argument must be ova or dir${CReset:-}"
|
||||
exit
|
||||
@@ -19,7 +19,7 @@ Test StackTrain!
|
||||
Tests for `stacktrain` module.
|
||||
"""
|
||||
|
||||
from oslabs.tests import base
|
||||
from labs.tests import base
|
||||
|
||||
|
||||
class TestLabs(base.TestCase):
|
||||
@@ -1,9 +0,0 @@
|
||||
This directory contains bash libraries used by scripts.
|
||||
|
||||
Configuration files for kickstart (Fedora) and preseed (Ubuntu) are in
|
||||
osbash/netboot.
|
||||
|
||||
The osbash-ssh-keys can be automatically installed into osbash
|
||||
VMs to make them accessible.
|
||||
|
||||
The templates used to build Windows batch files are in the wbatch subdirectory.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,441 +0,0 @@
|
||||
# This file contains bash functions that may be used by guest systems (VMs).
|
||||
|
||||
# Sourcing this file calls functions fix_path_env and source_deploy.
|
||||
|
||||
source "$LIB_DIR/functions.sh"
|
||||
source "$LIB_DIR/functions-common-devstack"
|
||||
|
||||
# Make devstack's operating system identification work with nounset
|
||||
function init_os_ident {
|
||||
if [[ -z "${os_PACKAGE:-""}" ]]; then
|
||||
GetOSVersion
|
||||
fi
|
||||
}
|
||||
|
||||
function source_deploy {
|
||||
if [ -n "${VM_SHELL_USER:-}" ]; then
|
||||
# Already sourced
|
||||
return 0
|
||||
fi
|
||||
if mountpoint -q /vagrant; then
|
||||
source "$CONFIG_DIR/deploy.vagrant"
|
||||
else
|
||||
source "$CONFIG_DIR/deploy.osbash"
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# If our sudo user's PATH is preserved (and does not contain sbin dirs),
|
||||
# some commands won't be found. Observed with Vagrant shell provisioner
|
||||
# scripts using sudo after "su - vagrant".
|
||||
# Adding to the path seems preferable to messing with the vagrant user's
|
||||
# sudoers environment (or working with a separate Vagrant user).
|
||||
|
||||
function fix_path_env {
|
||||
if is_root; then return 0; fi
|
||||
if echo 'echo $PATH'|sudo sh|grep -q '/sbin'; then return 0; fi
|
||||
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
function zero_empty_space {
|
||||
echo "Filling empty disk space with zeros"
|
||||
sudo dd if=/dev/zero of=/filler bs=1M 2>/dev/null || true
|
||||
sudo rm /filler
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# For guest scripts to let osbash know they are running; used when osbashauto
|
||||
# runs scripts inside of the VM (STATUS_DIR directory must be shared between
|
||||
# host and VM).
|
||||
|
||||
function indicate_current_auto {
|
||||
if [ "${VM_SHELL_USER:-}" = "osbash" ]; then
|
||||
local scr_name=${1:-$(basename "$0")}
|
||||
local fpath=${2:-"/$STATUS_DIR/$scr_name.begin"}
|
||||
mkdir -p "$STATUS_DIR"
|
||||
touch "$fpath"
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Debug function to make a script halt execution until a tmp file is removed
|
||||
|
||||
function wait_for_file {
|
||||
# If no argument is passed, use empty string (to pass nounset option)
|
||||
local msg=${1-""}
|
||||
local wait_file=remove_to_continue
|
||||
[ -n "$msg" ] && wait_file=${wait_file}_${msg}
|
||||
touch "/tmp/$wait_file"
|
||||
while [ -e "/tmp/$wait_file" ]; do
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copy stdin/stderr to log file
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function exec_logpath {
|
||||
local log_path=$1
|
||||
|
||||
# Append all stdin and stderr to log file
|
||||
exec > >(tee -a "$log_path") 2>&1
|
||||
}
|
||||
|
||||
function exec_logfile {
|
||||
local log_dir=${1:-/home/$VM_SHELL_USER/log}
|
||||
|
||||
# Default extension is log
|
||||
local ext=${2:-log}
|
||||
|
||||
mkdir -p "$log_dir"
|
||||
|
||||
# Log name based on name of running script
|
||||
local base_name=$(basename "$0" .sh)
|
||||
|
||||
local prefix=$(get_next_prefix "$log_dir" "$ext")
|
||||
local log_name="${prefix}_$base_name.$ext"
|
||||
|
||||
exec_logpath "$log_dir/$log_name"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions that need to run as root
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function as_root_fix_mount_vboxsf_link {
|
||||
local file=/sbin/mount.vboxsf
|
||||
if [ -L $file -a ! -e $file ]; then
|
||||
echo "$file is a broken symlink. Trying to fix it."
|
||||
shopt -s nullglob
|
||||
local new=(/opt/VBoxGuestAdditions*/lib/VBoxGuestAdditions)
|
||||
if [ -n "$new" ]; then
|
||||
ln -sv "$new" /usr/lib/VBoxGuestAdditions
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function as_root_inject_sudoer {
|
||||
if grep -q "${VM_SHELL_USER}" /etc/sudoers; then
|
||||
echo "${VM_SHELL_USER} already in /etc/sudoers"
|
||||
else
|
||||
echo "${VM_SHELL_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:${VM_SHELL_USER} !requiretty" >> /etc/sudoers
|
||||
fi
|
||||
}
|
||||
|
||||
# Change to a regular user to execute a guest script (and log its output)
|
||||
|
||||
function as_root_exec_script {
|
||||
local script_path=$1
|
||||
local script_name="$(basename "$script_path" .sh)"
|
||||
|
||||
echo "$(date) start $script_path"
|
||||
|
||||
local prefix=$(get_next_prefix "$LOG_DIR" "auto")
|
||||
local log_path=$LOG_DIR/${prefix}_$script_name.auto
|
||||
|
||||
su - "$VM_SHELL_USER" -c "bash $script_path" >"$log_path" 2>&1
|
||||
local rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "$(date) ERROR: status $rc for $script_path" |
|
||||
tee >&2 -a "$LOG_DIR/error.log"
|
||||
else
|
||||
echo "$(date) done"
|
||||
fi
|
||||
return $rc
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Root wrapper around devstack function for manipulating config files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function iniset_sudo {
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(mktemp)
|
||||
# Create a temporary copy, work on it, and copy it back into place
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
iniset "$tmpfile" "$@"
|
||||
cat "$tmpfile" | sudo tee "$file" >/dev/null
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions for manipulating config files without section
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function iniset_sudo_no_section {
|
||||
local file=$1
|
||||
shift
|
||||
local tmpfile=$(mktemp)
|
||||
# Create a temporary copy, work on it, and copy it back into place
|
||||
sudo cp -fv "$file" "$tmpfile"
|
||||
iniset_no_section "$tmpfile" "$@"
|
||||
cat "$tmpfile" | sudo tee "$file" >/dev/null
|
||||
}
|
||||
|
||||
# ini_has_option_no_section config-file option
|
||||
function ini_has_option_no_section {
|
||||
local xtrace=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
local file=$1
|
||||
local option=$2
|
||||
local line
|
||||
line=$(sed -ne "/^$option[ \t]*=/ p;" "$file")
|
||||
$xtrace
|
||||
[ -n "$line" ]
|
||||
}
|
||||
|
||||
# Set an option in an INI file
|
||||
# iniset_no_section config-file option value
|
||||
function iniset_no_section {
|
||||
local xtrace=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
local file=$1
|
||||
local option=$2
|
||||
local value=$3
|
||||
|
||||
[[ -z $option ]] && return
|
||||
|
||||
if ! ini_has_option_no_section "$file" "$option"; then
|
||||
# Add it
|
||||
sed -i -e "1 i\
|
||||
$option = $value
|
||||
" "$file"
|
||||
else
|
||||
local sep=$(echo -ne "\x01")
|
||||
# Replace it
|
||||
sed -i -e "/$option/ c\
|
||||
$option = $value
|
||||
" "$file"
|
||||
fi
|
||||
$xtrace
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# OpenStack helpers
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function mysql_exe {
|
||||
local cmd="$1"
|
||||
echo "MySQL cmd: $cmd."
|
||||
mysql -u "root" -p"$DATABASE_PASSWORD" -e "$cmd"
|
||||
}
|
||||
|
||||
function setup_database {
|
||||
local service=$1
|
||||
local db_user=$(service_to_db_user $service)
|
||||
local db_password=$(service_to_db_password $service)
|
||||
mysql_exe "CREATE DATABASE $service"
|
||||
mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'%' IDENTIFIED BY '$db_password';"
|
||||
mysql_exe "GRANT ALL ON ${service}.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_password';"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Users for service-specific MySQL databases
|
||||
|
||||
function service_to_db_user {
|
||||
local service_name=$1
|
||||
echo "${service_name}User"
|
||||
}
|
||||
|
||||
function service_to_db_password {
|
||||
local service_name=$1
|
||||
echo "${service_name}Pass"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Service-specific users in keystone
|
||||
|
||||
function service_to_user_name {
|
||||
local service_name=$1
|
||||
echo "${service_name}"
|
||||
}
|
||||
|
||||
function service_to_user_password {
|
||||
local service_name=$1
|
||||
echo "${service_name}_pass"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Network configuration
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Fedora /etc/sysconfig/network-scripts/ifcfg-* configuration
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
function _ifnum_to_ifname_fedora {
|
||||
local if_num=$1
|
||||
local -a if_names=('p2p1' 'p7p1' 'p8p1' 'p9p1')
|
||||
|
||||
echo "${if_names[$if_num]}"
|
||||
}
|
||||
|
||||
function _config_sysconfig_nat {
|
||||
local if_num=$1
|
||||
|
||||
local if_name="$(_ifnum_to_ifname_fedora "$if_num")"
|
||||
|
||||
local if_file=/etc/sysconfig/network-scripts/ifcfg-$if_name
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
" "$TEMPLATE_DIR/template-fedora-ifcfg-nat" | sudo tee "$if_file"
|
||||
}
|
||||
|
||||
function _config_sysconfig_hostonly {
|
||||
local if_num=$1
|
||||
local ip_address=$2
|
||||
|
||||
local if_name="$(_ifnum_to_ifname_fedora "$if_num")"
|
||||
|
||||
local if_file=/etc/sysconfig/network-scripts/ifcfg-$if_name
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
s,%IP_ADDRESS%,$ip_address,g;
|
||||
" "$TEMPLATE_DIR/template-fedora-ifcfg-hostonly" | sudo tee "$if_file"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Ubuntu /etc/network/interfaces configuration
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
readonly UBUNTU_IF_FILE=/etc/network/interfaces
|
||||
|
||||
function _ifnum_to_ifname_ubuntu {
|
||||
local if_num=$1
|
||||
local -a if_names=('eth0' 'eth1' 'eth2' 'eth3')
|
||||
|
||||
echo "${if_names[$if_num]}"
|
||||
}
|
||||
|
||||
|
||||
function _config_interfaces_nat {
|
||||
local if_num=$1
|
||||
|
||||
local if_name="$(_ifnum_to_ifname_ubuntu "$if_num")"
|
||||
|
||||
# Empty line before this entry
|
||||
echo | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
" "$TEMPLATE_DIR/template-ubuntu-interfaces-nat" | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
}
|
||||
|
||||
function _config_interfaces_hostonly {
|
||||
local if_num=$1
|
||||
local ip_address=$2
|
||||
|
||||
local if_name="$(_ifnum_to_ifname_ubuntu "$if_num")"
|
||||
|
||||
# Empty line before this entry
|
||||
echo | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
|
||||
sed -e "
|
||||
s,%IF_NAME%,$if_name,g;
|
||||
s,%IP_ADDRESS%,$ip_address,g;
|
||||
" "$TEMPLATE_DIR/template-ubuntu-interfaces-hostonly" | sudo tee -a "$UBUNTU_IF_FILE"
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
function config_nat {
|
||||
local if_num=$1
|
||||
|
||||
init_os_ident
|
||||
if is_fedora; then
|
||||
echo _config_sysconfig_nat "$if_num"
|
||||
_config_sysconfig_nat "$if_num"
|
||||
else
|
||||
echo _config_interfaces_nat "$if_num"
|
||||
_config_interfaces_nat "$if_num"
|
||||
fi
|
||||
}
|
||||
|
||||
function config_hostonly {
|
||||
local if_num=$1
|
||||
local ip_address=$2
|
||||
|
||||
init_os_ident
|
||||
if is_fedora; then
|
||||
echo _config_sysconfig_hostonly "$if_num" "$ip_address"
|
||||
_config_sysconfig_hostonly "$if_num" "$ip_address"
|
||||
else
|
||||
echo _config_interfaces_hostonly "$if_num" "$ip_address"
|
||||
_config_interfaces_hostonly "$if_num" "$ip_address"
|
||||
fi
|
||||
}
|
||||
|
||||
function get_ip_from_net_and_fourth {
|
||||
local net_name=$1
|
||||
local net="${!net_name}"
|
||||
local fourth_octet=$2
|
||||
|
||||
echo "${net%.*}.$fourth_octet"
|
||||
}
|
||||
|
||||
function hostname_to_ip {
|
||||
local host_name=$1
|
||||
getent hosts "$host_name"|awk '{print $1}'
|
||||
}
|
||||
|
||||
function config_network {
|
||||
init_os_ident
|
||||
if is_ubuntu; then
|
||||
# Configuration functions will append to this file
|
||||
sudo cp -v "$TEMPLATE_DIR/template-ubuntu-interfaces-loopback" \
|
||||
"$UBUNTU_IF_FILE"
|
||||
fi
|
||||
|
||||
# Get FOURTH_OCTET and network interfaces (NET_IF_?) for this node
|
||||
unset -v NET_IF_0 NET_IF_1 NET_IF_2 NET_IF_3
|
||||
source "$CONFIG_DIR/config.$(hostname)"
|
||||
|
||||
# Get API_NET, DATA_NET, MGMT_NET
|
||||
source "$CONFIG_DIR/openstack"
|
||||
|
||||
# Iterate over all NET_IF_? variables
|
||||
local net_ifs=( "${!NET_IF_@}" )
|
||||
local net_if=""
|
||||
for net_if in "${net_ifs[@]}"; do
|
||||
echo >&2 -n "${net_if} ${!net_if}"
|
||||
local if_num=${net_if##*_}
|
||||
if [ "${!net_if}" = "nat" ]; then
|
||||
echo >&2
|
||||
config_nat "$if_num"
|
||||
else
|
||||
# Host-only network: net_if is net name (e.g. API_NET)
|
||||
# Use corresponding value (e.g. 192.168.100.1)
|
||||
IP="$(get_ip_from_net_and_fourth "${!net_if}" "$FOURTH_OCTET")"
|
||||
echo >&2 " $IP"
|
||||
|
||||
config_hostonly "$if_num" "$IP"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# ssh wrapper functions
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function no_chk_ssh {
|
||||
echo >&2 "ssh $@"
|
||||
# Options set to disable strict host key checking and related messages.
|
||||
ssh \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-o LogLevel=error \
|
||||
"$@"
|
||||
}
|
||||
|
||||
# ssh from one node VM to another node in the cluster
|
||||
function node_ssh {
|
||||
no_chk_ssh -i "$HOME/.ssh/osbash_key" "$@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
fix_path_env
|
||||
source_deploy
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,91 +0,0 @@
|
||||
# This file contains bash functions that may be used by both guest and host
|
||||
# systems.
|
||||
|
||||
# Non-recursive removal of all files except README.*
|
||||
function clean_dir {
|
||||
local target_dir=$1
|
||||
if [ ! -e "$target_dir" ]; then
|
||||
mkdir -pv "$target_dir"
|
||||
elif [ ! -d "$target_dir" ]; then
|
||||
echo >&2 "Not a directory: $target_dir"
|
||||
return 1
|
||||
fi
|
||||
shopt -s nullglob
|
||||
local entries=("$target_dir"/*)
|
||||
if [ -n "${entries[0]-}" ]; then
|
||||
for f in "${entries[@]}"; do
|
||||
# Skip directories
|
||||
if [ ! -f "$f" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip README.*
|
||||
if [[ $f =~ /README\. ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
rm -f "$f"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function is_root {
|
||||
if [ $EUID -eq 0 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function yes_or_no {
|
||||
local prompt=$1
|
||||
local input=""
|
||||
while [ : ]; do
|
||||
read -p "$prompt (Y/n): " input
|
||||
case "$input" in
|
||||
N|n)
|
||||
return 1
|
||||
;;
|
||||
""|Y|y)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo -e "${CError:-}Invalid input: ${CData:-}$input${CReset:-}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Helpers to incrementally number files via name prefixes
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function get_next_file_number {
|
||||
local dir=$1
|
||||
local ext=${2:-""}
|
||||
|
||||
# Get number of *.log files in directory
|
||||
shopt -s nullglob
|
||||
if [ -n "$ext" ]; then
|
||||
# Count files with specific extension
|
||||
local files=("$dir/"*".$ext")
|
||||
else
|
||||
# Count all files
|
||||
local files=("$dir/"*)
|
||||
fi
|
||||
echo "${#files[*]}"
|
||||
}
|
||||
|
||||
function get_next_prefix {
|
||||
local dir=$1
|
||||
local ext=$2
|
||||
# Number of digits in prefix string (default 3)
|
||||
local digits=${3:-3}
|
||||
|
||||
# Get number of *.$ext files in $dir
|
||||
local cnt="$(get_next_file_number "$dir" "$ext")"
|
||||
|
||||
printf "%0${digits}d" "$cnt"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,2 +0,0 @@
|
||||
This directory contains the insecure ssh keys used by osbash for logging into
|
||||
the node VMs.
|
||||
@@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEA0pxig+FU4OyoaJjYRcYzvFX70h2Sc7hUr7YSvYyHh9vjOOUE
|
||||
0eG2rWPuKjravQ8xoI7ElaeoT9kEn3FW2bUi9444d7I0jdxK0+FCnqkXoTV/2wip
|
||||
nR4NHiuZtRGz6SZWPn80mI+Kg8OcfKw3haB1R8nYdo8kRXXd/fzHGjUDmLkEZmW0
|
||||
fX+yCEh/fYrCMZqLGJ9z3gHyFQHC6k/TnGD4DyifrbE72xZGBNoTokuxHpNAvdCj
|
||||
lWyT9NVc92/3HBGEOVhZS9KKhZHrFUOSOHLYdcDBtuoJW2TuUlU9BgJXTML5vh/8
|
||||
J1YUPwIxeTZriBBp+OSuP3NHLKCM1nCnbjxMnwIDAQABAoIBAAkrH6rIE27bPpWX
|
||||
GcsnzrbDM3w5J1f8TUt87KHtzTSf4OtoJOaSIea4c/TIrR8P20Q3Et3E97HKK8ZZ
|
||||
I8PEe+o0+cZULq+CSIuiwciwacPt1UwOu3uIhF+s3DsisydSMOz1kq+ViB0mVdij
|
||||
kqMxkgl3AwJeRuDzOZ/F8lD0v9xVFVggqA5DLJhrXtPXrkMZYDlI9RtA3qvD1/RN
|
||||
/0QFiZNvbG9DpH/us5SWhI8FAtLgVBeylx5rLBebY59WGl2plyitGGOjtmTc7060
|
||||
bBWOZzT6PfruXvLj9O7dQwcEb0QNtAeNKHnyllYPNRHK8+WWP9JMg+h0JmV3r/UW
|
||||
ArGUvAECgYEA9pBDiTPdHKEdJW/Aic4ZGWMNbkCbxN6tHNXPfUQrOiyWtpShUjzI
|
||||
l4A9k6KTuWhsNQuLV2Cthdoa9WvEx9do/KXGuiXOhSkBm0ictsEeJMH50LbnQ6bX
|
||||
qMx7EPdyxmKQjcblUkB2Q+0TovPTPI61U9KYRFsj4iDXDftlrf/+Jp8CgYEA2qve
|
||||
2uWQvXWHe4EMKZpc/BqAIWmJiXzP9o4AD9ClOP9InNr2RVxVcTTVG0YEEqQDbPYi
|
||||
lq5k65QAA7NaojvHaawhz+VPqRFAKtzqzUpsDZPh9Db737Qclh3WacQiEecmHwtP
|
||||
1mYEIQTlCKTKfZ5yM0NASBD9kwWtjSSf2zpuGgECgYAEFfPojCF33fubqTRplC66
|
||||
SvfoAc4S/xWjSq+7hauptR9yOxhJQpSYXhmnHqSQB/jzEBPpCMMXWrvjoTuLjDhD
|
||||
J4QZhZLchgduyU8/gAe92DEJkl5WsqcUNv87Er6mJu/6SXd3W3YaPg17P8saT8sV
|
||||
boHzcAcyMhUeODJBJeLSRQKBgQDVOdygNFPz+oO20XoroyLijXC9o+yCTVt4PrUe
|
||||
tsQ1lPCYSwbzUXrbXboj0x0rlBTnDgdiSQGNmY5+DUjmg0YK69c4opEP+gtJAIxQ
|
||||
zC4a+0XMXkUyuK1bUBMApUjXjj7k7KHYHTgPfnda+12cKoGPLRekbjTlRRcbV0gt
|
||||
fIdaAQKBgGE1nzOZtA0z1cEVcucfy9yHjZqic1JN0os1H52CzsPUwCjpAwTMct9J
|
||||
7aLusbHBKQZgoOBuC0O/erV02oQIzTLWcjf45Uj52r0Rgt2kJpOKy8aPMZ9cpbq4
|
||||
tfMrBy/mZc7joHtfwtexLMm5EotkvHEzGXDIRZuyzOSTmlpSzEz3
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key
|
||||
@@ -1,460 +0,0 @@
|
||||
# This file contains bash functions that are used by osbash on the host.
|
||||
|
||||
source "$LIB_DIR/functions.sh"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Conditional execution
|
||||
#-------------------------------------------------------------------------------
|
||||
# TODO: Create a help function and display it under help by default or with
|
||||
# option --help (-h).
|
||||
# exec_cmd is used for conditional execution:
|
||||
#
|
||||
# OSBASH=exec_cmd
|
||||
#
|
||||
# Execute command only if OSBASH is set:
|
||||
# ${OSBASH:-:} cmd args
|
||||
#
|
||||
# Execute command only if OSBASH is not set:
|
||||
# ${OSBASH:+:} cmd args
|
||||
#
|
||||
# Disable actual call to VBoxManage (selectively override configuration):
|
||||
# OSBASH= cmd args
|
||||
#
|
||||
# Enable call to VBoxManage (selectively override configuration):
|
||||
# OSBASH=exec_cmd cmd args
|
||||
|
||||
function exec_cmd {
|
||||
local cmd=$1
|
||||
shift
|
||||
$cmd "$@"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
function get_base_disk_name {
|
||||
echo "base-$VM_ACCESS-$DISTRO.vdi"
|
||||
}
|
||||
|
||||
function get_base_disk_path {
|
||||
echo "$DISK_DIR/$(get_base_disk_name)"
|
||||
}
|
||||
|
||||
# From DISTRO string (e.g., ubuntu-14.04-server-amd64), get first component
|
||||
function get_distro_name {
|
||||
# Match up to first dash
|
||||
local re='([^-]*)'
|
||||
|
||||
if [[ $DISTRO =~ $re ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# ssh
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Check permission for osbash insecure private key
|
||||
function check_osbash_private_key {
|
||||
local key_name="osbash_key"
|
||||
local osbash_key_dir=$LIB_DIR/osbash-ssh-keys
|
||||
local osbash_key_path=$osbash_key_dir/$key_name
|
||||
|
||||
if ! ls -l "$osbash_key_path"|grep -q "^-r--------"; then
|
||||
echo "Adjusting permissions for $osbash_key_path"
|
||||
chmod 400 "$osbash_key_path"
|
||||
fi
|
||||
}
|
||||
|
||||
function strip_top_dir {
|
||||
local full_path=$1
|
||||
echo "${full_path/$TOP_DIR\//}"
|
||||
}
|
||||
|
||||
# Copy files or directories to VM (incl. implied directories; HOME is TOP_DIR)
|
||||
function vm_scp_to_vm {
|
||||
local ssh_port=$1
|
||||
shift
|
||||
|
||||
check_osbash_private_key
|
||||
|
||||
while (($#)); do
|
||||
local src_path=$1
|
||||
shift
|
||||
local target_path=$(strip_top_dir "$src_path")
|
||||
local target_dir=$(dirname "$target_path")
|
||||
vm_ssh "$ssh_port" "mkdir -p $target_dir"
|
||||
scp -q -r \
|
||||
-i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-P "$ssh_port" \
|
||||
"$src_path" "$VM_SHELL_USER@localhost:$target_path"
|
||||
done
|
||||
}
|
||||
|
||||
# Execute commands via ssh
|
||||
function vm_ssh {
|
||||
local ssh_port=$1
|
||||
shift
|
||||
|
||||
check_osbash_private_key
|
||||
|
||||
# Some operating systems (e.g., Mac OS X) export locale settings to the
|
||||
# target that cause some Python clients to fail. Override with a standard
|
||||
# setting (LC_ALL=C).
|
||||
LC_ALL=C ssh -q \
|
||||
-i "$LIB_DIR/osbash-ssh-keys/osbash_key" \
|
||||
-o "UserKnownHostsFile /dev/null" \
|
||||
-o "StrictHostKeyChecking no" \
|
||||
-p "$ssh_port" \
|
||||
"$VM_SHELL_USER@localhost" "$@"
|
||||
}
|
||||
|
||||
function wait_for_ssh {
|
||||
local ssh_port=$1
|
||||
|
||||
echo -e -n "${CStatus:-}Waiting for ssh server to respond on local port ${CData:-}$ssh_port.${CReset:-}"
|
||||
while [ : ]; do
|
||||
if vm_ssh "$ssh_port" exit ; then
|
||||
break
|
||||
else
|
||||
echo -n .
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# Copy one script to VM and execute it via ssh; log output to separate file
|
||||
function ssh_exec_script {
|
||||
local ssh_port=$1
|
||||
local script_path=$2
|
||||
|
||||
vm_scp_to_vm "$ssh_port" "$script_path"
|
||||
|
||||
local remote_path=$(strip_top_dir "$script_path")
|
||||
|
||||
echo -en "\n$(date) start $remote_path"
|
||||
|
||||
local script_name="$(basename "$script_path" .sh)"
|
||||
local prefix=$(get_next_prefix "$LOG_DIR" "auto")
|
||||
local log_path=$LOG_DIR/${prefix}_${script_name}.auto
|
||||
|
||||
local rc=0
|
||||
vm_ssh "$ssh_port" "bash $remote_path && rm -vf $remote_path" \
|
||||
> "$log_path" 2>&1 || rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo >&2
|
||||
echo -e "${CError:-}ERROR: ssh returned status ${CData:-}$rc${CError:-} for${CData:-} $remote_path${CReset:-}" |
|
||||
tee >&2 -a "$LOG_DIR/error.log"
|
||||
# kill osbash host scripts
|
||||
kill -- -$$
|
||||
fi
|
||||
|
||||
echo -en "\n$(date) done"
|
||||
}
|
||||
|
||||
# Wait for sshd, prepare autostart dirs, and execute autostart scripts on VM
|
||||
function ssh_process_autostart {
|
||||
# Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ enviroment if we get called again)
|
||||
(
|
||||
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
local ssh_port=$VM_SSH_PORT
|
||||
|
||||
wait_for_ssh "$ssh_port"
|
||||
vm_ssh "$ssh_port" "rm -rf lib config autostart"
|
||||
vm_scp_to_vm "$ssh_port" "$TOP_DIR/lib" "$TOP_DIR/config"
|
||||
|
||||
local script_path=""
|
||||
for script_path in "$AUTOSTART_DIR/"*.sh; do
|
||||
ssh_exec_script "$ssh_port" "$script_path"
|
||||
rm -f "$script_path" >&2
|
||||
done
|
||||
touch "$STATUS_DIR/done"
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Autostart mechanism
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function autostart_reset {
|
||||
clean_dir "$AUTOSTART_DIR"
|
||||
clean_dir "$STATUS_DIR"
|
||||
}
|
||||
|
||||
function process_begin_files {
|
||||
local processing=("$STATUS_DIR"/*.sh.begin)
|
||||
if [ -n "${processing[0]-}" ]; then
|
||||
local file
|
||||
for file in "${processing[@]}"; do
|
||||
echo >&2 -en "\nVM processing $(basename "$file" .begin)"
|
||||
rm "$file"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Wait until all autofiles are processed (indicated by a "$STATUS_DIR/done"
|
||||
# file created either by osbashauto or ssh_process_autostart)
|
||||
function wait_for_autofiles {
|
||||
shopt -s nullglob
|
||||
|
||||
${WBATCH:-:} wbatch_wait_auto
|
||||
# Remove autostart files and return if we are just faking it for wbatch
|
||||
${OSBASH:+:} autostart_reset
|
||||
${OSBASH:+:} return 0
|
||||
|
||||
until [ -f "$STATUS_DIR/done" -o -f "$STATUS_DIR/error" ]; do
|
||||
# Note: begin files (created by indicate_current_auto) are only visible
|
||||
# if the STATUS_DIR directory is shared between host and VM
|
||||
${WBATCH:-:} process_begin_files
|
||||
echo >&2 -n .
|
||||
sleep 1
|
||||
done
|
||||
# Check for remaining *.sh.begin files
|
||||
${WBATCH:-:} process_begin_files
|
||||
if [ -f "$STATUS_DIR/done" ]; then
|
||||
rm "$STATUS_DIR/done"
|
||||
else
|
||||
echo -e >&2 "${CError:-}\nERROR occured. Exiting.${CReset:-}"
|
||||
kill -- -$$
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Prepending numbers ensures scripts will be executed in the order they
|
||||
# were added to the queue.
|
||||
|
||||
function _autostart_queue {
|
||||
local src_path=$SCRIPTS_DIR/$1
|
||||
local src_name=${1##*/}
|
||||
|
||||
# If we get a target name, file will be renamed
|
||||
local target_name=${2:-$src_name}
|
||||
|
||||
if [[ $target_name = *.sh ]]; then
|
||||
# Create target file name like 01_apt_init.sh
|
||||
local prefix=$(get_next_prefix "$AUTOSTART_DIR" "sh" 2)
|
||||
target_name="${prefix}_$target_name"
|
||||
fi
|
||||
|
||||
if [ "$src_name" = "$target_name" ]; then
|
||||
echo >&2 -e "\t$src_name"
|
||||
else
|
||||
echo >&2 -e "\t$src_name -> $target_name"
|
||||
fi
|
||||
|
||||
cp -- "$src_path" "$AUTOSTART_DIR/$target_name"
|
||||
${WBATCH:-:} wbatch_cp_auto "$src_path" "$AUTOSTART_DIR/$target_name"
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# Print to the console which file requested guest scripts to run
|
||||
function log_autostart_source {
|
||||
# If the caller doesn't provide a config file, log the caller's source file
|
||||
local src_file=${1:-${BASH_SOURCE[1]##*/}}
|
||||
echo >&2 "Copying autostart files set in $src_file"
|
||||
}
|
||||
|
||||
# autostart <src_dir> <file> <new_name>
|
||||
# e.g. autostart osbash init_xxx_node.sh init_controller_node.sh
|
||||
function autostart_and_rename {
|
||||
local src_dir=$1
|
||||
local src_file=$2
|
||||
local target_file=$3
|
||||
|
||||
# Don't log this file -- log our caller's source file
|
||||
log_autostart_source "${BASH_SOURCE[1]##*/}"
|
||||
|
||||
_autostart_queue "$src_dir/$src_file" "$target_file"
|
||||
}
|
||||
|
||||
# autostart <file> [<file> ...]
|
||||
# e.g. autostart zero_empty.sh osbash/base_fixups.sh
|
||||
function autostart {
|
||||
# Don't log this file -- log our caller's source file
|
||||
log_autostart_source "${BASH_SOURCE[1]##*/}"
|
||||
|
||||
while (($#)); do
|
||||
local src_file=$1
|
||||
shift
|
||||
_autostart_queue "$src_file"
|
||||
done
|
||||
}
|
||||
|
||||
# Parse options given to configuration commands. Return parsed values by
|
||||
# setting variables to be used by caller.
|
||||
function get_cmd_options {
|
||||
local OPTIND
|
||||
local opt
|
||||
|
||||
while getopts :g:n: opt; do
|
||||
case $opt in
|
||||
g)
|
||||
vm_ui=$OPTARG
|
||||
;;
|
||||
n)
|
||||
vm_name=$OPTARG
|
||||
;;
|
||||
*)
|
||||
echo -e >&2 "${CError:-}Error: bad option ${CData:-}$OPTARG.${CReset:-}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# Assign the remaining arguments back to args
|
||||
args=$@
|
||||
}
|
||||
|
||||
# Parse command and arguments after a "cmd" token in config/scripts.*
|
||||
function command_from_config {
|
||||
local cmd=$1
|
||||
shift
|
||||
|
||||
# Local variables that may be changed by get_cmd_options
|
||||
local vm_name=${NODE_NAME:-""}
|
||||
local vm_ui=${VM_UI:-""}
|
||||
|
||||
local args=$@
|
||||
case "$cmd" in
|
||||
boot)
|
||||
# Format: boot [-g <gui_type>] [-n <node_name>]
|
||||
# Boot with queued autostart files now, wait for end of scripts
|
||||
# processing
|
||||
get_cmd_options $args
|
||||
echo >&2 "VM_UI=$vm_ui _vbox_boot_with_autostart $vm_name"
|
||||
VM_UI=$vm_ui _vbox_boot_with_autostart "$vm_name"
|
||||
;;
|
||||
snapshot)
|
||||
# Format: snapshot [-n <node_name>] <snapshot_name>
|
||||
get_cmd_options $args
|
||||
local shot_name=$args
|
||||
echo >&2 vm_snapshot "$vm_name" "$shot_name"
|
||||
vm_snapshot "$vm_name" "$shot_name"
|
||||
;;
|
||||
wait_for_shutdown)
|
||||
# Format: wait_for_shutdown [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
echo >&2 vm_wait_for_shutdown "$vm_name"
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
;;
|
||||
snapshot_cycle)
|
||||
# Format: snapshot_cycle [-g <gui_type>] [-n <node_name>]
|
||||
# comprises shutdown, boot, wait_for_shutdown, snapshot
|
||||
get_cmd_options $args
|
||||
local shot_name=$args
|
||||
echo >&2 snapshot_cycle "$vm_name" "$shot_name"
|
||||
_autostart_queue "osbash/shutdown.sh"
|
||||
_vbox_boot_with_autostart "$vm_name"
|
||||
vm_wait_for_shutdown "$vm_name"
|
||||
vm_snapshot "$vm_name" "$shot_name"
|
||||
;;
|
||||
init_node)
|
||||
# Format: init_node [-n <node_name>]
|
||||
get_cmd_options $args
|
||||
echo >&2 vm_init_node "$vm_name"
|
||||
vm_init_node "$vm_name"
|
||||
;;
|
||||
queue)
|
||||
# Queue a script for autostart
|
||||
# Format: queue <script_name>
|
||||
local script_rel_path=$args
|
||||
echo >&2 _autostart_queue "$script_rel_path"
|
||||
_autostart_queue "$script_rel_path"
|
||||
;;
|
||||
*)
|
||||
echo -e >&2 "${CError:-}Error: invalid cmd: ${CData:-}$cmd${CReset:-}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Parse config/scripts.* configuration files
|
||||
function autostart_from_config {
|
||||
local config_file=$1
|
||||
local config_path=$CONFIG_DIR/$config_file
|
||||
|
||||
if [ ! -f "$config_path" ]; then
|
||||
echo -e >&2 "${CMissing:-}Config file not found: ${CData:-}$config_file${CReset:-}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_autostart_source "$config_file"
|
||||
|
||||
# Open file on file descriptor 3 so programs we call in this loop (ssh)
|
||||
# are free to mess with the standard file descriptors.
|
||||
exec 3< "$config_path"
|
||||
while read -r field_1 field_2 <&3; do
|
||||
if [[ $field_1 =~ (^$|^#) ]]; then
|
||||
# Skip empty lines and lines that are commented out
|
||||
continue
|
||||
elif [ "$field_1" == "cmd" ]; then
|
||||
if [ -n "${JUMP_SNAPSHOT:-""}" ]; then
|
||||
if [[ $field_2 =~ ^snapshot.*${JUMP_SNAPSHOT} ]]; then
|
||||
echo >&2 "Skipped forward to snapshot $JUMP_SNAPSHOT."
|
||||
unset JUMP_SNAPSHOT
|
||||
fi
|
||||
else
|
||||
command_from_config $field_2
|
||||
fi
|
||||
else
|
||||
# Syntax error
|
||||
echo -e -n >&2 "${CError:-}ERROR in ${CInfo:-}$config_file: ${CData:-}'$field_1${CReset:-}"
|
||||
if [ -n "$field_2" ]; then
|
||||
echo >&2 " $field_2'"
|
||||
else
|
||||
echo >&2 "'"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Functions to get install ISO images
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function download {
|
||||
local url=$1
|
||||
local dest_dir=$2
|
||||
local dest_file=$3
|
||||
local rc=0
|
||||
|
||||
local wget_exe=$(which wget)
|
||||
mkdir -pv "$dest_dir"
|
||||
if [ -n "$wget_exe" ]; then
|
||||
$wget_exe --output-document "$dest_dir/$dest_file" "$url"||rc=$?
|
||||
else
|
||||
# Mac OS X has curl instead of wget
|
||||
local curl_exe=$(which curl)
|
||||
if [ -n "$curl_exe" ]; then
|
||||
$curl_exe "$url" -o "$dest_dir/$dest_file"||rc=$?
|
||||
fi
|
||||
fi
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e >&2 "${CError:-}Unable to download ${CData:-}$url${CError:-}, quitting.${CReset:-}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function get_iso_name {
|
||||
basename "${ISO_URL:-}"
|
||||
}
|
||||
|
||||
function find_install-iso {
|
||||
local iso_name=$1
|
||||
if [ ! -f "$ISO_DIR/$iso_name" ]; then
|
||||
echo >&2 "$iso_name not in $ISO_DIR; downloading"
|
||||
download "$ISO_URL" "$ISO_DIR" "$iso_name"
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Colors and decorations
|
||||
|
||||
function colorizer {
|
||||
|
||||
# Text Reset
|
||||
local Reset_Color='\x1b[0m'
|
||||
|
||||
# Regular
|
||||
local Black='\x1b[0;30m'
|
||||
local Red='\x1b[0;31m'
|
||||
local Green='\x1b[0;32m'
|
||||
local Yellow='\x1b[0;33m'
|
||||
local Blue='\x1b[0;34m'
|
||||
local Purple='\x1b[0;35m'
|
||||
local Cyan='\x1b[0;36m'
|
||||
local White='\x1b[0;37m'
|
||||
|
||||
# Bold
|
||||
local Bold_Black='\x1b[1;30m'
|
||||
local Bold_Red='\x1b[1;31m'
|
||||
local Bold_Green='\x1b[1;32m'
|
||||
local Bold_Yellow='\x1b[1;33m'
|
||||
local Bold_Blue='\x1b[1;34m'
|
||||
local Bold_Purple='\x1b[1;35m'
|
||||
local Bold_Cyan='\x1b[1;36m'
|
||||
local Bold_White='\x1b[1;37m'
|
||||
|
||||
# Underline
|
||||
local Underline_Black='\x1b[4;30m'
|
||||
local Underline_Red='\x1b[4;31m'
|
||||
local Underline_Green='\x1b[4;32m'
|
||||
local Underline_Yellow='\x1b[4;33m'
|
||||
local Underline_Blue='\x1b[4;34m'
|
||||
local Underline_Purple='\x1b[1;35m'
|
||||
local Underline_Cyan='\x1b[4;36m'
|
||||
local Underline_White='\x1b[4;37m'
|
||||
|
||||
# Background
|
||||
local On_Black='\x1b[40m'
|
||||
local On_Blue='\x1b[44m'
|
||||
local On_White='\x1b[47m'
|
||||
|
||||
# Color codes
|
||||
CError=$Red
|
||||
CStatus=$Bold_Purple
|
||||
CInfo=$Bold_Yellow
|
||||
CProcess=$Bold_Blue
|
||||
CData=$Bold_Cyan
|
||||
CMissing=$Bold_Red
|
||||
CReset=$Reset_Color
|
||||
}
|
||||
colorizer
|
||||
unset colorizer
|
||||
@@ -1,43 +0,0 @@
|
||||
# Fedora 20 x86_64
|
||||
|
||||
# Default scripts for all Fedora base disks
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.fedora_base}
|
||||
|
||||
# Give Fedora 20 installer sufficient RAM
|
||||
VM_BASE_MEM=1024
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting the operating system installer
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL=http://mirror.switch.ch/ftp/mirror/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso
|
||||
readonly ISO_MD5=9a190c8b2bd382c2d046dbc855cd2f2b
|
||||
|
||||
readonly _KS_ssh=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/ks-ssh-v2.cfg
|
||||
readonly _KS_vbadd=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/ks-vbadd.cfg
|
||||
readonly _KS_all=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/ks-all-v2.cfg
|
||||
|
||||
readonly _BOOT_ARGS="linux ks=%s"
|
||||
|
||||
function vbox_distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _KS_* file
|
||||
local kickstart=_KS_$VM_ACCESS
|
||||
|
||||
echo "Using $kickstart ${!kickstart}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!kickstart}")
|
||||
|
||||
vbox_kbd_escape_key "$vm_name"
|
||||
|
||||
vbox_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
vbox_kbd_string_input "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
vbox_kbd_enter_key "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,53 +0,0 @@
|
||||
# Ubuntu 12.04.4 LTS amd64 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting the operating system installer
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL=http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso
|
||||
|
||||
# Note: Ubuntu 12.04 LTS cannot pull a preseed file over HTTPS
|
||||
readonly _PS_ssh=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-ssh-v2.cfg
|
||||
readonly _PS_vbadd=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-vbadd.cfg
|
||||
readonly _PS_all=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-all-v2.cfg
|
||||
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
function vbox_distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
vbox_kbd_escape_key "$vm_name"
|
||||
vbox_kbd_escape_key "$vm_name"
|
||||
vbox_kbd_enter_key "$vm_name"
|
||||
|
||||
vbox_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
vbox_kbd_string_input "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
vbox_kbd_enter_key "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,53 +0,0 @@
|
||||
# Ubuntu 14.04 LTS amd64 server
|
||||
|
||||
# Default scripts for all Ubuntu installs
|
||||
: ${BASE_INSTALL_SCRIPTS:=scripts.ubuntu_base}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Booting the operating system installer
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
readonly ISO_URL=http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso
|
||||
readonly ISO_MD5=9e5fecc94b3925bededed0fdca1bd417
|
||||
|
||||
readonly _PS_ssh=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-ssh-v2.cfg
|
||||
readonly _PS_vbadd=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-vbadd.cfg
|
||||
readonly _PS_all=http://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash/netboot/preseed-all-v2.cfg
|
||||
|
||||
readonly _BOOT_ARGS="/install/vmlinuz
|
||||
noapic
|
||||
preseed/url=%s
|
||||
debian-installer=en_US
|
||||
auto=true
|
||||
locale=en_US
|
||||
hostname=osbash
|
||||
fb=false
|
||||
debconf/frontend=noninteractive
|
||||
keyboard-configuration/modelcode=SKIP
|
||||
initrd=/install/initrd.gz
|
||||
console-setup/ask_detect=false"
|
||||
|
||||
function vbox_distro_start_installer {
|
||||
local vm_name=$1
|
||||
|
||||
# pick a _PS_* file
|
||||
local preseed=_PS_$VM_ACCESS
|
||||
|
||||
echo "Using $preseed ${!preseed}"
|
||||
|
||||
local boot_args=$(printf "$_BOOT_ARGS" "${!preseed}")
|
||||
|
||||
vbox_kbd_escape_key "$vm_name"
|
||||
vbox_kbd_escape_key "$vm_name"
|
||||
vbox_kbd_enter_key "$vm_name"
|
||||
|
||||
vbox_sleep 1
|
||||
|
||||
echo -e "${CStatus:-}Pushing boot command line${CReset:-}"
|
||||
vbox_kbd_string_input "$vm_name" "$boot_args"
|
||||
|
||||
echo "Initiating boot sequence"
|
||||
vbox_kbd_enter_key "$vm_name"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,75 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure osbash key and password-less sudo for osbash
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash-ssh-keys/osbash_key.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
wget
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
||||
@@ -1,75 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
wget
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
||||
@@ -1,58 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure osbash key and password-less sudo for osbash
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash-ssh-keys/osbash_key.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
%end
|
||||
|
||||
%packages
|
||||
wget
|
||||
%end
|
||||
@@ -1,58 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# User
|
||||
user --name=osbash --password=osbash --plaintext
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Enable ssh login with insecure Vagrant key and password-less sudo for osbash
|
||||
%post --interpreter=/bin/bash
|
||||
DIR=/home/osbash/.ssh
|
||||
mkdir $DIR
|
||||
wget -O $DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
|
||||
chmod 700 $DIR
|
||||
chmod 400 $DIR/authorized_keys
|
||||
chown -R osbash:osbash $DIR
|
||||
echo "osbash ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
echo "Defaults:osbash !requiretty" >> /etc/sudoers
|
||||
%end
|
||||
|
||||
%packages
|
||||
wget
|
||||
%end
|
||||
@@ -1,64 +0,0 @@
|
||||
#platform=x86, AMD64, or Intel EM64T
|
||||
#version=DEVEL
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
# Keyboard layouts
|
||||
keyboard 'us'
|
||||
# Reboot after installation
|
||||
reboot --eject
|
||||
# Root password
|
||||
rootpw --plaintext osbash
|
||||
# System timezone
|
||||
timezone Etc/UTC --isUtc
|
||||
# System language
|
||||
lang en_US
|
||||
# Firewall configuration
|
||||
firewall --disabled
|
||||
# System authorization information
|
||||
auth --useshadow --passalgo=sha512
|
||||
# Use CDROM installation media
|
||||
cdrom
|
||||
# Use text mode install
|
||||
text
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr
|
||||
# Partition clearing information
|
||||
clearpart --all
|
||||
|
||||
part /boot --fstype=ext4 --size=1024
|
||||
part pv.0 --grow --size=1
|
||||
volgroup ROOTDISK --pesize=4096 pv.0
|
||||
logvol swap --name=swap --vgname=ROOTDISK --recommended
|
||||
logvol / --fstype=ext4 --name=root --vgname=ROOTDISK --size=1 --grow
|
||||
|
||||
%pre --interpreter=bash
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Install VirtualBox guest additions, bootstrap osbashauto
|
||||
%post --interpreter=/bin/bash
|
||||
|
||||
yum -y install dkms
|
||||
|
||||
mount /dev/sr1 /mnt
|
||||
/mnt/VBoxLinuxAdditions.run
|
||||
umount /mnt
|
||||
|
||||
echo -e '#!/bin/bash\nbash /media/sf_*/autostart/*activate_autostart.sh\nrm /media/*/autostart/*activate_autostart.sh' > /etc/init.d/osbash
|
||||
chmod 755 /etc/init.d/osbash
|
||||
ln -s ../init.d/osbash /etc/rc2.d/S40osbash
|
||||
|
||||
%end
|
||||
#-------------------------------------------------------------------------------
|
||||
# tar, bzip2, kernel-{devel,headers}: needed for VirtualBox guest additions
|
||||
# (but not in @core)
|
||||
%packages
|
||||
tar
|
||||
bzip2
|
||||
kernel-devel
|
||||
kernel-headers
|
||||
%end
|
||||
@@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
||||
@@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers; apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
||||
@@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://git.openstack.org/cgit/openstack/training-guides/plain/labs/lib/osbash-ssh-keys/osbash_key.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
|
||||
@@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "DIR=/home/osbash/.ssh; mkdir \$DIR; wget -O \$DIR/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub ; chmod 700 \$DIR; chmod 400 \$DIR/authorized_keys; chown -R osbash:osbash \$DIR; echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; echo 'Defaults:osbash !requiretty' >> /etc/sudoers;" | chroot /target /bin/bash;
|
||||
@@ -1,120 +0,0 @@
|
||||
# Based on
|
||||
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
|
||||
#
|
||||
# For details, see:
|
||||
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
|
||||
#-------------------------------------------------------------------------------
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
|
||||
d-i netcfg/get_hostname string osbash
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
#-------------------------------------------------------------------------------
|
||||
# Proxy
|
||||
#d-i mirror/http/proxy string http://192.168.178.20:3128/
|
||||
d-i mirror/http/proxy string
|
||||
#-------------------------------------------------------------------------------
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Etc/UTC
|
||||
#-------------------------------------------------------------------------------
|
||||
### Partitioning
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# To create a normal user account.
|
||||
d-i passwd/user-fullname string OpenStack user
|
||||
d-i passwd/username string osbash
|
||||
d-i passwd/user-password password osbash
|
||||
d-i passwd/user-password-again password osbash
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
#-------------------------------------------------------------------------------
|
||||
### Package selection
|
||||
tasksel tasksel/first minimal
|
||||
|
||||
# Individual additional packages to install
|
||||
d-i pkgsel/include string openssh-server dkms localepurge
|
||||
|
||||
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
|
||||
### Pkg:localepurge
|
||||
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
|
||||
localepurge localepurge/nopurge multiselect en_US
|
||||
# Really remove all locales?
|
||||
localepurge localepurge/none_selected boolean false
|
||||
# Also delete localized man pages?
|
||||
localepurge localepurge/mandelete boolean true
|
||||
# Avoid note that localepurge will not take any action until configured
|
||||
localepurge localepurge/remove_no note
|
||||
# Inform about new locales?
|
||||
localepurge localepurge/dontbothernew boolean false
|
||||
# Display verbose output?
|
||||
localepurge localepurge/verbose boolean false
|
||||
# Display freed disk space?
|
||||
localepurge localepurge/showfreedspace boolean true
|
||||
# Accurate disk space calculation?
|
||||
localepurge localepurge/quickndirtycalc boolean true
|
||||
# Use dpkg --path-exclude?
|
||||
localepurge localepurge/use-dpkg-feature bolean true
|
||||
#-------------------------------------------------------------------------------
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
d-i pkgsel/upgrade select none
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select none
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# Avoid warning about install CD not containing full support for language
|
||||
d-i pkgsel/install-language-support boolean false
|
||||
|
||||
# Avoid reboot confirmation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
d-i cdrom-detect/eject boolean true
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
|
||||
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
|
||||
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
|
||||
#-------------------------------------------------------------------------------
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations!
|
||||
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
d-i preseed/late_command string echo "apt-get -y purge virtualbox-guest-dkms virtualbox-guest-utils; mount /dev/sr1 /mnt; /mnt/VBoxLinuxAdditions.run; umount /mnt; echo -e '#!/bin/bash\nexec > /root/bootstrap.log 2>&1\nset -x\nSCR=/media/sf_bootstrap/autostart/*activate_autostart.sh\nwhile [ ! -f \$SCR ];do sleep 1;done\nbash \$SCR\nrm -v \$SCR' > /etc/rc2.d/S40osbash; chmod 755 /etc/rc2.d/S40osbash;" | chroot /target /bin/bash;
|
||||
@@ -1,302 +0,0 @@
|
||||
# The functions in this library are used to get scancode strings for VirtualBox
|
||||
# keyboard input (keyboardputscancode).
|
||||
#
|
||||
# It was generated mostly from output of Cameron Kerr's scancodes.l:
|
||||
# http://humbledown.org/keyboard-scancodes.xhtml
|
||||
#
|
||||
# The library works with bash 3.2 (shipped with Mac OS X as of 2014).
|
||||
|
||||
function char2scancode {
|
||||
local key=$1
|
||||
case "$key" in
|
||||
'a')
|
||||
echo -n " 1e 9e"
|
||||
;;
|
||||
'b')
|
||||
echo -n " 30 b0"
|
||||
;;
|
||||
'c')
|
||||
echo -n " 2e ae"
|
||||
;;
|
||||
'd')
|
||||
echo -n " 20 a0"
|
||||
;;
|
||||
'e')
|
||||
echo -n " 12 92"
|
||||
;;
|
||||
'f')
|
||||
echo -n " 21 a1"
|
||||
;;
|
||||
'g')
|
||||
echo -n " 22 a2"
|
||||
;;
|
||||
'h')
|
||||
echo -n " 23 a3"
|
||||
;;
|
||||
'i')
|
||||
echo -n " 17 97"
|
||||
;;
|
||||
'j')
|
||||
echo -n " 24 a4"
|
||||
;;
|
||||
'k')
|
||||
echo -n " 25 a5"
|
||||
;;
|
||||
'l')
|
||||
echo -n " 26 a6"
|
||||
;;
|
||||
'm')
|
||||
echo -n " 32 b2"
|
||||
;;
|
||||
'n')
|
||||
echo -n " 31 b1"
|
||||
;;
|
||||
'o')
|
||||
echo -n " 18 98"
|
||||
;;
|
||||
'p')
|
||||
echo -n " 19 99"
|
||||
;;
|
||||
'q')
|
||||
echo -n " 10 90"
|
||||
;;
|
||||
'r')
|
||||
echo -n " 13 93"
|
||||
;;
|
||||
's')
|
||||
echo -n " 1f 9f"
|
||||
;;
|
||||
't')
|
||||
echo -n " 14 94"
|
||||
;;
|
||||
'u')
|
||||
echo -n " 16 96"
|
||||
;;
|
||||
'v')
|
||||
echo -n " 2f af"
|
||||
;;
|
||||
'w')
|
||||
echo -n " 11 91"
|
||||
;;
|
||||
'x')
|
||||
echo -n " 2d ad"
|
||||
;;
|
||||
'y')
|
||||
echo -n " 15 95"
|
||||
;;
|
||||
'z')
|
||||
echo -n " 2c ac"
|
||||
;;
|
||||
'A')
|
||||
echo -n " 2a 1e 9e aa"
|
||||
;;
|
||||
'B')
|
||||
echo -n " 2a 30 b0 aa"
|
||||
;;
|
||||
'C')
|
||||
echo -n " 2a 2e ae aa"
|
||||
;;
|
||||
'D')
|
||||
echo -n " 2a 20 a0 aa"
|
||||
;;
|
||||
'E')
|
||||
echo -n " 2a 12 92 aa"
|
||||
;;
|
||||
'F')
|
||||
echo -n " 2a 21 a1 aa"
|
||||
;;
|
||||
'G')
|
||||
echo -n " 2a 22 a2 aa"
|
||||
;;
|
||||
'H')
|
||||
echo -n " 2a 23 a3 aa"
|
||||
;;
|
||||
'I')
|
||||
echo -n " 2a 17 97 aa"
|
||||
;;
|
||||
'J')
|
||||
echo -n " 2a 24 a4 aa"
|
||||
;;
|
||||
'K')
|
||||
echo -n " 2a 25 a5 aa"
|
||||
;;
|
||||
'L')
|
||||
echo -n " 2a 26 a6 aa"
|
||||
;;
|
||||
'M')
|
||||
echo -n " 2a 32 b2 aa"
|
||||
;;
|
||||
'N')
|
||||
echo -n " 2a 31 b1 aa"
|
||||
;;
|
||||
'O')
|
||||
echo -n " 2a 18 98 aa"
|
||||
;;
|
||||
'P')
|
||||
echo -n " 2a 19 99 aa"
|
||||
;;
|
||||
'Q')
|
||||
echo -n " 2a 10 90 aa"
|
||||
;;
|
||||
'R')
|
||||
echo -n " 2a 13 93 aa"
|
||||
;;
|
||||
'S')
|
||||
echo -n " 2a 1f 9f aa"
|
||||
;;
|
||||
'T')
|
||||
echo -n " 2a 14 94 aa"
|
||||
;;
|
||||
'U')
|
||||
echo -n " 2a 16 96 aa"
|
||||
;;
|
||||
'V')
|
||||
echo -n " 2a 2f af aa"
|
||||
;;
|
||||
'W')
|
||||
echo -n " 2a 11 91 aa"
|
||||
;;
|
||||
'X')
|
||||
echo -n " 2a 2d ad aa"
|
||||
;;
|
||||
'Z')
|
||||
echo -n " 2a 2c ac aa"
|
||||
;;
|
||||
'Y')
|
||||
echo -n " 2a 15 95 aa"
|
||||
;;
|
||||
'1')
|
||||
echo -n " 02 82"
|
||||
;;
|
||||
'2')
|
||||
echo -n " 03 83"
|
||||
;;
|
||||
'3')
|
||||
echo -n " 04 84"
|
||||
;;
|
||||
'4')
|
||||
echo -n " 05 85"
|
||||
;;
|
||||
'5')
|
||||
echo -n " 06 86"
|
||||
;;
|
||||
'6')
|
||||
echo -n " 07 87"
|
||||
;;
|
||||
'7')
|
||||
echo -n " 08 88"
|
||||
;;
|
||||
'8')
|
||||
echo -n " 09 89"
|
||||
;;
|
||||
'9')
|
||||
echo -n " 0a 8a"
|
||||
;;
|
||||
'0')
|
||||
echo -n " 0b 8b"
|
||||
;;
|
||||
'!')
|
||||
echo -n " 2a 02 82 aa"
|
||||
;;
|
||||
'@')
|
||||
echo -n " 2a 03 83 aa"
|
||||
;;
|
||||
'#')
|
||||
echo -n " 2a 04 84 aa"
|
||||
;;
|
||||
'$')
|
||||
echo -n " 2a 05 85 aa"
|
||||
;;
|
||||
'%')
|
||||
echo -n " 2a 06 86 aa"
|
||||
;;
|
||||
'^')
|
||||
echo -n " 2a 07 87 aa"
|
||||
;;
|
||||
'&')
|
||||
echo -n " 2a 08 88 aa"
|
||||
;;
|
||||
'*')
|
||||
echo -n " 2a 09 89 aa"
|
||||
;;
|
||||
'(')
|
||||
echo -n " 2a 0a 8a aa"
|
||||
;;
|
||||
')')
|
||||
echo -n " 2a 0b 8b aa"
|
||||
;;
|
||||
'-')
|
||||
echo -n " 0c 8c"
|
||||
;;
|
||||
'_')
|
||||
echo -n " 2a 0c 8c aa"
|
||||
;;
|
||||
'=')
|
||||
echo -n " 0d 8d"
|
||||
;;
|
||||
'+')
|
||||
echo -n " 2a 0d 8d aa"
|
||||
;;
|
||||
' ')
|
||||
echo -n " 39 b9"
|
||||
;;
|
||||
'[')
|
||||
echo -n " 1a 9a"
|
||||
;;
|
||||
']')
|
||||
echo -n " 1b 9b"
|
||||
;;
|
||||
'{')
|
||||
echo -n " 2a 1a 9a aa"
|
||||
;;
|
||||
'}')
|
||||
echo -n " 2a 1b 9b aa"
|
||||
;;
|
||||
';')
|
||||
echo -n " 27 a7"
|
||||
;;
|
||||
':')
|
||||
echo -n " 2a 27 a7 aa"
|
||||
;;
|
||||
',')
|
||||
echo -n " 33 b3"
|
||||
;;
|
||||
'.')
|
||||
echo -n " 34 b4"
|
||||
;;
|
||||
'/')
|
||||
echo -n " 35 b5"
|
||||
;;
|
||||
'\')
|
||||
echo -n " 2b ab"
|
||||
;;
|
||||
'|')
|
||||
echo -n " 2a 2b ab aa"
|
||||
;;
|
||||
'?')
|
||||
echo -n " 2a 35 b5 aa"
|
||||
;;
|
||||
'"')
|
||||
echo -n " 2a 28 a8 aa"
|
||||
;;
|
||||
"'")
|
||||
echo -n " 28 a8"
|
||||
;;
|
||||
">")
|
||||
echo -n " 2a 34 b4 aa"
|
||||
;;
|
||||
"<")
|
||||
echo -n " 2a 33 b3 aa"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function esc2scancode {
|
||||
echo -n " 01 81"
|
||||
}
|
||||
|
||||
function enter2scancode {
|
||||
echo -n " 1c 9c"
|
||||
}
|
||||
|
||||
# vim: set ai ts=4 sw=4 et ft=sh:
|
||||
@@ -1,5 +0,0 @@
|
||||
DEVICE=%IF_NAME%
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=none
|
||||
IPADDR=%IP_ADDRESS%
|
||||
NETMASK=255.255.255.0
|
||||
@@ -1,4 +0,0 @@
|
||||
# VirtualBox NAT -- for Internet access to VM
|
||||
DEVICE=%IF_NAME%
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=dhcp
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user