aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-12-11 10:50:31 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-12-11 10:50:31 -0300
commitaa7e9396a8dfc8931573713acca57200f1f880fa (patch)
tree18eb641680ce8f871885f6a1428a532df6388f55 /scripts
parent77368cffe30f0c879ac90be85d6edd76574b9598 (diff)
downloadtemplates-aa7e9396a8dfc8931573713acca57200f1f880fa.tar.gz
templates-aa7e9396a8dfc8931573713acca57200f1f880fa.tar.bz2
Feat: setup mkdocs-material
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/provision66
-rwxr-xr-xscripts/watch19
2 files changed, 85 insertions, 0 deletions
diff --git a/scripts/provision b/scripts/provision
new file mode 100755
index 0000000..cf7b5d7
--- /dev/null
+++ b/scripts/provision
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# Provisioner
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+
+# Basic dependencies
+DEPENDENCIES="mkdocs apache2 python3-pip pandoc pandoc-citeproc"
+
+# Dependenicies for genesis-get
+DEPENDENCIES="$DEPENDENCIES tor python3-requests python3-bs4 python3-socks python3-pybtex python3-tqdm"
+
+# PyPI dependencies
+DEPENDENCIES_PIP="mkdocs-bibtex mkdocs-material"
+
+# 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
+
+# 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/site"
+
+ <Directory /srv/shared/site>
+ 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 protocolos.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 onion local
+sudo systemctl reload apache2
+
+# Configure PATH
+mkdir -p ~/.custom
+echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile
diff --git a/scripts/watch b/scripts/watch
new file mode 100755
index 0000000..cb7f290
--- /dev/null
+++ b/scripts/watch
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Inotify builder
+#
+
+# Parameters
+BASENAME="`basename $0`"
+DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)"
+BASEDIR="$DIRNAME/.."
+WATCHED="branches"
+
+# Got to the base folder
+cd $BASEDIR
+
+# Dispatch
+while inotifywait -r $WATCHED; do
+ #mkdocs build
+ kvmx ssh make -C /srv/shared compile
+done