Created
December 12, 2022 20:17
-
-
Save Sebastian-Roth/48bee2a74c7ea9d65035f2b778a639be to your computer and use it in GitHub Desktop.
This file contains 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
# Updates the version numbers. | |
# Arguments: | |
# $1 The second is branch or typed as full. | |
versionUpdate() { | |
local testvar=$1 | |
[[ ! -w packages/web/lib/fog/system.class.php ]] && echo "Cannot open system.class.php for writing, exiting." && return 0 | |
[[ $testvar == full ]] && channel="Stable" | |
[[ -z $channel ]] && channel="alpha" | |
channel=$(echo $channel | awk '{print tolower($0)}') | |
echo -n "Updating version file... " | |
local gitcom=$(git rev-list --tags --no-walk --max-count=1) | |
local gitbranch=$(git branch | awk '/[*] / {print $2}') | |
local ver='' | |
case $gitbranch in | |
working-1.6) ver="1.6.0-${channel}" ;; | |
dev-branch) ver=$(git describe --tags $gitcom) ;; | |
esac | |
ver+=".$(git rev-list ${gitcom}..HEAD --count)" | |
[[ -z $trunkver ]] && trunkversion=$ver || trunkversion=$trunkver | |
sed -i "s/define('FOG_VERSION'.*);/define('FOG_VERSION', '$trunkversion');/g" packages/web/lib/fog/system.class.php >/dev/null 2>&1 | |
channel=$(echo $channel | awk '{print toupper(substr($0,1,1))tolower(substr($0,2))}') | |
sed -i "s/define('FOG_CHANNEL'.*);/define('FOG_CHANNEL', '$channel');/g" packages/web/lib/fog/system.class.php >/dev/null 2>&1 | |
[[ $? -ne 0 ]] && echo "Failed" || echo "Done" | |
} | |
alias fogupdateversion='versionUpdate' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment