refactor: Migrate all installers to use installation strategies

This commit is contained in:
2026-06-26 21:35:34 +05:30
parent 0eaea2c997
commit 36c7be07b3
16 changed files with 53 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ echo "==> Generating registry.sh..."
# Temporary arrays
declare -A tools_desc
declare -A tools_disp
declare -A tools_strat
keys=()
for f in "$INSTALLERS_DIR"/install_*.sh; do
@@ -20,10 +21,12 @@ for f in "$INSTALLERS_DIR"/install_*.sh; do
tool=$(grep -E "^# Tool:" "$f" | head -n1 | sed -E 's/^# Tool:\s*//I')
disp_name=$(grep -E "^# DisplayName:" "$f" | head -n1 | sed -E 's/^# DisplayName:\s*//I')
desc=$(grep -E "^# Description:" "$f" | head -n1 | sed -E 's/^# Description:\s*//I' | sed -E 's/^Install\s+//I')
strat=$(grep -E "^# Strategy:" "$f" | head -n1 | sed -E 's/^# Strategy:\s*//I')
if [ -n "$tool" ]; then
tools_desc["$tool"]="$desc"
tools_disp["$tool"]="${disp_name:-$tool}"
tools_strat["$tool"]="${strat:-unknown}"
keys+=("$tool")
fi
done
@@ -49,6 +52,13 @@ sorted_keys=($(printf '%s\n' "${keys[@]}" | sort))
done
echo ")"
echo ""
echo "declare -A INSTALLER_STRATEGIES=("
for k in "${sorted_keys[@]}"; do
escaped_strat=$(echo "${tools_strat[$k]}" | sed 's/"/\\"/g')
echo " [$k]=\"$escaped_strat\""
done
echo ")"
echo ""
# Format keys output as space-separated list in array declaration format
echo "INSTALLER_KEYS=(${sorted_keys[*]})"
} > "$REGISTRY_FILE"