depot/script/zipdepot

73 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2024-05-29 07:55:55 +02:00
#!/bin/bash
# Joomla installation at:
JOOMLADIR="/srv/http/joomla5"
2024-05-25 22:39:15 +02:00
# this is a script file to generate a zip package from this source:
cd "$(dirname "$0")"
cd ..
# now we are at the depot directory
# if there is a file named depot.xml, we ask to increase the version with
read -p "Do you want to update/increase the patch (last) version number? (y/N)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyJj]$ ]]
then
echo "Updating the version"
2024-05-26 01:34:25 +02:00
# patch=`xmllint -xpath 'string(//*[local-name()="version"])' depot.xml | rev | cut -f1 -d. | rev`
# echo "$patch"
# patch=$((patch+1))
# echo "$patch"
version=`xmllint -xpath 'string(//*[local-name()="version"])' depot.xml`
major=`echo "$version" | cut -f1 -d.`
minor=`echo "$version" | cut -f2 -d.`
patch=`echo "$version" | cut -f3 -d.`
echo "$version"
patch=$((patch+1))
minor=$((minor))
newversion="$major.$minor.$patch"
echo "$newversion"
2024-05-26 01:50:52 +02:00
printf -v date '%(%Y-%m-%d)T\n' -1
2024-05-26 01:34:25 +02:00
xmllint --shell depot.xml << EOF
cd extension/version
set $newversion
2024-05-26 01:50:52 +02:00
cd /extension/creationDate
set $date
save
EOF
else
echo "Keep the version"
fi
2024-05-25 22:39:15 +02:00
mkdir -p zip
2024-05-29 07:55:55 +02:00
# Generate ZIP file without directories zip, script
zip -q -r zip/depot.zip * -x .git/\* -x script/\* -x zip/\*
2024-05-29 07:55:55 +02:00
# Install this extension to the active Joomla installation per CLI
read -p "Do you want to install this to the Joomla installation at \"$JOOMLADIR\"? (Y/n)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Nn]$ ]]
then
echo "Extension was not installed"
else
# Find the CLI php procedure, file joomla.php in cli must exists.
FILE="${JOOMLADIR}/cli/joomla.php"
if [ -f "$FILE" ]
then
echo "$FILE exists."
php $FILE --version
php $FILE --help
php $FILE list
# sudo -g http php $FILE core:update:check
php $FILE core:update:check
pwd
# sudo -u http php $FILE extension:install --path zip/depot.zip -v
php $FILE extension:install --path zip/depot.zip -v
php $FILE extension:list --type component
else
echo "$FILE does not exists."
exit 9
fi
fi