From de52288f2ae6bf5e3bf4d8e648b1b4c99d4acf2a Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Thu, 6 Jun 2019 12:59:01 -0700 Subject: [PATCH 1/2] makeservices: add easydoku script Structured similarly to the easywp script, this installs DokuWiki. It includes a prompt for subfolder, since some groups might want this at a separate URL. Co-authored-by: Kevin Peng --- makeservices/easydoku | 68 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 makeservices/easydoku diff --git a/makeservices/easydoku b/makeservices/easydoku new file mode 100755 index 0000000..be9f61b --- /dev/null +++ b/makeservices/easydoku @@ -0,0 +1,68 @@ +#!/bin/bash + +# Creates symlink to user's webroot. If the symlink exists and files +# are present in webroot, they are backed up in the user's home directory. +# DokuWiki and the upgrade plugin are installed in the chosen directory. +# + +set -euo pipefail +shopt -s dotglob + +if ! [[ "$(hostname)" =~ (dev-)?tsunami ]]; then + echo -e '\033[1;31mYou must run this command on tsunami.\033[0m' + exit 1 +fi + +user=$(whoami) + +echo "What subfolder would you like to install DokuWiki in?" +echo "Example: type nothing for root (https://www.ocf.berkeley.edu/~$(whoami))" +echo "Example: type \"wiki\" for wiki subfolder (https://www.ocf.berkeley.edu/~$(whoami)/wiki)" + +read -r subfolder + +read -rp "Are you sure you want to continue? [y/N] " idunno +idunno=${idunno,,} +if ! [[ "$idunno" =~ ^(yes|y) ]]; then + echo "Ok, bye!" + exit 0 +fi + +webroot="$HOME/public_html/$subfolder" + +# Create symlink to webroot +makehttp + +mkdir -p "$webroot" +cd "$webroot" + +# Check if user has files and let user decide what they want to do. +if [[ -n "$(ls -A)" ]]; then + echo + echo -e "\033[33mThere are currently files in webroot! These will be backed up.\033[00m\n" + read -rp "Do you want to continue? [y/N] " whoknows + + whoknows=${whoknows,,} + if [[ "$whoknows" =~ ^(yes|y) ]]; then + ts=$(date +"%Y-%m-%d_%H:%M:%S") + backup="$HOME/public_html-doku-$ts" + mkdir -p "$backup" + echo "Moving current files to $backup ..." + # Note that dotglob is set so hidden files are moved too + mv ./* "$backup" + else + echo "Ok, bye!" + exit 0 + fi +fi + +echo "Downloading and installing DokuWiki" +curl -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" \ + | tar -xz --strip-components=1 + +echo "Downloading and installing the Upgrade plugin" +mkdir lib/plugins/upgrade +curl -L "https://github.com/splitbrain/dokuwiki-plugin-upgrade/tarball/master" \ + | tar -xz -C lib/plugins/upgrade --strip-components=1 + +echo "DokuWiki install successful. Go to https://www.ocf.berkeley.edu/~$user/$subfolder to finish the setup process." From bd707f2a5af2c5af6402a3430acf4a20a5ff1e3b Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Mon, 24 Jun 2019 14:11:06 -0700 Subject: [PATCH 2/2] Update makeservices/easydoku Co-Authored-By: Christopher Cooper --- makeservices/easydoku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makeservices/easydoku b/makeservices/easydoku index be9f61b..9eea32e 100755 --- a/makeservices/easydoku +++ b/makeservices/easydoku @@ -65,4 +65,4 @@ mkdir lib/plugins/upgrade curl -L "https://github.com/splitbrain/dokuwiki-plugin-upgrade/tarball/master" \ | tar -xz -C lib/plugins/upgrade --strip-components=1 -echo "DokuWiki install successful. Go to https://www.ocf.berkeley.edu/~$user/$subfolder to finish the setup process." +echo "DokuWiki install successful. Go to https://www.ocf.berkeley.edu/~$user/$subfolder/install.php to finish the setup process."