Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Created May 5, 2021 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojenzaman/fdf1de8c7d63d7ac5d086a3c973bf7ef to your computer and use it in GitHub Desktop.
Save rojenzaman/fdf1de8c7d63d7ac5d086a3c973bf7ef to your computer and use it in GitHub Desktop.
#!/bin/bash
#https://github.com/docker-library/wordpress/blob/8215003254de4bf0a8ddd717c3c393e778b872ce/docker-entrypoint.sh#L48
PREFIX="$2"
[[ -z "$PREFIX" ]] && PREFIX="./public_html"
is_empty() {
test -e "$1/"* 2>/dev/null
case $? in
1) return 0 ;;
*) return 1 ;;
esac
}
true() {
mkdir -p $PREFIX/wp-includes
touch $PREFIX/index.php
touch $PREFIX/wp-includes/version.php
}
false() {
rm $PREFIX/index.php
rm $PREFIX/wp-includes/version.php
is_empty $PREFIX/wp-includes && rm -r $PREFIX/wp-includes
}
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment