-
-
Save smoser/1031796 to your computer and use it in GitHub Desktop.
example content for preseed_late
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This file is executed via preseed_late with content like: | |
# d-i preseed/late_command string wget -O /target/root/late http://nelson/uquick/late; chroot /target /bin/bash /root/late | |
# | |
# | |
set > /root/late.environ | |
UMOUNT_PROC=false | |
UMOUNT_SYS=false | |
cleanup() { | |
$UMOUNT_PROC && umount /proc && UMOUNT_PROC=false | |
$UMOUNT_SYS && umount /sys && UMOUNT_SYS=false | |
} | |
trap cleanup EXIT | |
set -x | |
{ | |
export LANG=C | |
#postfix insists on prompting, i dont know why | |
#environment contains 'DEBIAN_HAS_FRONTEND=1' | |
unset DEBIAN_HAS_FRONTEND DEBIAN_FRONTEND DEBCONF_REDIR DEBCONF_OLD_FD_BASE | |
export DEBIAN_FRONTEND=noninteractive | |
{ [ -e /proc/$$ ] || mount -t proc /proc /proc; } && UMOUNT_PROC=true || | |
{ echo "FAILED TO MOUNT PROC"; exit 1; } | |
{ [ -e /sys/bus ] || mount -t sysfs /sys /sys; } && UMOUNT_SYS=true || | |
{ echo "FAILED TO MOUNT SYS"; exit 1; } | |
nelson_ip=$(host nelson | awk '{print $4}') | |
echo "$nelson_ip nelson nelson.mosers.us us.archive.ubuntu.com" > /etc/hosts | |
sed -i 's,//.*archive.ubuntu.com,//us.archive.ubuntu.com,' /etc/apt/sources.list | |
( | |
apt-get update --assume-yes ; | |
apt-get dist-upgrade --assume-yes ; | |
apt-get install --assume-yes \ | |
bzr pastebinit ubuntu-dev-tools ccache bzr-builddeb vim-nox lftp \ | |
build-essential euca2ools cloud-utils python-software-properties \ | |
; | |
) </dev/null | |
( umask 226 && cat > /etc/sudoers.d/90-ubuntu-user ) <<EOF | |
# ubuntu gets passwordless sudo functionality. | |
ubuntu ALL=(ALL) NOPASSWD:ALL | |
EOF | |
sudo -Hu ubuntu sh <<"ENDEND" | |
mkdir ~/bin | |
cat >> ~/.profile <<"EOF" | |
export EDITOR=vi | |
export DEB_BUILD_OPTIONS=parallel=4 | |
export PATH=/usr/lib/ccache:$PATH | |
EOF | |
echo "set -o vi" >> ~/.bashrc | |
ssh-import-id smoser | |
ENDEND | |
echo "==== date: $(date -R) ====" | |
echo "==== uptime: $(uptime) ====" | |
cat /proc/uptime | |
} 2>&1 | tee /root/late.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment