diff --git a/dry-run-build.sh b/dry-run-build.sh new file mode 100644 index 0000000..4c3fb8e --- /dev/null +++ b/dry-run-build.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +# Dry-run orchestrator for Hyprland and companion modules +# - Compiles components but skips installation (uses DRY_RUN=1) +# - Summarizes PASS/FAIL per module to Install-Logs/ +# +# Usage: +# chmod +x ./dry-run-build.sh +# ./dry-run-build.sh # run full stack dry-run +# ./dry-run-build.sh --with-deps # install dependencies first, then dry-run build +# ./dry-run-build.sh --only hyprland # run a subset (comma-separated allowed) +# ./dry-run-build.sh --skip qtutils # skip one or more (comma-separated) +# +# Notes: +# - Run from the repository root. Do not cd into install-scripts/. +# - You can also call modules directly, e.g., DRY_RUN=1 ./install-scripts/hyprland.sh + +set -u +set -o pipefail + +REPO_ROOT=$(pwd) +LOG_DIR="$REPO_ROOT/Install-Logs" +mkdir -p "$LOG_DIR" +TS=$(date +%F-%H%M%S) +SUMMARY_LOG="$LOG_DIR/build-dry-run-$TS.log" + +# Default module order (core first, then Hyprland) +DEFAULT_MODULES=( + hyprutils + hyprlang + hyprgraphics + hyprwayland-scanner + hyprland-protocols + hyprland-qt-support + hyprland-qtutils + aquamarine + hyprland +) + +WITH_DEPS=0 +ONLY_LIST="" +SKIP_LIST="" + +usage() { + grep '^# ' "$0" | sed 's/^# \{0,1\}//' +} + +# Parse args +while [[ $# -gt 0 ]]; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + --with-deps) + WITH_DEPS=1 + shift + ;; + --only) + ONLY_LIST=${2:-} + shift 2 + ;; + --skip) + SKIP_LIST=${2:-} + shift 2 + ;; + *) + echo "Unknown argument: $1" >&2 + exit 2 + ;; + esac +done + +# Build module list based on --only/--skip +MODULES=() +if [[ -n "$ONLY_LIST" ]]; then + IFS=',' read -r -a MODULES <<< "$ONLY_LIST" +else + MODULES=("${DEFAULT_MODULES[@]}") +fi + +if [[ -n "$SKIP_LIST" ]]; then + IFS=',' read -r -a _SKIPS <<< "$SKIP_LIST" + FILTERED=() + for m in "${MODULES[@]}"; do + skip_it=0 + for s in "${_SKIPS[@]}"; do + if [[ "$m" == "$s" ]]; then + skip_it=1 + break + fi + done + if [[ $skip_it -eq 0 ]]; then + FILTERED+=("$m") + fi + done + MODULES=("${FILTERED[@]}") +fi + +# Optionally install dependencies (not a dry-run) +if [[ $WITH_DEPS -eq 1 ]]; then + echo "[INFO] Installing dependencies via 00-dependencies.sh" | tee -a "$SUMMARY_LOG" + if ! "$REPO_ROOT/install-scripts/00-dependencies.sh"; then + echo "[ERROR] Dependencies installation failed. See logs under Install-Logs/." | tee -a "$SUMMARY_LOG" + exit 1 + fi +fi + +# Run each module with DRY_RUN=1 and capture exit codes +declare -A RESULTS + +echo "[INFO] Starting dry-run build at $TS" | tee -a "$SUMMARY_LOG" + +for mod in "${MODULES[@]}"; do + script_path="$REPO_ROOT/install-scripts/$mod.sh" + echo "\n=== $mod (DRY RUN) ===" | tee -a "$SUMMARY_LOG" + if [[ ! -x "$script_path" ]]; then + # Try to make executable if it exists + if [[ -f "$script_path" ]]; then + chmod +x "$script_path" || true + fi + fi + if [[ ! -f "$script_path" ]]; then + echo "[WARN] Missing script: $script_path" | tee -a "$SUMMARY_LOG" + RESULTS[$mod]="MISSING" + continue + fi + if DRY_RUN=1 "$script_path"; then + RESULTS[$mod]="PASS" + else + RESULTS[$mod]="FAIL" + fi +done + +# Summary +{ + echo "\nSummary (dry-run):" + for mod in "${MODULES[@]}"; do + printf "%-24s %s\n" "$mod" "${RESULTS[$mod]:-SKIPPED}" + done + echo "\nLogs: individual module logs are under Install-Logs/. This summary: $SUMMARY_LOG" +} | tee -a "$SUMMARY_LOG" + +# Exit non-zero if any FAIL occurred +failed=0 +for mod in "${MODULES[@]}"; do + if [[ "${RESULTS[$mod]:-}" == "FAIL" ]]; then + failed=1 + fi +done +exit $failed \ No newline at end of file diff --git a/install-scripts/aquamarine.sh b/install-scripts/aquamarine.sh index f0a2fb6..5f5855a 100755 --- a/install-scripts/aquamarine.sh +++ b/install-scripts/aquamarine.sh @@ -7,6 +7,13 @@ #specific branch or release tag="v0.9.2" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -38,10 +45,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/aquamarine.git; then cd aquamarine || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}aquamarine $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}aquamarine $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}aquamarine $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}aquamarine $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of aquamarine $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprgraphics.sh b/install-scripts/hyprgraphics.sh index 2712371..a5ae9e9 100755 --- a/install-scripts/hyprgraphics.sh +++ b/install-scripts/hyprgraphics.sh @@ -10,6 +10,13 @@ hyprgraphics=( #specific branch or release tag="v0.1.5" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -50,10 +57,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/hyprgraphics.git; the cd hyprgraphics || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target hyprgraphics -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` - if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}hyprgraphics $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}hyprgraphics $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}hyprgraphics $graphics${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}hyprgraphics $graphics${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprgraphics $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprland-protocols.sh b/install-scripts/hyprland-protocols.sh index 72f0bc0..cbc6dbc 100755 --- a/install-scripts/hyprland-protocols.sh +++ b/install-scripts/hyprland-protocols.sh @@ -7,6 +7,13 @@ #specific branch or release tag="v0.6.4" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -37,10 +44,14 @@ printf "${INFO} Installing ${YELLOW}hyprland-protocols $tag${RESET} ...\n" if git clone --recursive -b $tag https://github.com/hyprwm/hyprland-protocols.git; then cd hyprland-protocols || exit 1 meson setup build - if sudo meson install -C build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}hyprland-protocols $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo meson install -C build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}hyprland-protocols $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-protocols $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-protocols $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprland-protocols $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprland-qt-support.sh b/install-scripts/hyprland-qt-support.sh index b0d8354..8fac32a 100755 --- a/install-scripts/hyprland-qt-support.sh +++ b/install-scripts/hyprland-qt-support.sh @@ -17,6 +17,13 @@ qt_support=( #specific branch or release tag="v0.1.0" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -58,10 +65,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/hyprland-qt-support.g cd hyprland-qt-support || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}hyprland-qt-support $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}hyprland-qt-support $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-qt-support $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-qt-support $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprland-qt-support $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprland-qtutils.sh b/install-scripts/hyprland-qtutils.sh index 4a05a7a..53f2c61 100755 --- a/install-scripts/hyprland-qtutils.sh +++ b/install-scripts/hyprland-qtutils.sh @@ -19,6 +19,13 @@ qtutils=( #specific branch or release tag="v0.1.4" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -60,10 +67,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/hyprland-qtutils.git; cd hyprland-qtutils || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}hyprland-qtutils $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}hyprland-qtutils $tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-qtutils $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}hyprland-qtutils $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprland-qtutils $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprland.sh b/install-scripts/hyprland.sh index 88c99af..5789f8d 100755 --- a/install-scripts/hyprland.sh +++ b/install-scripts/hyprland.sh @@ -5,6 +5,13 @@ #specific branch or release tag="v0.50.1" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + hyprland=( clang llvm @@ -67,12 +74,23 @@ fi if git clone --recursive -b $tag "https://github.com/hyprwm/Hyprland"; then cd "Hyprland" || exit 1 - patch -p1 < ../assets/0001-fix-hyprland-compile-issue.patch + # Apply patch only if it applies cleanly; otherwise skip + if [ -f ../assets/0001-fix-hyprland-compile-issue.patch ]; then + if patch -p1 --dry-run < ../assets/0001-fix-hyprland-compile-issue.patch >/dev/null 2>&1; then + patch -p1 < ../assets/0001-fix-hyprland-compile-issue.patch + else + echo "${NOTE} Hyprland compile patch does not apply on $tag; skipping." + fi + fi CXX=clang++ CXXFLAGS=-std=gnu++26 make all - if sudo make install 2>&1 | tee -a "$MLOG"; then - printf "${OK} ${MAGENTA}Hyprland tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo make install 2>&1 | tee -a "$MLOG"; then + printf "${OK} ${MAGENTA}Hyprland tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}Hyprland $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}Hyprland $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of Hyprland $tag." fi mv $MLOG ../Install-Logs/ || true cd .. diff --git a/install-scripts/hyprlang.sh b/install-scripts/hyprlang.sh index b8dba9d..7a10961 100755 --- a/install-scripts/hyprlang.sh +++ b/install-scripts/hyprlang.sh @@ -7,6 +7,13 @@ #specific branch or release tag="v0.6.4" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -38,10 +45,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/hyprlang.git; then cd hyprlang || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target hyprlang -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` - if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} ${MAGENTA}hyprlang tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install ./build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} ${MAGENTA}hyprlang tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for ${YELLOW}hyprlang $tag${RESET}" 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for ${YELLOW}hyprlang $tag${RESET}" 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprlang $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true diff --git a/install-scripts/hyprutils.sh b/install-scripts/hyprutils.sh index e0caefe..f99fb3f 100755 --- a/install-scripts/hyprutils.sh +++ b/install-scripts/hyprutils.sh @@ -6,6 +6,13 @@ #specific branch or release tag="v0.8.2" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -36,10 +43,14 @@ if git clone -b $tag "https://github.com/hyprwm/hyprutils.git"; then cd "hyprutils" || exit 1 cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` - if sudo cmake --install build 2>&1 | tee -a "$MLOG"; then - printf "${OK} hyprutils installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install build 2>&1 | tee -a "$MLOG"; then + printf "${OK} hyprutils installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for hyprutils." 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for hyprutils." 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprutils $tag." fi mv $MLOG ../Install-Logs/ || true cd .. diff --git a/install-scripts/hyprwayland-scanner.sh b/install-scripts/hyprwayland-scanner.sh index 21bb5bf..ebe9255 100755 --- a/install-scripts/hyprwayland-scanner.sh +++ b/install-scripts/hyprwayland-scanner.sh @@ -10,6 +10,13 @@ scan_depend=( #specific branch or release tag="v0.4.5" +# Dry-run support +DO_INSTALL=1 +if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then + DO_INSTALL=0 + echo "${NOTE} DRY RUN: install step will be skipped." +fi + ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -53,10 +60,14 @@ if git clone --recursive -b $tag https://github.com/hyprwm/hyprwayland-scanner.g cd hyprwayland-scanner || exit 1 cmake -DCMAKE_INSTALL_PREFIX=/usr -B build cmake --build build -j `nproc` - if sudo cmake --install build 2>&1 | tee -a "$MLOG" ; then - printf "${OK} hyprwayland-scanner installed successfully.\n" 2>&1 | tee -a "$MLOG" + if [ $DO_INSTALL -eq 1 ]; then + if sudo cmake --install build 2>&1 | tee -a "$MLOG" ; then + printf "${OK} hyprwayland-scanner installed successfully.\n" 2>&1 | tee -a "$MLOG" + else + echo -e "${ERROR} Installation failed for hyprwayland-scanner." 2>&1 | tee -a "$MLOG" + fi else - echo -e "${ERROR} Installation failed for hyprwayland-scanner." 2>&1 | tee -a "$MLOG" + echo "${NOTE} DRY RUN: Skipping installation of hyprwayland-scanner $tag." fi #moving the addional logs to Install-Logs directory mv $MLOG ../Install-Logs/ || true