#!/bin/bash # # Download and install .deb packages to migasfree client side # # Usage: # wget -O - https://migasfree.org/pub/install-client-v5-fwm | bash set -euo pipefail if [ "$(id -u)" -ne 0 ]; then echo "This script must be run as root." >&2 exit 1 fi BASE_URL="https://migasfree.org/pub/project-templates/fwm/stores/thirds" TMP_DIR="$(mktemp -d)" cleanup() { rm -rf "$TMP_DIR" } trap cleanup EXIT echo "Fetching package list from ${BASE_URL} ..." # Extract .deb filenames from the directory listing DEB_FILES=$(wget -qO- "${BASE_URL}/" | grep -oE 'href="[^"]+\.deb"' | sed -E 's/href="([^"]+)"/\1/' | sort -u) if [ -z "$DEB_FILES" ]; then echo "No .deb files found at ${BASE_URL}" >&2 exit 1 fi echo "Found packages:" echo "$DEB_FILES" echo for deb in $DEB_FILES; do echo "Downloading ${deb} ..." wget -q -P "$TMP_DIR" "${BASE_URL}/${deb}" done echo "Installing packages ..." # Install all at once so apt can resolve inter-package dependencies apt-get update -qq apt-get install -y "${TMP_DIR}"/*.deb echo "Done. Installed packages:" for deb in $DEB_FILES; do pkg_name=$(dpkg-deb -f "${TMP_DIR}/${deb}" Package 2>/dev/null || echo "${deb}") echo " - ${pkg_name}" done