diff options
Diffstat (limited to 'share/hydractl')
-rwxr-xr-x | share/hydractl/deploy | 58 | ||||
-rwxr-xr-x | share/hydractl/install | 4 | ||||
-rwxr-xr-x | share/hydractl/provision | 9 | ||||
-rwxr-xr-x | share/hydractl/provision-chroot | 16 | ||||
-rwxr-xr-x | share/hydractl/provision-raspi | 2 | ||||
-rwxr-xr-x | share/hydractl/upgrade | 8 |
6 files changed, 20 insertions, 77 deletions
diff --git a/share/hydractl/deploy b/share/hydractl/deploy deleted file mode 100755 index 191b060..0000000 --- a/share/hydractl/deploy +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# Deploy a node using automated recipes. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/>. - -# Load. -source $APP_BASE/lib/hydra/functions || exit 1 -hydra_config_load - -# Parameters -FOLDER="$1" - -# Dispatch -if [ ! -z "$FOLDER" ]; then - echo "Deploying to $FOLDER..." - - # Setup deploy environment - hydra_deploy_setyp remote $node - hydra_deploy_mkdirs - - # Sync repository to server - $DEPLOY_RSYNC - - # Copy hiera configuration - hydra_hiera_copy - - # Check if puppet is installed - if [ ! -e "$FOLDER/usr/bin/puppet" ]; then - $DEPLOY_COMMAND apt-get install puppet -y - fi - - # Run puppet, overriding FQDN - FACTER_domain=$DOMAIN FACTER_hostname=$HOSTNAME FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY -elif [ -e "$HYDRA_FOLDER/puppet/manifests/nodes/$FQDN.pp" ]; then - echo "Deploying to localhost..." - - # Setup deploy environment - hydra_deploy_setup - - # Check if puppet is installed - hydra_install_package puppet - - # Run puppet - $DEPLOY_APPLY -fi diff --git a/share/hydractl/install b/share/hydractl/install index 0f43b4f..baae176 100755 --- a/share/hydractl/install +++ b/share/hydractl/install @@ -35,8 +35,8 @@ echo "Installing to local node..." if ! which git &> /dev/null; then echo "Installing git..." - $sudo aptitude update - $sudo aptitude install git-core -y + $sudo apt-get update + $sudo apt-get install git-core -y fi # Git version diff --git a/share/hydractl/provision b/share/hydractl/provision index 087b703..1a9b98d 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -94,7 +94,7 @@ function hydra_provision_config { hydra_user_config interactive y "Interactive mode? (y/n)" hydra_user_config device /dev/sdb "Destination device" - hydra_user_config root_size 20G "Size of root partition" + hydra_user_config root_size 20G "Size of root partition (-1 for all free space)" hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)" hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)" hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)" @@ -402,11 +402,8 @@ else kernel_arch="$arch" fi -if [ "$version" == "squeeze" ]; then - hydra_sudo_run chroot $WORK apt-get install linux-image-2.6-vserver-$kernel_arch -y -else - hydra_sudo_run chroot $WORK apt-get install linux-image-$kernel_arch -y -fi +# Kernel. +hydra_sudo_run chroot $WORK apt-get install linux-image-$kernel_arch -y # Initramfs. echo "Creating initramfs..." diff --git a/share/hydractl/provision-chroot b/share/hydractl/provision-chroot index 7910879..bd7430a 100755 --- a/share/hydractl/provision-chroot +++ b/share/hydractl/provision-chroot @@ -34,26 +34,30 @@ function hydra_provision_config { # Load configuration hydra_provision_config_load $1 +# Get config parameters. +hydra_provision_config + # Parameters WORK="$folder" CHROOT="hydra_sudo_run chroot $WORK" -# Get config parameters. -hydra_provision_config - # Check for requirements. for req in debootstrap qemu-user-static; do hydra_install_package $req done hydra_sudo_run mkdir -p /var/chroot -hydra_sudo_run sudo debootstrap --variant=minbase --arch $arch $version $WORK $mirror +hydra_sudo_run debootstrap --variant=minbase --arch $arch $version $WORK $mirror # Arch specific procedures -if [ "$arch" != "armel" ] && [ "$arch" != "armhf" ]; then +if [ "$arch" == "armel" ] || [ "$arch" == "armhf" ]; then + if [ ! -f '/usr/bin/qemu-arm-static' ]; then + hydra_sudo run apt-get install qemu-user-static + fi + hydra_sudo_run cp /usr/bin/qemu-arm-static $WORK/usr/bin/ $CHROOT /debootstrap/debootstrap --second-stage fi -echo "$hostname.$domain" | hydra_sudo_run tee /var/chroot/squeeze/etc/hostname > /dev/null +echo "$hostname.$domain" | hydra_sudo_run tee $WORK/etc/hostname > /dev/null $CHROOT apt-get install locales diff --git a/share/hydractl/provision-raspi b/share/hydractl/provision-raspi index 38bc0b7..6495de4 100755 --- a/share/hydractl/provision-raspi +++ b/share/hydractl/provision-raspi @@ -79,7 +79,7 @@ echo "deb http://security.debian.org/ $version/updates main contrib non-free" | # Basic packages $CHROOT apt-get update $CHROOT apt-get install -y locales && $CHROOT dpkg-reconfigure locales -$CHROOT apt-get install -y screen cron lsb-release openssl openssh-server less ntp +$CHROOT apt-get install -y screen cron lsb-release openssl openssh-server less ntp curl # Hostname echo $hostname.$domain | hydra_sudo_run tee $WORK/etc/hostname > /dev/null diff --git a/share/hydractl/upgrade b/share/hydractl/upgrade index e3c1141..350d795 100755 --- a/share/hydractl/upgrade +++ b/share/hydractl/upgrade @@ -26,8 +26,8 @@ fi # Issue upgrade if ! $sudo lsof /var/lib/dpkg/lock &> /dev/null; then - $sudo aptitude update - $sudo aptitude full-upgrade -y + $sudo apt-get update + $sudo apt-get dist-upgrade -y else echo "Apt is locked, aborting." fi @@ -39,6 +39,6 @@ hydractl chroot-upgrade hydractl pbuilder-upgrade # Cleanup -if [ "$CLEAN" == "clean" ]; then - $sudo aptitude clean +if [ "$CLEAN" != "noclean" ]; then + $sudo apt-get clean fi |