Skip to content

Instantly share code, notes, and snippets.

@triangletodd
Created December 25, 2017 05:54
Show Gist options
  • Select an option

  • Save triangletodd/a2cad20bc6f50d1ca3be79ed7589d0d2 to your computer and use it in GitHub Desktop.

Select an option

Save triangletodd/a2cad20bc6f50d1ca3be79ed7589d0d2 to your computer and use it in GitHub Desktop.
Debian Stretch Virtualbox VM.
#!/usr/bin/env bash
set -e
PACKAGES="i3 tmux vim stow"
read -d '' APT_SRC <<"EOF" ||:
deb http://mirrors.kernel.org/debian/ stretch main contrib non-free
deb http://security.debian.org/debian-security stretch/updates main
deb http://mirrors.kernel.org/debian/ stretch-updates main contrib non-free
deb http://mirrors.kernel.org/debian stretch-backports main contrib non-free
EOF
is_vbox() {
if ! hash dmidecode 2> /dev/null || ! hash sed 2> /dev/null; then return 1; fi
output=$(dmidecode -t system | sed -e '/Product Name:/!d' -e 's/\s*Product Name: \(.*\)/\1/')
[[ $output == 'VirtualBox' ]]
}
if is_vbox; then
if ! hash curl 2> /dev/null; then apt update; apt install -y curl; fi
vbox_src="deb http://download.virtualbox.org/virtualbox/debian stretch contrib"
echo "$vbox_src" > /etc/apt/sources.list.d/vbox.list
curl -L https://www.virtualbox.org/download/oracle_vbox_2016.asc | apt-key add -
PACKAGES+=" virtualbox-guest-dkms virtualbox-guest-x11 linux-headers-$(uname -r)"
fi
echo "$APT_SRC" > /etc/apt/sources.list
apt update
apt upgrade -y
apt install -y $PACKAGES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment