-
Notifications
You must be signed in to change notification settings - Fork 3
/
egmde-demo
executable file
·50 lines (45 loc) · 1.47 KB
/
egmde-demo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -euo pipefail
vm_name="${1:-$(basename "$0")}"
until command -v multipass > /dev/null
do
echo "Multipass is not installed, do you wish to install it?"
select install in "Yes" "No"; do
case $install in
Yes ) sudo snap install multipass; break;;
No ) break;;
esac
done
done
if ! multipass start "${vm_name}"
then
set -x
multipass launch -v -n "${vm_name}" --cloud-init - hirsute <<EOF
apt:
preserve_sources_list: true
sources:
mir-team:
source: 'ppa:mir-team/release'
ssh_authorized_keys:
- $(cat ~/.ssh/id_rsa.pub)
packages:
- xwayland
- fonts-freefont-ttf
- xfce4-terminal
- xfce4-goodies
- epiphany-browser
runcmd:
- sudo snap install --classic --edge egmde
EOF
multipass exec "${vm_name}" -- sh -c "mkdir --parents ~/.config"
multipass exec "${vm_name}" -- sh -c "echo enable-key-repeat=false >> .config/egmde.config"
multipass exec "${vm_name}" -- sh -c "echo enable-autostart= >> .config/egmde.config"
keymap_index=$(gsettings get org.gnome.desktop.input-sources current | cut -d\ -f 2)
keymap=$(gsettings get org.gnome.desktop.input-sources sources | grep -Po "'[[:alpha:]]+'\)" | sed -ne "s/['|)]//g;$((keymap_index+1))p")
if [ -n "${keymap}" ]; then
multipass exec "${vm_name}" -- sh -c "echo keymap=${keymap} >> .config/egmde.config"
fi
set +x
fi
host_ip=$(multipass info "${vm_name}" --format csv | awk -F, '/^'"${vm_name}"'/ { print $3 }')
ssh -X "ubuntu@${host_ip}" sh -lc egmde