mirror of
https://github.com/darksaid98/yolks.git
synced 2026-12-03 22:21:39 +00:00
fix(graalvm): broken variable usage
This commit is contained in:
1 file changed
+69
-65
+69
-65
@@ -160,89 +160,93 @@ perform_git_clone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Auto update server from git.
|
# Auto update server from git.
|
||||||
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
|
perform_git_logic() {
|
||||||
echo "Git auto-update is enabled"
|
if [ "${GIT_ENABLED}" == "true" ] || [ "${GIT_ENABLED}" == "1" ]; then
|
||||||
echo ""
|
echo "Git auto-update is enabled"
|
||||||
|
|
||||||
# Validate variables
|
|
||||||
if [ -z "${GIT_REPOURL}" ]; then
|
|
||||||
echo "❌ Error: GIT_REPOURL is not specified"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then
|
|
||||||
echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified"
|
|
||||||
echo " Both are required for private repository access"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local normalized_repo_url=$(normalize_repo_url "$GIT_REPOURL")
|
|
||||||
local auth_repo_url=$(construct_auth_url "$normalized_repo_url" "$GIT_USERNAME" "$GIT_TOKEN")
|
|
||||||
local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}"
|
|
||||||
local repo_info=$(get_repo_info "$GIT_REPOURL")
|
|
||||||
|
|
||||||
echo "Git Configuration:"
|
|
||||||
echo " Repository: $repo_info"
|
|
||||||
echo " Branch: $branch"
|
|
||||||
echo " Target directory: $CONTAINER_DIR"
|
|
||||||
|
|
||||||
# Check if directory has content
|
|
||||||
if [ "$(ls -A .)" ]; then
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Container directory is not empty, checking for existing repository..."
|
|
||||||
|
|
||||||
if is_git_repo; then
|
# Validate variables
|
||||||
echo "Found existing git repository"
|
if [ -z "${GIT_REPOURL}" ]; then
|
||||||
|
echo "❌ Error: GIT_REPOURL is not specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Get current remote URL
|
if [ -z "${GIT_USERNAME}" ] || [ -z "${GIT_TOKEN}" ]; then
|
||||||
local 'current_remote'=$(git config --get remote.origin.url 2>/dev/null || echo "")
|
echo "❌ Error: GIT_USERNAME or GIT_TOKEN is not specified"
|
||||||
|
echo " Both are required for private repository access"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$current_remote" ]; then
|
local normalized_repo_url=$(normalize_repo_url "$GIT_REPOURL")
|
||||||
echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')"
|
local auth_repo_url=$(construct_auth_url "$normalized_repo_url" "$GIT_USERNAME" "$GIT_TOKEN")
|
||||||
|
local branch="${GIT_BRANCH:-$DEFAULT_BRANCH}"
|
||||||
|
local repo_info=$(get_repo_info "$GIT_REPOURL")
|
||||||
|
|
||||||
# Check if URLs match (ignoring credentials)
|
echo "Git Configuration:"
|
||||||
if urls_match "$current_remote" "$normalized_repo_url"; then
|
echo " Repository: $repo_info"
|
||||||
echo "Repository URLs match"
|
echo " Branch: $branch"
|
||||||
|
echo " Target directory: $CONTAINER_DIR"
|
||||||
|
|
||||||
# Update remote URL with new credentials (handles PAT changes)
|
# Check if directory has content
|
||||||
update_remote_url "$auth_repo_url"
|
if [ "$(ls -A .)" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Container directory is not empty, checking for existing repository..."
|
||||||
|
|
||||||
# Perform update
|
if is_git_repo; then
|
||||||
perform_git_update "$branch" "$repo_info"
|
echo "Found existing git repository"
|
||||||
|
|
||||||
|
# Get current remote URL
|
||||||
|
local current_remote=$(git config --get remote.origin.url 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
if [ -n "$current_remote" ]; then
|
||||||
|
echo "Current remote: $(normalize_repo_url "$current_remote" | sed 's|https://github.com/||' | sed 's|\.git$||')"
|
||||||
|
|
||||||
|
# Check if URLs match (ignoring credentials)
|
||||||
|
if urls_match "$current_remote" "$normalized_repo_url"; then
|
||||||
|
echo "Repository URLs match"
|
||||||
|
|
||||||
|
# Update remote URL with new credentials (handles PAT changes)
|
||||||
|
update_remote_url "$auth_repo_url"
|
||||||
|
|
||||||
|
# Perform update
|
||||||
|
perform_git_update "$branch" "$repo_info"
|
||||||
|
else
|
||||||
|
echo "❌ Repository mismatch!"
|
||||||
|
echo " Expected: $repo_info"
|
||||||
|
echo " Found: $(get_repo_info "$current_remote")"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "❌ Repository mismatch!"
|
echo "Could not determine current remote URL"
|
||||||
echo " Expected: $repo_info"
|
|
||||||
echo " Found: $(get_repo_info "$current_remote")"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Could not determine current remote URL"
|
echo "Directory contains files but is not a git repository"
|
||||||
exit 1
|
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Directory contains files but is not a git repository"
|
echo ""
|
||||||
|
echo "Container directory is empty, performing initial clone..."
|
||||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Container directory is empty, performing initial clone..."
|
echo "✅ Git auto-update completed successfully!"
|
||||||
perform_git_clone "$auth_repo_url" "$branch" "$repo_info"
|
echo "Working directory: $(pwd)"
|
||||||
|
|
||||||
|
# Final verification
|
||||||
|
if is_git_repo; then
|
||||||
|
local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current branch: $final_branch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Post git stuff
|
||||||
|
cd /home/container
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
echo ""
|
perform_git_logic
|
||||||
echo "✅ Git auto-update completed successfully!"
|
|
||||||
echo "Working directory: $(pwd)"
|
|
||||||
|
|
||||||
# Final verification
|
|
||||||
if is_git_repo; then
|
|
||||||
local final_branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
||||||
echo "Current branch: $final_branch"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Post git stuff
|
|
||||||
cd /home/container
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Print Java version
|
# Print Java version
|
||||||
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n"
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n"
|
||||||
|
|||||||
Reference in new issue
Block a user