diff --git a/.gitignore b/.gitignore index 8351056..a165d88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +vagrant/ogbrowser-sway/.vagrant CMakeLists.txt.user* out build diff --git a/vagrant/ogbrowser-sway/Vagrantfile b/vagrant/ogbrowser-sway/Vagrantfile new file mode 100644 index 0000000..0a97618 --- /dev/null +++ b/vagrant/ogbrowser-sway/Vagrantfile @@ -0,0 +1,79 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.box = "bento/ubuntu-22.04" + + config.nfs.verify_installed = false + #config.vm.synced_folder '.', '/vagrant', disabled: true + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # 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 "../data", "/vagrant_data" + config.vm.synced_folder '.', '/vagrant', type: 'sshfs' + config.vm.synced_folder "../..", "/vagrant_data", type: 'sshfs' + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + config.vm.provider "libvirt" do |v| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + v.memory = "4096" + end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + config.vm.provision "shell", path: "init.sh" + # apt-get update + # apt-get install -y apache2 + # SHELL + + config.vm.provider "virtualbox" do |v| + v.memory = "4096" + end +end diff --git a/vagrant/ogbrowser-sway/files/sway/config b/vagrant/ogbrowser-sway/files/sway/config new file mode 100644 index 0000000..7ee89b2 --- /dev/null +++ b/vagrant/ogbrowser-sway/files/sway/config @@ -0,0 +1 @@ +exec /usr/bin/OGBrowser https://google.com diff --git a/vagrant/ogbrowser-sway/init.sh b/vagrant/ogbrowser-sway/init.sh new file mode 100755 index 0000000..18322d5 --- /dev/null +++ b/vagrant/ogbrowser-sway/init.sh @@ -0,0 +1,41 @@ +#!/bin/bash +set -e +export DEBIAN_FRONTEND=noninteractive +export DEBIAN_PRIORITY=critical +export NEEDRESTART_MODE=a + + +BUILD_DEPENDENCIES="build-essential cmake g++ qt6-base-dev qt6-webengine-dev linguist-qt6 libgl1-mesa-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libqt6core5compat6-dev lxqt-build-tools qt6-webengine-dev-tools libqt6webenginecore6-bin" + + +## Initial setup +sudo apt update +sudo apt dist-upgrade -y + + +## Install dependencies and build +sudo apt install -y $BUILD_DEPENDENCIES + +mkdir -p /tmp/build +cd /tmp/build +cmake /vagrant_data/ +make -j2 +sudo make install + + +## Ensure we have the requirements to run the browser +sudo apt install -y sway qt6-wayland kitty-terminfo ncdu libqt6core5compat6 libqt6webenginewidgets6 libqt6webenginecore6-bin + + + +## Remove everything unneeded. +sudo apt -y remove $BUILD_DEPENDENCIES libqt6webenginecore6-bin+ +sudo apt -y autoremove +sudo apt clean all +sudo journalctl --vacuum-size=16M + +## Setup sway + +mkdir -p /home/vagrant/.config/sway +cp -v /vagrant/files/sway/config /home/vagrant/.config/sway +chown -R vagrant:vagrant /home/vagrant/.config diff --git a/vagrant/ogbrowser-sway/logind.conf b/vagrant/ogbrowser-sway/logind.conf new file mode 100644 index 0000000..ab600bc --- /dev/null +++ b/vagrant/ogbrowser-sway/logind.conf @@ -0,0 +1,44 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file, or by creating "drop-ins" in +# the logind.conf.d/ subdirectory. The latter is generally recommended. +# Defaults can be restored by simply deleting this file and all drop-ins. +# +# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config. +# +# See logind.conf(5) for details. + +[Login] +#NAutoVTs=6 +#ReserveVT=6 +#KillUserProcesses=no +#KillOnlyUsers= +#KillExcludeUsers=root +#InhibitDelayMaxSec=5 +#UserStopDelaySec=10 +#HandlePowerKey=poweroff +#HandleSuspendKey=suspend +#HandleHibernateKey=hibernate +#HandleLidSwitch=suspend +#HandleLidSwitchExternalPower=suspend +#HandleLidSwitchDocked=ignore +#HandleRebootKey=reboot +#PowerKeyIgnoreInhibited=no +#SuspendKeyIgnoreInhibited=no +#HibernateKeyIgnoreInhibited=no +#LidSwitchIgnoreInhibited=yes +#RebootKeyIgnoreInhibited=no +#HoldoffTimeoutSec=30s +#IdleAction=ignore +#IdleActionSec=30min +#RuntimeDirectorySize=10% +#RuntimeDirectoryInodesMax=400k +#RemoveIPC=yes +#InhibitorsMax=8192 +#SessionsMax=8192