3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-14 16:09:34 +01:00
pbot/applets/compiler_vm/guest/bin/setup-guest
Pragmatic Software 1326b0ac5f compiler_vm: major refactor to support VM sockets (AF_VSOCK)
VM socket communication is superior to VM serial communication in
every way. Unfortunately at this time only Linux supports them.
Fortunately, that's 99% of PBot's userbase.

If you're not using Linux or if you're using an older Linux that
does not support VM sockets, the PBot VM scripts will gracefully
fallback to using the serial connection. You may explicitly
disable VM socket connection attempts by setting PBOTVM_CID=0.
2022-02-12 16:06:04 -08:00

39 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# File: setup-guest
#
# Purpose: Sets up PBot VM Guest. Copies necessary files to the appropriate
# location, sets up environment variables and various configuration details.
# SPDX-FileCopyrightText: 2022 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
# copy executable scripts
cp guest/bin/* /usr/local/bin
# lib and language support
mkdir -p /usr/local/share/pbot-vm/
cp -r guest/lib/* /usr/local/share/pbot-vm/
# C support and GDB integration
cp guest/include/prelude.h /usr/include
# require root password for polkit actions
cp guest/polkit/* /etc/polkit-1/rules.d/
# disable networking
nmcli networking off
# set environment variables
if ! grep -qF "pbot-vm" /root/.bashrc; then
echo '# pbot-vm' >> /root/.bashrc
echo unset DEBUGINFOD_URLS >> /root/.bashrc
echo export ASAN_OPTIONS=detect_leaks=0 >> /root/.bashrc
fi
echo PBot Guest VM is now set up.
echo
echo !! Networking is now disabled. To re-enable networking run: nmcli networking on
echo
echo For changes to take effect, run this command now: source /root/.bashrc