#!/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