updated documenation, fixed install script

This commit is contained in:
2023-06-07 14:16:31 -07:00
parent 815a551a07
commit 05f289eae0
12 changed files with 146 additions and 174 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/bash
###################################################################################################
#
# INSTRUCTIONS
# Move to the directory of the component
# Run this script with component name (com_name)

View File

@@ -6,22 +6,82 @@ if [ "$EUID" -ne 0 ]; then
exit 1
fi
##################################################################
# ENV file
##################################################################
# Verify the .env file exists
if [ ! -f ".env" ]; then
echo "Error: The .env file does not exist."
exit 1
fi
# Load environment variables from .env file
set -o allexport
source .env
set +o allexport
##################################################################
# Variables
##################################################################
PROJECTNAME=$(basename "$(pwd)")
# Remove crap files
# Joomla Configuration Defaults
if [ -z "$JCONFIG_REPORTING" ]; then
JCONFIG_REPORTING='none'
fi
if [ -z "$JCONFIG_TIMEZONE" ]; then
JCONFIG_TIMEZONE='America/Vancouver'
fi
if [ -z "$JCONFIG_SEF" ]; then
JCONFIG_SEF=true
fi
# SMTP ENV CHECK
if [ -z "$SMTP_MAILER" ]; then
SMTP_MAILER='/usr/sbin/sendmail'
fi
if [ -z "$SMTP_USER" ]; then
SMTP_USER=null
fi
if [ -z "$SMTP_PASS" ]; then
SMTP_PASS=null
fi
if [ -n "$SMTP_PASS" ]; then
SMTP_AUTH=true
else
SMTP_AUTH=false
fi
if [ -z "$SMTP_HOST" ]; then
SMTP_HOST='mailhog'
fi
if [ -z "$SMTP_SECURITY" ]; then
SMTP_SECURITY='None'
fi
if [ -z "$SMTP_PORT" ]; then
SMTP_PORT=1025
fi
# Set configuration.php
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting="${JCONFIG_REPORTING}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset="${JCONFIG_TIMEZONE}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite="${JCONFIG_SEF}"
#SMTP
docker-compose exec -u www-data joomla php cli/joomla.php config:set sendmail="${SMTP_MAILER}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpuser="${SMTP_USER}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtppass="${SMTP_PASS}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpauth="${SMTP_AUTH}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtphost="${SMTP_HOST}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpsecure="${SMTP_SECURITY}"
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpport="${SMTP_PORT}"
# Remove uneeded Joomla files
rm -f html/web.config.txt
rm -f html/htaccess.txt
rm -f html/LICENSE.txt
rm -f html/README.txt
# Set configuration.php
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting=none
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset=America/Vancouver
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite=true
# remove unused files from install
# Remove Install helper scripts
rm -rf bin/inc_new_project
rm -rf bin/new_project.sh
rm -rf bin/setup_joomla_installer.sh
echo "Now check the results and commit them to Git"
echo "Now check the results and commit them to Git"

38
bin/gitea_secrets.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# Load environment variables from .env file
if [ -f ".env" ]; then
set -o allexport
source .env
set +o allexport
else
echo "Error: The .env file does not exist."
exit 1
fi
USERNAME=""
PASSWORD=""
read -p "Enter your Gitea username: " USERNAME
read -s -p "Enter your Gitea password: " PASSWORD
echo
secrets_response=$(curl -s -u "$USERNAME:$PASSWORD" "$GITEA_API/repos/$REPO_OWNER/$REPO_NAME/actions/secrets")
status_code=$(tail -c 3 <<< "$secrets_response")
if [[ $status_code -eq 401 ]]; then
echo "Authentication failed. Please check your username and password."
exit 1
fi
# Get the secret keys
secret_keys=$(echo "$secrets_response" | jq -r '.[].name')
# Loop through secret keys
for secret_key in $secret_keys; do
secret_response=$(curl -s -u "$USERNAME:$PASSWORD" "$GITEA_API/repos/$REPO_OWNER/$REPO_NAME/actions/secrets/$secret_key")
secret_value=$(echo "$secret_response" | jq -r '.secret')
# Update .env file
sed -i "s/$secret_key=.*/$secret_key=$secret_value/" .env
done

View File

@@ -33,7 +33,7 @@ DB_PREFIX=$(LC_CTYPE=C tr -dc '[:alpha:]' < /dev/urandom | head -c 3)_
docker-compose exec -u www-data joomla php installation/joomla.php install \
--site-name=$PROJECTNAME \
--admin-email=$EMAIL \
--admin-user=$JOOMLA_USER \
--admin-user="$JOOMLA_USER" \
--admin-username=$JOOMLA_USERNAME \
--admin-password=$JOOMLA_PASSWORD \
--db-type=mysqli \