diff --git a/install.md b/install.md index e346678..da1bb03 100644 --- a/install.md +++ b/install.md @@ -26,6 +26,19 @@ curl -fsSL https://gitea.dtext.online/obel1x/fedora-OEMDRV/raw/branch/main/syste sudo bash /tmp/install.sh ``` +## Run directly from another repository + +If you are on another fork or branch and you want to test your changes, do: + +```bash +export REPO_URL="https://yourgitserver.tld/.../fedora-OEMDRV.git" +export REPO_BRANCH="anotherbranch" +curl -fsSL ${REPO_URL%.git}/raw/branch/${REPO_BRANCH}/system_setup/install.sh -o /tmp/install.sh +sudo -E bash /tmp/install.sh +``` + +That way, install.sh should know what to pull. + ## After the script completes Configure your environment before running any installation: diff --git a/system_setup/install.sh b/system_setup/install.sh index feb4072..5191cac 100755 --- a/system_setup/install.sh +++ b/system_setup/install.sh @@ -14,7 +14,8 @@ SHRINK_MIB=4096 OEMDRV_LABEL="OEMDRV" MOUNT_POINT="/opt/sys_config" MOUNT_OPTS="compress=zstd:6" -REPO_URL="${1:-https://gitea.dtext.online/obel1x/fedora-OEMDRV.git}" +REPO_URL="${REPO_URL:-https://gitea.dtext.online/obel1x/fedora-OEMDRV.git}" +REPO_BRANCH="${REPO_BRANCH:-main}" MIN_FREE_MIB=$(( SHRINK_MIB + 512 )) # require 512 MiB headroom above the shrink size # ── Helpers ─────────────────────────────────────────────────────────────────── @@ -69,7 +70,7 @@ check_repo_url() { tmpdir=$(mktemp -d /tmp/oemdrv_repocheck.XXXXXX) - if ! curl -fsSL "${REPO_URL%.git}/raw/branch/main/system_setup/install.sh" \ + if ! curl -fsSL "${REPO_URL%.git}/raw/branch/${REPO_BRANCH}/system_setup/install.sh" \ -o "$tmpdir/install.sh" 2>/dev/null; then rm -rf "$tmpdir" return 1 @@ -293,13 +294,13 @@ info "Verifying repository URL..." check_repo_url case $? in 1) echo - echo "WARNING: '$REPO_URL' is not a reachable git repository." + echo "WARNING: '$REPO_URL' branch '${REPO_BRANCH}' is not a reachable git repository." read -r -p " Continue anyway? [y/N]: " ans [[ "${ans,,}" == "y" ]] || { echo "Aborted."; exit 0; } ;; 2) echo echo "WARNING: The checksum of this script does not match 'system_setup/install.sh'" - echo " at '$REPO_URL'." + echo " at '$REPO_URL' branch '${REPO_BRANCH}'." echo " You may be running an outdated or modified version of install.sh." read -r -p " Continue anyway? [y/N]: " ans [[ "${ans,,}" == "y" ]] || { echo "Aborted."; exit 0; } @@ -496,7 +497,7 @@ mount -o "$MOUNT_OPTS" "$OEMDRV_DEV" "$MOUNT_POINT" || die "mount failed." info "Cloning $REPO_URL into $MOUNT_POINT..." cd "$MOUNT_POINT" || die "Cannot cd to $MOUNT_POINT." -git clone --progress --depth 1 "$REPO_URL" . || die "git clone failed." +git clone --progress --depth 1 -b $REPO_BRANCH "$REPO_URL" . || die "git clone failed." # Write hardware UUID to a user-readable per-machine file dmidecode -t system | grep -i 'UUID' \ diff --git a/system_setup/install_from_repo.sh b/system_setup/install_from_repo.sh deleted file mode 100755 index 5273ed6..0000000 --- a/system_setup/install_from_repo.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh -# SPDX-FileCopyrightText: Daniel Pätzold -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# Fetches the installfile from a repository and runs it -# -REPO_URL="${1:-https://gitea.dtext.online/obel1x/fedora-OEMDRV.git}" -REPO_BRANCH="${2:-main}" - -SCRIPTURL="${REPO_URL%.git}/raw/branch/${REPO_BRANCH}/system_setup/install.sh" -echo "Fetching from ${SCRIPTURL} and running script with sudo" -curl -fsSL ${SCRIPTURL} -o /tmp/install.sh && sudo bash /tmp/install.sh ${REPO_URL}