3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-05 19:49:32 +01:00

pbot-vm: setup-guest auto-detects OS/distro and runs provisioning scripts

This commit is contained in:
Pragmatic Software 2024-03-30 19:41:50 -07:00
parent 91f8547aed
commit 0829265ef8
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
6 changed files with 45 additions and 6 deletions

View File

@ -8,6 +8,41 @@
# SPDX-FileCopyrightText: 2022 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
# determine OS/distribution
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
echo "Detected OS: $OS ($VER)"
# run known provisioning scripts
case $OS in
'openSUSE Tumbleweed')
echo "Provisioning for openSUSE Tumbleweed"
./guest/provision/tumbleweed
;;
*)
echo "!! No automatic provisioning script for $OS ($VER). Install packages manually. !!"
echo
;;
esac
# copy executable scripts
cp guest/bin/* /usr/local/bin

View File

@ -1 +0,0 @@
Orchestration scripts to install packages and set-up environments

View File

@ -0,0 +1 @@
Provisioning scripts to install packages and set-up environments

View File

@ -2,8 +2,8 @@
# File: tumbleweed
#
# Purpose: Orchestration script to install packages and set-up environment
# on OpenSUSE Tumbleweed for pbot-vim.
# Purpose: Provisioning script to install packages and set-up environment
# on OpenSUSE Tumbleweed for pbot-vm.
# SPDX-FileCopyrightText: 2024 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT

View File

@ -434,8 +434,12 @@ Once that's done, run the following command:
guest$ ./guest/bin/setup-guest
This will install `guest-server` to `/usr/local/bin/`, set up some environment variables and
harden the guest system. After running the `setup-guest` script, we need to make the environment
changes take effect:
harden the guest system. Additionally, it'll autodetect your chosen OS/distribution and attempt
to run any provisioning scripts from the `./guest/provision` directory. If no provisioning
scripts are available, it will warn you to manually install the packages for the `cc` languages
you want to use. You may use `./guest/provision/tumbleweed` as a reference.
After running the `setup-guest` script, we need to make the environment changes take effect:
guest$ source /root/.bashrc

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4727,
BUILD_REVISION => 4728,
BUILD_DATE => "2024-03-30",
};