diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/base.sh | 41 | ||||
-rw-r--r-- | scripts/cleanup.sh | 4 | ||||
-rw-r--r-- | scripts/custom.sh | 9 | ||||
-rw-r--r-- | scripts/vagrant.sh | 8 | ||||
-rw-r--r-- | scripts/zerodisk.sh | 2 |
5 files changed, 44 insertions, 20 deletions
diff --git a/scripts/base.sh b/scripts/base.sh index 26ce76d..bc34192 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -1,5 +1,18 @@ #!/bin/bash +# setup locales +echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen +locale-gen en_US.UTF-8 +update-locale LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 + +# Set up apt repos +echo -e "deb http://deb.debian.org/debian/ jessie main\ndeb http://security.debian.org/ jessie/updates main" > /etc/apt/sources.list +echo "deb http://deb.debian.org/debian/ jessie-backports main" > /etc/apt/sources.list.d/backports.list + +# Add LEAP debian repo +echo 'deb http://deb.leap.se/0.9 jessie main' > /etc/apt/sources.list.d/leap.list + # Update the box apt-get -y update >/dev/null apt-get -q -y -o \'DPkg::Options::=--force-confold\' dist-upgrade @@ -7,16 +20,22 @@ apt-get -q -y -o \'DPkg::Options::=--force-confold\' dist-upgrade # Tweak sshd to prevent DNS resolution (speed up logins) echo 'UseDNS no' >> /etc/ssh/sshd_config -# Remove 5s grub timeout to speed up booting -cat <<EOF > /etc/default/grub -# If you change this file, run 'update-grub' afterwards to update -# /boot/grub/grub.cfg. +# Only update grub when it's installed (lxc won't have it +if [ -e /usr/sbin/update-grub ] +then + # Remove 5s grub timeout to speed up booting + # Heredoc NEEDS to be indented with tabs not spaces + # https://unix.stackexchange.com/questions/76481/cant-indent-heredoc-to-match-nestings-indent + cat <<-EOF > /etc/default/grub + # If you change this file, run 'update-grub' afterwards to update + # /boot/grub/grub.cfg. -GRUB_DEFAULT=0 -GRUB_TIMEOUT=0 -GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` -GRUB_CMDLINE_LINUX_DEFAULT="quiet" -GRUB_CMDLINE_LINUX="debian-installer=en_US" -EOF + GRUB_DEFAULT=0 + GRUB_TIMEOUT=0 + GRUB_DISTRIBUTOR=$(lsb_release -i -s 2> /dev/null || echo Debian) + GRUB_CMDLINE_LINUX_DEFAULT="quiet" + GRUB_CMDLINE_LINUX="debian-installer=en_US" + EOF -update-grub + update-grub +fi diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index a4aa298..b66075f 100644 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -10,10 +10,10 @@ rm /var/lib/dhcp/* # Make sure Udev doesn't block our network echo "cleaning up udev rules" -rm /etc/udev/rules.d/70-persistent-net.rules +[ -e /etc/udev/rules.d/70-persistent-net.rules ] && rm /etc/udev/rules.d/70-persistent-net.rules mkdir /etc/udev/rules.d/70-persistent-net.rules rm -rf /dev/.udev/ -rm /lib/udev/rules.d/75-persistent-net-generator.rules +[ -e /lib/udev/rules.d/75-persistent-net-generator.rules ] && rm /lib/udev/rules.d/75-persistent-net-generator.rules echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" echo "pre-up sleep 2" >> /etc/network/interfaces diff --git a/scripts/custom.sh b/scripts/custom.sh index a34d1d6..9ed5ceb 100644 --- a/scripts/custom.sh +++ b/scripts/custom.sh @@ -4,10 +4,13 @@ sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config # install additional packages -apt-get -y install puppet lsb-release facter rsync curl +# LEAP people like some of these: see also #6898 and https://github.com/leapcode/leap_cli/pull/17 -# LEAP people like this: see also #6898 -apt-get -y install unzip vim tmux ntpdate git rdoc +apt-get -y install leap-archive-keyring puppet lsb-release facter rsync curl bash-completion wget sudo unzip vim tmux ntp git rdoc + +# Don't use client locales +# https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh +sed 's/^AcceptEnv.*//' /etc/ssh/sshd_config # Set root pw echo 'root:vagrant' | chpasswd diff --git a/scripts/vagrant.sh b/scripts/vagrant.sh index 900fe9c..4e2a11b 100644 --- a/scripts/vagrant.sh +++ b/scripts/vagrant.sh @@ -6,12 +6,14 @@ date > /etc/vagrant_box_build_time # Installing vagrant key for root -mkdir -pm 700 /root/.ssh -wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /root/.ssh/authorized_keys +mkdir -m 0700 /root/.ssh +chmod 0700 /root /root/.ssh +wget --no-check-certificate 'https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /root/.ssh/authorized_keys chmod 0600 /root/.ssh/authorized_keys # Installing vagrant key for vagrant user -cp -a /root/.ssh/ /home/vagrant/ +getent passwd vagrant || useradd -m vagrant -s /bin/bash +cp -a /root/.ssh /home/vagrant/ chown -R vagrant:vagrant /home/vagrant/.ssh # configure password-less sudo diff --git a/scripts/zerodisk.sh b/scripts/zerodisk.sh index 35370d6..530ca4d 100644 --- a/scripts/zerodisk.sh +++ b/scripts/zerodisk.sh @@ -1,7 +1,7 @@ #!/bin/bash # Zero out the free space to save space in the final image: -dd if=/dev/zero of=/EMPTY bs=1M +dd if=/dev/zero of=/tmp/EMPTY bs=1M rm -f /EMPTY # Sync to ensure that the delete completes before this moves on. |