- bin/coreapp-vm replaces scripts/create-coreserver-vm.sh: create (downloads and checks the CoreServer image when it's missing, resumes an interrupted download), list, ip, ssh (own known_hosts), start, stop, delete (asks for the name). update.sh symlinks it into ~/.local/bin. - uninstall.sh removes coreapp-vm, the coreapp network, its hook and ufw rules; asks before deleting VMs, the image and keys. - install.sh runs CoreDesktop's update first when the system wasn't upgraded in the last day, as `sibling add` does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.7 KiB
Bash
49 lines
1.7 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Purpose : Install coreapp-dev, the Federated Core app SDK (run by
|
|
# CoreDesktop's `sibling add`). Safe to re-run.
|
|
|
|
set -e
|
|
|
|
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
COREDESKTOP="$HOME/.local/share/coredesktop"
|
|
|
|
if [ ! -f "$COREDESKTOP/utils.sh" ]; then
|
|
echo "coreapp-dev needs CoreDesktop, which isn't installed at $COREDESKTOP."
|
|
exit 1
|
|
fi
|
|
|
|
# Packages are installed from pacman's package lists. If the system hasn't
|
|
# been upgraded for a day, they may name versions the mirrors have deleted
|
|
# (404s). `sibling add` checks this itself; this is for running install.sh by
|
|
# hand. Only CoreDesktop's update may upgrade the system.
|
|
if [ -z "${COREDESKTOP_ALLOW_PACMAN:-}" ]; then
|
|
last="$(grep -F '[PACMAN] starting full system upgrade' /var/log/pacman.log 2> /dev/null | tail -n 1)"
|
|
last="${last#\[}"
|
|
last="${last%%]*}"
|
|
if [ -z "$last" ] || ! last="$(date -d "$last" +%s 2> /dev/null)" \
|
|
|| (( ($(date +%s) - last) / 3600 >= 24 )); then
|
|
echo "This system hasn't been upgraded today. Running update first, so"
|
|
echo "coreapp-dev installs current packages..."
|
|
"$HOME/.local/bin/update" || echo "update reported errors (above); installing anyway."
|
|
fi
|
|
fi
|
|
|
|
if [ ! -e /dev/kvm ]; then
|
|
echo "/dev/kvm is missing: turn on virtualization (VT-x/AMD-V) in the firmware"
|
|
echo "settings, then run this again."
|
|
exit 1
|
|
fi
|
|
|
|
# Per-machine data (CoreServer images, VM state) lives outside the repo
|
|
mkdir -p "$HOME/.local/share/coreapp-dev/images"
|
|
|
|
bash "$SELF/update.sh"
|
|
|
|
echo
|
|
echo "coreapp-dev installed."
|
|
# This shell's groups are fixed at login, so a new membership isn't seen yet
|
|
if ! id -nG | tr ' ' '\n' | grep -qx libvirt; then
|
|
echo "Log out and back in so your new libvirt group membership takes effect."
|
|
fi
|