@@ -22,19 +22,68 @@ Vagrant.configure("2") do |config|
2222 end
2323
2424 config . vm . provision "shell" , privileged : false , inline : <<~SHELL
25- set -xueo pipefail
25+ set -ueo pipefail
2626
27- # Set git user and email from host.
27+ function on_exit() {
28+ if (($1 == 0)); then
29+ # Success
30+ subject="Now restart virtual machine"
31+ body="You must restart the virtual machine to apply changes from provisioning. $(date -Is)"
32+ else
33+ # Error
34+ subject="Provisioning failed (code $1)"
35+ body="Destroy and recreate this vagrant machine. See WARNING-NOT-PROVISIONED.txt on the desktop for details. $(date -Is)"
36+ fi
37+ echo >&2 "${subject}: ${body}"
38+ systemd-run --quiet --machine vagrant@.host --user notify-send --expire-time=0 "${subject}" "${body}"
39+ }
40+
41+ trap 'on_exit $?' EXIT
42+
43+ subject="Please wait"
44+ body="Please wait for provisioning to finish. $(date -Is)"
45+ systemd-run --quiet --machine vagrant@.host --user notify-send --expire-time=0 "${subject}" "${body}"
46+
47+ function retry() {
48+ i=0
49+ until "$@"; do
50+ ((++i <= 3))
51+ echo >&2 "Retrying ${i}"
52+ sleep 2m
53+ done
54+ }
55+
56+ echo "== Importing git user and email from host =="
2857 GIT_USER="#{ `git config --get user.name` . strip } "
2958 GIT_EMAIL="#{ `git config --get user.email` . strip } "
3059 [[ -z $GIT_USER ]] || git config --global user.name "${GIT_USER}"
3160 [[ -z $GIT_EMAIL ]] || git config --global user.email "${GIT_EMAIL}"
3261
62+ echo "== Installing npm =="
3363 cd ~/code/web-xforge
34- sudo npm install --global npm@11.11.0
64+ retry sudo npm install --global npm@11.11.0
65+
66+ # Change apt repo to https to avoid problems from stale proxies
67+ sudo sed -i 's|http://archive.ubuntu.com|https://archive.ubuntu.com|g' \
68+ /etc/apt/sources.list.d/ubuntu.sources
69+ sudo sed -i 's|http://security.ubuntu.com|https://security.ubuntu.com|g' \
70+ /etc/apt/sources.list.d/ubuntu.sources
71+
72+ echo "== Installing dotnet =="
73+ retry sudo apt-get update
74+ retry sudo apt-get install --assume-yes dotnet-sdk-10.0
75+
76+ # With Linux 6.17.0, Plasma 5.27.12, and X11 in VirtualBox 7.0, the mouse cursor is offset a few pixels down and to
77+ # the right. Possibly the same bug as https://bugs.kde.org/show_bug.cgi?id=427060 (though the workarounds
78+ # environment variables did not seem to solve it). Changing the session to use Wayland fixes the problem. Moving the
79+ # kernel back from HWE to GA fixes the problem. Upgrading to Ubuntu 25.10 fixes the problem.
3580
36- sudo apt-get update
37- sudo apt-get install --assume-yes dotnet-sdk-10.0
81+ # Move the kernel back from HWE to GA to fix mouse cursor offset problem.
82+ # (https://wiki.ubuntu.com/Kernel/LTSEnablementStack)
83+ echo "== Downgrading kernel to GA =="
84+ retry sudo apt-get --assume-yes install --install-recommends linux-generic
85+ # Must reboot after removing modules.
86+ sudo DEBIAN_FRONTEND=noninteractive apt-get --assume-yes purge linux-generic-hwe-\* linux-hwe-\* linux-modules\* -6.17.\*
3887
3988 # Remove canary
4089 rm -f ~/Desktop/WARNING-NOT-PROVISIONED.txt
0 commit comments