aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-09 12:57:01 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-09 12:57:01 -0300
commit9df8e5d678a828ce8426973ba9edb37e3c210668 (patch)
treefbe27425ad142da380bba9b168493746786d6e26
parentb57880c74412bb391571422d0ea3a8a67f56535b (diff)
downloadhydra-9df8e5d678a828ce8426973ba9edb37e3c210668.tar.gz
hydra-9df8e5d678a828ce8426973ba9edb37e3c210668.tar.bz2
Adds commented code for a custom provision-img version
-rwxr-xr-xshare/hydractl/provision-img68
1 files changed, 68 insertions, 0 deletions
diff --git a/share/hydractl/provision-img b/share/hydractl/provision-img
index 8522466..7f42e28 100755
--- a/share/hydractl/provision-img
+++ b/share/hydractl/provision-img
@@ -73,3 +73,71 @@ hydra_sudo_run chown -R `whoami`. `dirname $image`
# Cleanup
hydra_sudo_run rm debootstrap.log
hydra_sudo_run rm ${image}.raw
+
+#
+# Custom version
+#
+#
+#WORK="`mktemp -d`"
+#
+## Check for requirements.
+#for req in debootstrap grub-pc parted; do
+# hydra_install_package $req
+#done
+#
+#echo "Creating image..."
+#hydra_sudo_run dd if=/dev/zero of=$image bs=$size count=1
+#device="`sudo losetup --find --show $image`"
+#
+#echo "Partitioning image at $device..."
+#hydra_sudo_run parted -s -- $device mklabel gpt
+#hydra_sudo_run parted -s -- $device unit MB mkpart non-fs 2 3
+#hydra_sudo_run parted -s -- $device set 1 bios_grub on
+#hydra_sudo_run parted -s -- $device unit MB mkpart ext2 3 -1
+#hydra_sudo_run parted -s -- $device set 2 boot on
+#hydra_sudo_run mkfs.ext3 ${device}p2
+#hydra_sudo_run mount ${device}p2 $WORK/
+#
+## Non-interactive installation
+#APT_INSTALL="hydra_sudo_run LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $WORK/ apt-get install -y"
+#
+## Initial system install.
+#echo "Installing base system..."
+#hydra_sudo_run LC_ALL=C DEBIAN_FRONTEND=noninteractive debootstrap --arch=$arch $version $WORK/ $mirror
+#
+## Initial configuration.
+#echo "Applying initial configuration..."
+#hydra_sudo_run mount none -t proc $WORK/proc
+#hydra_sudo_run mount none -t sysfs $WORK/sys
+#hydra_sudo_run mount -o bind /dev/ $WORK/dev
+#echo LANG=C | $SUDO tee $WORK/etc/default/locale > /dev/null
+#
+## Hostname configuration.
+#echo $hostname.$domain | $SUDO tee $WORK/etc/hostname > /dev/null
+#echo "127.0.0.1 localhost" | $SUDO tee -a $WORK/etc/hosts > /dev/null
+#
+## This ordering is important for facter correctly guess the domain name
+#echo "127.0.0.1 $hostname.$domain $hostname" | $SUDO tee -a $WORK/etc/hosts > /dev/null
+#
+## Invert hostname contents to avoid http://projects.puppetlabs.com/issues/2533
+#tac $WORK/etc/hosts | $SUDO tee $WORK/etc/hosts.new > /dev/null
+#hydra_sudo_run mv $WORK/etc/hosts.new $WORK/etc/hosts
+#
+## Initial upgrade.
+#echo "Applying initial upgrades..."
+#hydra_sudo_run chroot $WORK/ apt-get update
+#hydra_sudo_run chroot $WORK/ apt-get upgrade -y
+#
+#$APT_INSTALL locales
+#$APT_INSTALL screen cron lsb-release openssl -y
+#$APT_INSTALL linux-image-$kernel_arch -y
+#$APT_INSTALL grub-pc -y
+#hydra_sudo_run chroot $WORK/ update-grub
+#
+## Teardown
+#hydra_sudo_run umount $WORK/proc
+#hydra_sudo_run umount $WORK/sys
+#hydra_sudo_run umount $WORK/dev
+#hydra_sudo_run umount $WORK
+#hydra_sudo_run rmdir $WORK
+#hydra_sudo_run losetup -d $device