Saltar para o conteúdo

u-he

BazilleCM Podolski Protoverb TripleCheese TyrellN6 ZebraCM Zebralette3

#!/bin/bash
set -e
source <(curl -sSL https://estudio-debian.pages.dev/functions.lib)
script() {
	DOWNLOAD_DIR="$PWD/downloads"
	mkdir -p "$DOWNLOAD_DIR"
	PAGE="https://uhe-dl.b-cdn.net/releases"
	BASE="https://uhe-dl.b-cdn.net"
	PREFIXES=("BazilleCM" "Podolski" "Protoverb" "TripleCheese" "TyrellN6" "ZebraCM" "Zebralette3")
	curl -sSL "$PAGE" |
		grep -oP 'href="\K[^"]+' |
		grep -i 'Linux' |
		awk '!seen[$0]++' |
		while IFS= read -r url; do
			keep=0
			for prefix in "${PREFIXES[@]}"; do
				if [[ "$(basename "$url")" == "$prefix"* ]]; then
					keep=1
					break
				fi
			done
			[[ $keep -eq 0 ]] && continue
			case "$url" in
				http*) full="$url" ;;
				/*) full="$BASE$url" ;;
				*) full="$PAGE/$url" ;;
			esac
			wget -q --content-disposition --show-progress -P "$DOWNLOAD_DIR" "$full"
		done
	find "$DOWNLOAD_DIR" -type f -name '*.tar.xz' | while IFS= read -r tarfile; do
		DIR="${tarfile%.tar.xz}"
		mkdir -p "$DIR"
		tar -xf "$tarfile" -C "$DIR"
		find "$DIR" -type f -name '*.tar.xz' | while IFS= read -r inner_tar; do
			INNER_DIR="${inner_tar%.tar.xz}"
			mkdir -p "$INNER_DIR"
			tar -xf "$inner_tar" -C "$INNER_DIR"
		done
		find "$DIR" -type f -name 'install.sh' | while IFS= read -r script; do
			chmod +x "$script"
			(cd "$(dirname "$script")" && ./install.sh --quiet)
		done
	done
	rm -r ./*
}
tmprun script