Created
October 4, 2016 19:47
-
-
Save mytskine/504ef6f88cdee12ecad54abbdaa9176b to your computer and use it in GitHub Desktop.
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
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "debian/jessie64" | |
# Disable automatic box update checking. | |
config.vm.box_check_update = false | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
#config.vm.synced_folder ".", "/vagrant" | |
config.vm.synced_folder "../Qt", "/home/vagrant/Qt", :mount_options => [ "ro" ] | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
# config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# vb.gui = true | |
# | |
# # Customize the amount of memory on the VM: | |
# vb.memory = "1024" | |
# end | |
# | |
# View the documentation for the provider you are using for more | |
# information on available options. | |
config.vm.provision "shell", inline: <<-SHELL | |
echo "deb http://httpredir.debian.org/debian jessie main contrib\ndeb http://security.debian.org/ jessie/updates main contrib" > /etc/apt/sources.list | |
apt-get update | |
apt-get upgrade --yes --no-install-recommends | |
apt-get install --yes virtualbox-guest-utils virtualbox-guest-dkms linux-headers-amd64 | |
apt-get install --yes libfuse-dev libglib2.0-dev cmake git libc6-dev binutils realpath fuse squashfs-tools libjte-dev | |
apt-get install --yes g++ mesa-common-dev libhunspell-dev | |
apt-get install --yes --no-install-recommends libgl1-mesa-glx libdbus-1-3 libpulse0 libnss3 libnspr4 libfontconfig1 libxcursor1 libasound2 libxtst6 libxslt1.1 libegl1-mesa libxcomposite1 | |
echo '#!/bin/sh | |
[ -e "cmake-3.6.2-Linux-x86_64.sh" ] || wget --quiet https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.sh | |
sh cmake-3.6.2-Linux-x86_64.sh --include-subdir --skip-licence | |
' > /home/vagrant/cmake.sh | |
echo '#!/bin/sh | |
[ -d "AppImageKit" ] || git clone https://github.com/probonopd/AppImageKit.git | |
cd AppImageKit | |
git pull | |
make clean || true | |
/home/vagrant/cmake-3.6.2-Linux-x86_64/bin/cmake . | |
make | |
' > /home/vagrant/appimage.sh | |
echo '#!/bin/sh | |
cd | |
[ -d otter-build ] || mkdir otter-build | |
cd otter-build | |
make clean || true | |
QT_QMAKE_EXECUTABLE=/home/vagrant/Qt/5.7/gcc_64/bin/qmake CMAKE_PREFIX_PATH=/home/vagrant/Qt/5.7/gcc_64 /home/vagrant/cmake-3.6.2-Linux-x86_64/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr /vagrant/ | |
make | |
make DESTDIR=. install | |
' > /home/vagrant/otter-build.sh | |
echo '#!/bin/bash | |
cd | |
[ -d "otter.AppDir" ] && rm -fr "otter.AppDir" | |
mkdir -p otter.AppDir | |
cp AppImageKit/AppRun otter.AppDir/ | |
cd otter.AppDir | |
cp -r ~/otter-build/usr . | |
[ -d usr/lib ] || mkdir -p usr/lib | |
ldd ~/otter-build/otter-browser | grep "=> /" | awk "{print \\$3}" | xargs -I "{}" cp -v -n "{}" usr/lib/ | |
ldd usr/lib/lib* | grep "=> /" | grep -v "/home" | awk "{print \\$3}" | sort | uniq | xargs -I "{}" cp -v -n "{}" usr/lib/ | |
mkdir -p usr/lib/qt5/plugins/ | |
for plugin in ~/Qt/5.7/gcc_64/plugins/{bearer,iconengines,imageformats,platforminputcontexts,platforms,xcbglintegrations} | |
do | |
ldd $plugin/*.so | grep "=> /" | awk "{print \\$3}" | sort | uniq | xargs -I "{}" cp -v -n "{}" usr/lib/ | |
cp -v -n -r $plugin usr/lib/qt5/plugins/ | |
done | |
rm -f usr/lib/libstdc* usr/lib/libc.so.* usr/lib/libgobject* usr/lib/libpthread.so.* usr/lib/librt.so.* usr/lib/libglib-2.0.so* usr/lib/libm.so* | |
cp usr/share/applications/otter-browser.desktop . | |
cp usr/share/icons/hicolor/48x48/apps/otter-browser.png . | |
cd | |
rm -f "otter-browser-x86_64.AppImage" || true | |
./AppImageKit/AppImageAssistant.AppDir/package otter.AppDir "otter-browser-x86_64.AppImage" | |
' > /home/vagrant/otter-appimage.sh | |
cd /home/vagrant | |
chown vagrant: /home/vagrant/*.sh | |
chmod u+x /home/vagrant/*.sh | |
sudo -u vagrant sh cmake.sh | |
sudo -u vagrant sh appimage.sh | |
SHELL | |
# | |
# To create the image: | |
# vagrant ssh -c ./otter-build.sh | |
# vagrant ssh -c ./otter-appimage.sh | |
# | |
# To get the image: | |
# scp -i .vagrant/machines/default/virtualbox/private_key -o "NoHostAuthenticationForLocalhost=True" -P 2200 vagrant@127.0.0.1:otter-browser-x86_64.AppImage . | |
# (use `vagrant ssh-config` to check the path and the port are valid) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment