-
Notifications
You must be signed in to change notification settings - Fork 16
makeservices: add easydoku script #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dkess
wants to merge
2
commits into
master
Choose a base branch
from
easydoku
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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." | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.