aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmxfile4
-rwxr-xr-xscripts/provision24
-rwxr-xr-xscripts/provision-host43
3 files changed, 47 insertions, 24 deletions
diff --git a/kvmxfile b/kvmxfile
index f0231a5..ed7dbb7 100644
--- a/kvmxfile
+++ b/kvmxfile
@@ -15,7 +15,9 @@ shared_folder_mountpoint="/srv/shared"
# Absolute path for a provision script located inside the guest.
# Needs ssh_support set to "y" and a workable SSH connection to the guest.
-provision_command="/usr/local/share/kvmx/provision/debian/development && /srv/shared/scripts/provision"
+provision_command="/usr/local/share/kvmx/provision/debian/development"
+provision_command="$provision_command && /srv/shared/scripts/provision"
+provision_command="$provision_command && /srv/shared/scripts/provision-host"
# Startup command
#startup_command="/path/to/custom/command"
diff --git a/scripts/provision b/scripts/provision
index b4fe532..d966c9d 100755
--- a/scripts/provision
+++ b/scripts/provision
@@ -7,7 +7,7 @@
DIRNAME="`dirname $0`"
# Basic dependencies
-DEPENDENCIES="mkdocs apache2 python3-pip pandoc pandoc-citeproc"
+DEPENDENCIES="mkdocs python3-pip pandoc"
# PyPI dependencies
DEPENDENCIES_PIP="mkdocs-bibtex mkdocs-material mkdocs-awesome-pages-plugin mkdocs-static-i18n mkdocs-macros-plugin"
@@ -25,25 +25,3 @@ $SUDO apt install -y $DEPENDENCIES
# Install python dependencies
pip3 install $DEPENDENCIES_PIP
-
-# Configure virtual host for the local service
-cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null
-<VirtualHost *:80>
- ServerName estudo.local
- DocumentRoot "/srv/shared/site"
-
- <Directory /srv/shared/site>
- Options Indexes FollowSymLinks
- AllowOverride All
- Require all granted
- </Directory>
-</VirtualHost>
-EOF
-
-# Enable virtual host
-$SUDO a2ensite local
-$SUDO systemctl reload apache2
-
-# Configure PATH
-mkdir -p ~/.custom
-echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile
diff --git a/scripts/provision-host b/scripts/provision-host
new file mode 100755
index 0000000..2d0fab5
--- /dev/null
+++ b/scripts/provision-host
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Provisioner for the hosting environment
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+
+# Basic dependencies
+DEPENDENCIES="apache2"
+
+# Check for sudo
+if [ "`whoami`" != "root" ]; then
+ SUDO="sudo"
+fi
+
+# Ensure an up-to-date system
+$SUDO apt-get update && $SUDO apt-get dist-upgrade -y && $SUDO apt-get autoremove -y && $SUDO apt-get clean
+
+# Install dependencies
+$SUDO apt install -y $DEPENDENCIES
+
+# Configure virtual host for the local service
+cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null
+<VirtualHost *:80>
+ ServerName estudo.local
+ DocumentRoot "/srv/shared/site"
+
+ <Directory /srv/shared/site>
+ Options Indexes FollowSymLinks
+ AllowOverride All
+ Require all granted
+ </Directory>
+</VirtualHost>
+EOF
+
+# Enable virtual host
+$SUDO a2ensite local
+$SUDO systemctl reload apache2
+
+# Configure PATH
+#mkdir -p ~/.custom
+#echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile