forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/packer: adapt for Ubuntu 18.04
This change is also a complete refactoring of the generation of the vagrant image
- Loading branch information
Showing
15 changed files
with
443 additions
and
265 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
packer_cache | ||
output-*-virtualbox-iso/ | ||
*.box |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#choose-mirror-bin mirror/http/proxy string | ||
d-i base-installer/kernel/override-image string linux-server | ||
d-i clock-setup/utc boolean true | ||
d-i clock-setup/utc-auto boolean true | ||
d-i finish-install/reboot_in_progress note | ||
d-i grub-installer/only_debian boolean true | ||
d-i grub-installer/with_other_os boolean true | ||
d-i partman-auto-lvm/guided_size string max | ||
d-i partman-auto/choose_recipe select atomic | ||
d-i partman-auto/method string lvm | ||
d-i partman-lvm/confirm boolean true | ||
d-i partman-lvm/confirm boolean true | ||
d-i partman-lvm/confirm_nooverwrite boolean true | ||
d-i partman-lvm/device_remove_lvm boolean true | ||
d-i partman/choose_partition select finish | ||
d-i partman/confirm boolean true | ||
d-i partman/confirm_nooverwrite boolean true | ||
d-i partman/confirm_write_new_label boolean true | ||
|
||
# Default mirror | ||
d-i mirror/country string FR | ||
d-i mirror/http/hostname string ftp.fr.debian.org | ||
d-i mirror/http/directory string /ubuntu | ||
d-i mirror/http/proxy string | ||
d-i mirror/http/mirror string ftp.fr.debian.org | ||
|
||
# Default user | ||
d-i passwd/user-fullname string user | ||
d-i passwd/username string user | ||
d-i passwd/user-password password user | ||
d-i passwd/user-password-again password user | ||
d-i passwd/username string user | ||
|
||
# Minimum packages (see postinstall.sh) | ||
d-i pkgsel/include string openssh-server | ||
d-i pkgsel/install-language-support boolean true | ||
d-i pkgsel/update-policy select none | ||
d-i pkgsel/upgrade select none | ||
|
||
d-i time/zone string UTC | ||
d-i user-setup/allow-password-weak boolean true | ||
d-i user-setup/encrypt-home boolean false | ||
tasksel tasksel/first multiselect standard, ubuntu-server |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apt-get update | ||
apt-get -y upgrade | ||
apt-get -y install linux-headers-$(uname -r) | ||
|
||
# Fix locale setup | ||
locale-gen | ||
localectl set-locale LANG="en_US.UTF-8" | ||
|
||
# Allow usage of serial port | ||
adduser ${SSH_USERNAME} dialout | ||
|
||
echo '%sudo ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
echo "UseDNS no" >> /etc/ssh/sshd_config |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
apt-get -y upgrade | ||
apt-get -y autoremove | ||
apt-get -y clean | ||
|
||
echo "cleaning up guest additions" | ||
rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? | ||
|
||
echo "cleaning permissions" | ||
chown -R ${SSH_USERNAME}:${SSH_USERNAME} /home/${SSH_USERNAME} | ||
|
||
# Remove some packages to get a minimal install | ||
echo "==> Removing all linux kernels except the current one" | ||
dpkg --list | awk '{ print $2 }' | grep 'linux-image-*-generic' | grep -v $(uname -r) | xargs apt-get -y purge | ||
echo "==> Removing linux source" | ||
dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge | ||
echo "==> Removing documentation" | ||
dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge | ||
echo "==> Removing default system Ruby" | ||
apt-get -y purge ruby ri doc | ||
echo "==> Removing obsolete networking components" | ||
apt-get -y purge ppp pppconfig pppoeconf | ||
echo "==> Removing other oddities" | ||
apt-get -y purge popularity-contest installation-report landscape-common wireless-tools wpasupplicant | ||
|
||
# Clean up the apt cache | ||
apt-get -y autoremove --purge | ||
apt-get -y autoclean | ||
apt-get -y clean | ||
|
||
echo "removing man pages" | ||
rm -rf /usr/share/man/* | ||
echo "removing APT files" | ||
find /var/lib/apt -type f | xargs rm -f | ||
echo "removing any docs" | ||
rm -rf /usr/share/doc/* | ||
echo "removing caches" | ||
find /var/cache -type f -exec rm -rf {} \; | ||
|
||
echo "cleaning up tmp" | ||
rm -rf /tmp/* | ||
|
||
# Remove Bash history | ||
unset HISTFILE | ||
rm -f /root/.bash_history | ||
rm -f ${SSH_USER_HOME}/.bash_history | ||
|
||
# Clean up log files | ||
find /var/log -type f | while read f; do echo -ne '' > "${f}"; done; | ||
|
||
echo "clearing last login information" | ||
>/var/log/lastlog | ||
>/var/log/wtmp | ||
>/var/log/btmp | ||
|
||
echo "whiteout /" | ||
count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}') | ||
let count-- | ||
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count | ||
rm /tmp/whitespace | ||
|
||
echo "whiteout /boot" | ||
count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}') | ||
let count-- | ||
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count | ||
rm /boot/whitespace | ||
|
||
echo "clear out swap and disable until reboot" | ||
set +e | ||
swapuuid=$(/sbin/blkid -o value -l -s UUID -t TYPE=swap) | ||
case "$?" in | ||
2|0) ;; | ||
*) exit 1 ;; | ||
esac | ||
set -e | ||
if [ "x${swapuuid}" != "x" ]; then | ||
# Whiteout the swap partition to reduce box size | ||
# Swap is disabled till reboot | ||
swappart=$(readlink -f /dev/disk/by-uuid/$swapuuid) | ||
/sbin/swapoff "${swappart}" | ||
dd if=/dev/zero of="${swappart}" bs=1M || echo "dd exit code $? is suppressed" | ||
/sbin/mkswap -U "${swapuuid}" "${swappart}" | ||
fi | ||
|
||
echo "whiteout free space" | ||
dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed" | ||
rm -f /EMPTY | ||
|
||
sync | ||
|
||
echo "disk usage" | ||
df -h |
Oops, something went wrong.