From 70995b198931e40fb4b518fb660b0bc8f172f0c8 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 13 May 2017 02:38:27 +0200 Subject: [PATCH] fix guest addition installation, fixes wallpaper that doesn't work before user creation, and add brand new buildozer.desktop --- buildozer/tools/packer/.gitignore | 1 + buildozer/tools/packer/http/buildozer.desktop | 7 +++ .../install-virtualbox-guest-additions.sh | 3 +- buildozer/tools/packer/scripts/setup.sh | 46 ++++++++++++++----- buildozer/tools/packer/template.json | 2 +- 5 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 buildozer/tools/packer/.gitignore create mode 100644 buildozer/tools/packer/http/buildozer.desktop diff --git a/buildozer/tools/packer/.gitignore b/buildozer/tools/packer/.gitignore new file mode 100644 index 0000000..e893b4d --- /dev/null +++ b/buildozer/tools/packer/.gitignore @@ -0,0 +1 @@ +packer_cache diff --git a/buildozer/tools/packer/http/buildozer.desktop b/buildozer/tools/packer/http/buildozer.desktop new file mode 100644 index 0000000..8804092 --- /dev/null +++ b/buildozer/tools/packer/http/buildozer.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Buildozer +Exec=firefox -url "file:///usr/share/applications/buildozer-welcome/index.html" -width 600 -height 800 +Icon=/usr/share/applications/buildozer-welcome/icon.png +Categories=Application;Development;favourite; diff --git a/buildozer/tools/packer/scripts/install-virtualbox-guest-additions.sh b/buildozer/tools/packer/scripts/install-virtualbox-guest-additions.sh index 3b714f8..ba20f72 100644 --- a/buildozer/tools/packer/scripts/install-virtualbox-guest-additions.sh +++ b/buildozer/tools/packer/scripts/install-virtualbox-guest-additions.sh @@ -3,11 +3,10 @@ # Mount the disk image cd /tmp mkdir /tmp/isomount -mount -t iso9660 -o loop /root/VBoxGuestAdditions.iso /tmp/isomount +mount -t iso9660 /dev/sr1 /tmp/isomount # Install the drivers /tmp/isomount/VBoxLinuxAdditions.run # Cleanup umount isomount -rm -rf isomount /root/VBoxGuestAdditions.iso diff --git a/buildozer/tools/packer/scripts/setup.sh b/buildozer/tools/packer/scripts/setup.sh index 8b107f5..701f09d 100644 --- a/buildozer/tools/packer/scripts/setup.sh +++ b/buildozer/tools/packer/scripts/setup.sh @@ -1,5 +1,22 @@ #!/bin/bash -export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" +# xfconf doesn't work with sudo, even with XAUTHORITY + DISPLAY +# seems that the user need to log to be able to use them. + +# keep them for reference for now. +# change theme (works better for this wallpaper) +# xfconf-query -c xfce4-desktop \ +# --property /backdrop/screen0/monitor0/workspace0/last-image \ +# --set /usr/share/backgrounds/kivy-wallpaper.png +# xfconf-query -c xsettings \ +# --property /Net/ThemeName \ +# --set Adwaita +# xfconf-query -c xsettings \ +# --property /Net/IconThemeName \ +# --set elementary-xfce-darker + + + +set -x # ensure the kivy user can mount shared folders adduser kivy vboxsf @@ -16,22 +33,27 @@ chown kivy.kivy /home/kivy/.face # set wallpaper wget $PACKER_HTTP_ADDR/wallpaper.png mv wallpaper.png /usr/share/backgrounds/kivy-wallpaper.png -xfconf-query -c xfce4-desktop \ - --property /backdrop/screen0/monitor0/workspace0/last-image \ - --set /usr/share/backgrounds/kivy-wallpaper.png +sed -i "s:/usr/share/xfce4/backdrops/xubuntu-wallpaper.png:/usr/share/backgrounds/kivy-wallpaper.png:g" /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml +sed -i "s:Greybird:Adwaita:g" /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml +sed -i "s:Greybird:Adwaita:g" /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml +sed -i "s:Greybird:Adwaita:g" /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml +sed -i "s:Greybird:Adwaita:g" /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-notifyd.xml +sed -i "s:elementary-xfce-dark:elementary-xfce-darkest:g" /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml -# change theme (works better for this wallpaper) -xfconf-query -c xsettings \ - --property /Net/ThemeName \ - --set Adwaita -xfconf-query -c xsettings \ - --property /Net/IconThemeName \ - --set elementary-xfce-darker +# add desktop icon +wget $PACKER_HTTP_ADDR/buildozer.desktop +mkdir -p /home/kivy/Desktop +cp buildozer.desktop /home/kivy/Desktop/ +chown kivy.kivy /home/kivy/Desktop +mv buildozer.desktop /usr/share/applications/ +sed -i "s:^favorites=.*$:favorites=buildozer.desktop,exo-terminal-emulator.desktop,exo-web-browser.desktop,exo-file-manager.desktop,org.gnome.Software.desktop,xfhelp4.desktop:g" /etc/xdg/xdg-xubuntu/xfce4/whiskermenu/defaults.rc # copy welcome directory mkdir -p /usr/share/applications/buildozer-welcome cd /usr/share/applications/buildozer-welcome wget $PACKER_HTTP_ADDR/welcome/milligram.min.css wget $PACKER_HTTP_ADDR/welcome/buildozer.css -wget $PACKER_HTTP_ADDR/welcome/index.css +wget $PACKER_HTTP_ADDR/welcome/index.html +wget $PACKER_HTTP_ADDR/kivy-icon-96.png +mv kivy-icon-96.png icon.png cd - diff --git a/buildozer/tools/packer/template.json b/buildozer/tools/packer/template.json index 232bea9..10557d0 100644 --- a/buildozer/tools/packer/template.json +++ b/buildozer/tools/packer/template.json @@ -33,7 +33,7 @@ "shutdown_command": "echo {{user `ssh_password`}} | sudo -S shutdown -P now", "vm_name": "Kivy/Buildozer VM", "guest_os_type": "Ubuntu_64", - "guest_additions_path": "/root", + "guest_additions_mode": "attach", "ssh_wait_timeout": "120m" }], "provisioners": [{