Skip to content

Commit

Permalink
Fix check for new installation.
Browse files Browse the repository at this point in the history
Check that files and db directories are empty rather than a check for the existence of WP_ROOT. The latter approach fails as the recommendation is to create the root dataset as well as the child datasets files and db.
  • Loading branch information
basilhendroff committed Jan 23, 2021
1 parent d28b000 commit 07da758
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wordpress-jail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ if [ ${WP_ROOT:0:1} != "/" ]; then
fi
WP_ROOT="${WP_ROOT%/}"

# Check that this is a new installation
if [ -e "${POOL_PATH}${WP_ROOT}" ]
DB_PATH=${POOL_PATH}${WP_ROOT}/db
FILES_PATH=${POOL_PATH}${WP_ROOT}/files

# Check that this is a new installation
if [ "$(ls -A "${FILES_PATH}")" ] || [ "$(ls -A "${DB_PATH}")" ]
then
print_err "This script only works for new installations. The script cannot proceed if WP_ROOT exists."
print_err "This script only works for new installations. The script cannot proceed if ${FILES_PATH} and ${DB_PATH} are not both empty."
exit 1
fi

Expand Down Expand Up @@ -161,9 +164,6 @@ rm /tmp/pkg.json
#####################################################################
print_msg "Directory Creation and Mounting..."

DB_PATH=${POOL_PATH}${WP_ROOT}/db
FILES_PATH=${POOL_PATH}${WP_ROOT}/files

mkdir -p "${DB_PATH}"
chown -R 88:88 "${DB_PATH}"
iocage fstab -a "${JAIL_NAME}" "${DB_PATH}" /var/db/mysql nullfs rw 0 0
Expand Down

0 comments on commit 07da758

Please sign in to comment.