Skip to content

Instantly share code, notes, and snippets.

@johnjelinek
Last active April 22, 2016 07:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjelinek/7299099 to your computer and use it in GitHub Desktop.
Save johnjelinek/7299099 to your computer and use it in GitHub Desktop.
Windows Vagrant Box Maker

Windows Vagrant Box Maker

It's been incredibly difficult to get Windows boxes up on http://vagrantbox.es. Between licensing and trial keys, offering a windows box has been a challenge. Not anymore! With the Windows Vagrant Box Maker, a fully functional box is generated daily and can be downloaded whenever you need it!

#!/bin/bash
# Build Box
source ~/.profile
cd ~/veewee
bundle exec veewee vbox build $1 --nogui --force
#!/bin/bash
# Build Box
source ~/.profile
cd ~/veewee
bundle exec veewee vbox export $1
mv $1.box ~/output/
#!/bin/bash
# Install dependencies
sudo apt-get install -y software-properties-common python-software-properties moreutils
# Install Java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java7-installer
# Build Essential
sudo apt-get install -y build-essential openssl libreadline6 \
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev \
ncurses-dev automake libtool bison subversion
# Rbenv
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo '# Rbenv' >> ~/.profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source ~/.profile
mkdir -p ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git \
~/.rbenv/plugins/ruby-build
# Ruby
rbenv install 2.0.0-p247
rbenv rehash
rbenv global 2.0.0-p247
# Install Gem Dependencies
gem install bundler
rbenv rehash
# VirtualBox 4.3
VBOX_LATEST_VERSION=$(curl http://download.virtualbox.org/virtualbox/LATEST.TXT)
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" > /etc/apt/sources.list.d/virtualbox.list'
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- \
| sudo apt-key add -
sudo apt-get update
sudo apt-get install -y dkms virtualbox-4.3
wget -c http://download.virtualbox.org/virtualbox/${VBOX_LATEST_VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_LATEST_VERSION}.vbox-extpack -O /tmp/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_LATEST_VERSION}.vbox-extpack
sudo VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_LATEST_VERSION}.vbox-extpack
rm /tmp/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_LATEST_VERSION}.vbox-extpack
# Veewee
git clone https://github.com/jedi4ever/veewee.git
cd veewee
bundle install
rbenv rehash
# Vagrant & vagrant windows
wget http://files.vagrantup.com/packages/a40522f5fabccb9ddabad03d836e120ff5d14093/vagrant_1.3.5_x86_64.deb
sudo dpkg -i vagrant_1.3.5_i686.deb
rm vagrant_1.3.5_i686.deb
vagrant plugin install vagrant-windows
# Create box
bundle exec veewee vbox define 'windows-7-enterprise-i386' \
'windows-7-enterprise-i386' # note: I use the default configuration from veewee
bundle exec veewee vbox define 'windows-7-enterprise-i386' \
'windows-7sp1-enterprise-i386' # note: I modify the definitions.rb to use a different ISO from MSDN
#!/bin/bash
# Install cronjobs
(crontab -l ; echo "45 22 * * * ~/build.sh windows-7-enterprise-i386 | ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> ~/veewee/log/run.log") | crontab -
(crontab -l ; echo "40 23 * * * ~/export.sh windows-7-enterprise-i386 | ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> ~/veewee/log/run.log") | crontab -
(crontab -l ; echo "00 23 * * * ~/build.sh windows-7sp1-enterprise-i386 | ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> ~/veewee/log/run.log") | crontab -
(crontab -l ; echo "00 00 * * * ~/export.sh windows-7sp1-enterprise-i386 | ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> ~/veewee/log/run.log") | crontab -
#!/bin/bash
# Kernel Backport
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y linux-image-generic-lts-raring \
linux-headers-generic-lts-raring
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment