]> gitweb.fluxo.info Git - slides.git/commitdiff
Fix: scripts: split between provision and provision-host
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jul 2024 17:24:16 +0000 (14:24 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jul 2024 17:24:16 +0000 (14:24 -0300)
kvmxfile
scripts/provision
scripts/provision-host [new file with mode: 0755]

index 2ce20db3d102a443bc3dfce027baa38428c58ae1..ea6ab0298facbbd353b5693aacdf3b8c42e72899 100644 (file)
--- a/kvmxfile
+++ b/kvmxfile
@@ -12,7 +12,9 @@ shared_folders="shared:.:/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="hydractl aperiodic-upgrade"
index a211e404ed01c742e28c27dfbff20a2deff4bfae..2798ea4d2dc0b100c4fa7f23bd3bb319fcb802f0 100755 (executable)
@@ -7,10 +7,7 @@
 DIRNAME="`dirname $0`"
 
 # Basic dependencies
-DEPENDENCIES="make pandoc tor"
-
-# Dependenicies for genesis-get
-#DEPENDENCIES="$DEPENDENCIES tor python3-requests python3-bs4 python3-socks python3-pybtex python3-tqdm"
+DEPENDENCIES="make pandoc"
 
 # PyPI dependencies
 #DEPENDENCIES_PIP=""
@@ -23,44 +20,3 @@ sudo apt install -y $DEPENDENCIES
 
 # Install python dependencies
 #pip3 install $DEPENDENCIES_PIP
-
-# Configure an onion service
-trashman install tor-onion-service
-
-# Configure virtual host for the Onion Service
-cat <<-EOF | sudo tee /etc/apache2/sites-available/onion.conf > /dev/null
-<VirtualHost *:80>
-    ServerName localhost
-    ServerAlias *.onion
-    DocumentRoot "/srv/shared/"
-
-    <Directory /srv/shared/>
-      AuthType Basic
-      AuthName "Protected"
-      AuthUserFile /srv/shared/.htpasswd
-      Require valid-user
-    </Directory>
-</VirtualHost>
-EOF
-
-# Configure virtual host for the local service
-cat <<-EOF | sudo tee /etc/apache2/sites-available/local.conf > /dev/null
-<VirtualHost *:80>
-    ServerName slides.local
-    DocumentRoot "/srv/shared/"
-
-    <Directory /srv/shared/>
-      Options Indexes FollowSymLinks
-      AllowOverride All
-      Require all granted
-    </Directory>
-</VirtualHost>
-EOF
-
-# Enable virtual host
-sudo a2ensite onion 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 (executable)
index 0000000..12cbe52
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# Provisioner for the hosting environment
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+
+# Check for sudo
+if [ "`whoami`" != "root" ]; then
+  SUDO="sudo"
+fi
+
+# Install Apache
+$SUDO apt install -y apache2
+
+# Tor
+trashman install tor
+
+# Configure an onion service
+trashman install tor-onion-service
+
+# Install python dependencies
+#pip3 install $DEPENDENCIES_PIP
+
+# Configure virtual host for the Onion Service
+cat <<-EOF | $SUDO tee /etc/apache2/sites-available/onion.conf > /dev/null
+<VirtualHost *:80>
+    ServerName slides.onion
+    ServerAlias slides.*.onion
+    DocumentRoot "/srv/shared/"
+
+    <Directory /srv/shared/>
+      AuthType Basic
+      AuthName "Protected"
+      AuthUserFile /srv/shared/.htpasswd
+      Require valid-user
+    </Directory>
+</VirtualHost>
+EOF
+
+# Configure virtual host for the local service
+cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null
+<VirtualHost *:80>
+    ServerName slides.local
+    DocumentRoot "/srv/shared/"
+
+    <Directory /srv/shared/>
+      Options Indexes FollowSymLinks
+      AllowOverride All
+      Require all granted
+    </Directory>
+</VirtualHost>
+EOF
+
+# Enable virtual host
+$SUDO a2ensite onion local
+$SUDO systemctl reload apache2
+
+# Configure PATH
+#mkdir -p ~/.custom
+#echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile