Propagate the ✓ Success / ✗ Error / ! Notice / ❯ Question glyphs (from markers.sh) through the rest of the pipeline: swap the inlined helpers in init.sh and generate_arrays.sh, and replace raw echo -e "${RED}ERROR:${NC}" calls with the isX helpers in config_check_missing.sh, check_success.sh, initilize_files.sh, and reset_git.sh.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
58 lines
2.3 KiB
Bash
Executable File
58 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
gitReset()
|
|
{
|
|
# Check if this is a local installation
|
|
if [[ "$CFG_INSTALL_MODE" == "local" ]]; then
|
|
isNotice "Local installation detected - Git reset is not applicable."
|
|
echo "To reset a local installation, please manually restore files and rerun the init script."
|
|
else
|
|
gitCheckGitDetails;
|
|
|
|
gitMiscUpdate()
|
|
{
|
|
sudo cp -f $script_dir/init.sh /root/
|
|
sudo chown -R $sudo_user_name:$sudo_user_name "$script_dir"
|
|
}
|
|
|
|
local result=$(sudo -u $sudo_user_name rm -rf $script_dir)
|
|
checkSuccess "Deleting all Git files"
|
|
|
|
cd $docker_dir
|
|
|
|
# Strip http:// or https:// and .git for CLEAN_GIT_URL
|
|
CLEAN_GIT_URL=$(echo "$CFG_GIT_URL" | sed -E 's~^(https?://)?(.+?)\.git?$~\2~')
|
|
|
|
# Use authenticated clone if Git login is required
|
|
if [[ $CFG_INSTALL_MODE == "git" ]]; then
|
|
# Create authenticated URLs
|
|
AUTH_HTTPS_REPO_URL="https://${CFG_GIT_USER}:${CFG_GIT_KEY}@${CLEAN_GIT_URL}.git"
|
|
AUTH_HTTP_REPO_URL="http://${CFG_GIT_USER}:${CFG_GIT_KEY}@${CLEAN_GIT_URL}.git"
|
|
|
|
# Try HTTPS first
|
|
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTPS_REPO_URL" "$script_dir" 2>/dev/null; then
|
|
isSuccessful "Git repository cloned via HTTPS into '$script_dir'."
|
|
else
|
|
# If HTTPS fails, try HTTP
|
|
if sudo -u $sudo_user_name git clone -q "$AUTH_HTTP_REPO_URL" "$script_dir" 2>/dev/null; then
|
|
isSuccessful "Git repository cloned via HTTP into '$script_dir'."
|
|
else
|
|
isError " Failed to clone repository via both HTTPS and HTTP."
|
|
exit 1
|
|
fi
|
|
fi
|
|
elif [[ $CFG_INSTALL_MODE == "local" ]]; then
|
|
if sudo -u $sudo_user_name git clone -q "https://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
|
isSuccessful "Git repository cloned via HTTPS into '$script_dir'."
|
|
else
|
|
# If HTTPS fails, try HTTP
|
|
if sudo -u $sudo_user_name git clone -q "http://${CLEAN_GIT_URL}.git" "$script_dir" 2>/dev/null; then
|
|
isSuccessful "Git repository cloned via HTTP into '$script_dir'."
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
gitMiscUpdate;
|
|
fi
|
|
}
|