Skip to content

Commit 2508b00

Browse files
committed
build ZXBox from Ubuntu 20.04 desktop
1 parent 6af987f commit 2508b00

File tree

4 files changed

+52
-15
lines changed

4 files changed

+52
-15
lines changed

Vagrantfile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# vi: set ft=ruby :
33

44
# https://app.vagrantup.com/boxes/search
5-
vmbox_image = ENV["VMBOX_IMAGE"] || "generic/ubuntu2004"
5+
# "generic/ubuntu2004"
6+
# "peru/ubuntu-20.04-desktop-amd64"
7+
vmbox_image = ENV["VMBOX_IMAGE"] || "fasmat/ubuntu2004-desktop"
68

79

810
# Check required vagrant dependencies plugins and install them
9-
required_plugins = %w( vagrant-reload vagrant-disksize vagrant-reload )
11+
required_plugins = %w( vagrant-reload vagrant-disksize vagrant-reload vagrant-vbguest)
1012
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
1113
if not plugins_to_install.empty?
1214
puts "Installing plugins: #{plugins_to_install.join(' ')}"
@@ -33,11 +35,14 @@ Vagrant.configure("2") do |config|
3335
# set defaults for VMs
3436
config.vm.provider 'virtualbox' do |vb|
3537

36-
vb.name = "zx-spectrum-instapack-vbox"
38+
vb.name = "zxbox"
3739

3840
# enable native GUI window
3941
vb.gui = true
4042

43+
# enable RDP GUI access
44+
vb.customize ["modifyvm", :id, "--vrde", "on", "--vrdemulticon", "on", "--vrdeport", "3389"]
45+
4146
# hardware specs
4247
vb.customize ["modifyvm", :id, "--cpus", 2]
4348
vb.customize ["modifyvm", :id, "--memory", 3000]
@@ -47,10 +52,16 @@ Vagrant.configure("2") do |config|
4752
vb.customize ['modifyvm', :id, "--natdnshostresolver1", "off"]
4853

4954
# enable audio (none|dsound|oss|alsa|pulse|coreaudio: supported audio types depends on the host OS)
50-
vb.customize ["modifyvm", :id, "--audio", "pulse", "--audioout", "on", "--audiocontroller", "ac97"]
51-
52-
# enable RDP GUI access
53-
vb.customize ["modifyvm", :id, "--vrde", "on", "--vrdemulticon", "on", "--vrdeport", "3389"]
55+
vb.customize ["modifyvm", :id, "--audioout", "on"]
56+
if RUBY_PLATFORM =~ /darwin/
57+
vb.customize ["modifyvm", :id, '--audio', 'coreaudio']
58+
elsif RUBY_PLATFORM =~ /mingw|mswin|bccwin|cygwin|emx/
59+
vb.customize ["modifyvm", :id, '--audio', 'dsound']
60+
elsif RUBY_PLATFORM =~ /linux/
61+
vb.customize ["modifyvm", :id, '--audio', 'alsa']
62+
end
63+
64+
# virtualbox.customize ["modifyvm", :id, "--clipboard-mode", "bidirectional"]
5465

5566
# solve issue 'stuck connection timeout retrying' (kernel selection menu)
5667
# https://stackoverflow.com/questions/22575261/vagrant-stuck-connection-timeout-retrying

build_zxbox.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env bash
22
# build Virtualbox VM (see Vagrantfile)
3-
# Usage:
4-
# ./build_zxbox.sh
5-
#
3+
64
set -xe
75
SCRIPTDIR=$(cd `dirname $0` && pwd)
86
pushd $SCRIPTDIR
@@ -24,4 +22,10 @@ ssh $TARGETHOST "rm -rf ~/instapack"
2422
scp -rp $SCRIPTDIR $TARGETHOST:~/instapack
2523
set +e
2624
ssh $TARGETHOST "sudo bash ~/instapack/install_zxbox_ubuntu2004.sh"
27-
set -e
25+
26+
if [ -e $FROM_UBUNTUS_ERVER ]; then
27+
sleep 30
28+
# reboot again for autologin
29+
ssh $TARGETHOST "sudo reboot"
30+
set -e
31+
fi

install_zxbox_ubuntu2004.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
SCRIPTDIR=$(cd `dirname $0` && pwd)
33

44
apt-get update
5-
apt-get install -y xinit
65

76
# enable autologin
87
mv /etc/gdm3/custom.conf /etc/gdm3/custom.conf.bak
@@ -12,6 +11,7 @@ echo "AutomaticLogin = vagrant" >> /etc/gdm3/custom.conf
1211

1312

1413
apt-get install -y dosbox wine libgles2-mesa
14+
dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install wine32
1515

1616
apt-get install -y fuse-emulator-sdl
1717

@@ -20,6 +20,20 @@ apt-get install -y fuse-emulator-sdl
2020
mv $SCRIPTDIR/emul/usp $SCRIPTDIR/emul/usp.old
2121
bash $SCRIPTDIR/emul/build_usp_debian-ubuntu.sh
2222

23-
24-
# after install xinit boot into gui logon
25-
reboot
23+
# create shortcuts to lunch emulators
24+
ln -s $SCRIPTDIR /home/vagrant/Desktop
25+
cp $SCRIPTDIR/usp.desktop /home/vagrant/Desktop/
26+
27+
28+
if [ -e $FROM_UBUNTUS_ERVER ]; then
29+
# make ubuntu desktop from ubuntu server
30+
apt-get install -y xinit
31+
apt-get install -y gnome-panel gnome-tweaks
32+
# add Nemo default file manager in Ubuntu
33+
apt-get install -y nemo
34+
xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search
35+
gsettings set org.gnome.desktop.background show-desktop-icons false
36+
gsettings set org.nemo.desktop show-desktop-icons true
37+
# after install xinit boot into gui logon
38+
reboot
39+
fi

usp.desktop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Terminal=true
4+
Name=USP
5+
#Icon=
6+
Exec=/home/vagrant/instapack/linux-usp.sh
7+
8+

0 commit comments

Comments
 (0)