Fedora 44, install/configure improvements, Nextcloud desktop client fixes #24
+131
-43
@@ -24,6 +24,51 @@ die() { echo; echo "ERROR: $*" >&2; exit 1; }
|
|||||||
info() { echo; echo ">>> $*"; }
|
info() { echo; echo ">>> $*"; }
|
||||||
hr() { printf '%.0s─' {1..100}; echo; }
|
hr() { printf '%.0s─' {1..100}; echo; }
|
||||||
|
|
||||||
|
finish_install() {
|
||||||
|
local dev="$1"
|
||||||
|
|
||||||
|
chown root:root "$MOUNT_POINT" -R
|
||||||
|
chmod ug=rwX,o=rX "$MOUNT_POINT" -R
|
||||||
|
chmod o+w "$MOUNT_POINT/config" "$MOUNT_POINT/config.d"
|
||||||
|
|
||||||
|
info "Done."
|
||||||
|
echo
|
||||||
|
echo " OEMDRV device : $dev"
|
||||||
|
echo " Mounted at : $MOUNT_POINT"
|
||||||
|
echo
|
||||||
|
|
||||||
|
CONF_SCRIPT="$MOUNT_POINT/system_setup/configure.sh"
|
||||||
|
|
||||||
|
echo
|
||||||
|
read -r -p "Run configure.sh now to set up your environment? [y/N]: " RUN_CONF
|
||||||
|
if [[ "${RUN_CONF,,}" == "y" ]]; then
|
||||||
|
if [[ -n "$SUDO_USER" ]]; then
|
||||||
|
info "Running configure.sh as user '$SUDO_USER'..."
|
||||||
|
su - "$SUDO_USER" -c "DISPLAY='${DISPLAY}' WAYLAND_DISPLAY='${WAYLAND_DISPLAY}' bash '$CONF_SCRIPT'"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "configure.sh must be run as a non-root user. Please run:"
|
||||||
|
echo " bash $CONF_SCRIPT"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Next steps:"
|
||||||
|
echo " 1. Run: bash $CONF_SCRIPT"
|
||||||
|
echo " 2. Boot the Kickstart installer — it will detect the OEMDRV partition automatically."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
do_clone_and_done() {
|
||||||
|
local dev="$1"
|
||||||
|
|
||||||
|
info "Cloning $REPO_URL into $MOUNT_POINT..."
|
||||||
|
cd "$MOUNT_POINT" || die "Cannot cd to $MOUNT_POINT."
|
||||||
|
git clone --progress --depth 1 -b $REPO_BRANCH "$REPO_URL" . || die "git clone failed."
|
||||||
|
source "$(dirname "$0")/setup_system.inc.sh"
|
||||||
|
finish_install "$dev"
|
||||||
|
}
|
||||||
|
|
||||||
require_root() {
|
require_root() {
|
||||||
[[ "$EUID" -eq 0 ]] || die "This script must be run as root."
|
[[ "$EUID" -eq 0 ]] || die "This script must be run as root."
|
||||||
}
|
}
|
||||||
@@ -293,6 +338,90 @@ new_part_device() {
|
|||||||
require_root
|
require_root
|
||||||
check_tools
|
check_tools
|
||||||
|
|
||||||
|
# ── Check for existing OEMDRV partition ───────────────────────────────────────
|
||||||
|
|
||||||
|
EXISTING_OEMDRV_DEV=$(blkid -L "$OEMDRV_LABEL" 2>/dev/null || true)
|
||||||
|
if [[ -n "$EXISTING_OEMDRV_DEV" ]]; then
|
||||||
|
echo
|
||||||
|
echo "Found existing '$OEMDRV_LABEL' partition: $EXISTING_OEMDRV_DEV"
|
||||||
|
read -r -p " Use this partition and overwrite its install files? [y/N]: " ans
|
||||||
|
if [[ "${ans,,}" == "y" ]]; then
|
||||||
|
EXISTING_MNT=$(lsblk -n -o MOUNTPOINT "$EXISTING_OEMDRV_DEV" 2>/dev/null | grep -v '^$' | head -1)
|
||||||
|
if [[ -n "$EXISTING_MNT" ]]; then
|
||||||
|
echo " Partition is already mounted at $EXISTING_MNT — using that mountpoint."
|
||||||
|
MOUNT_POINT="$EXISTING_MNT"
|
||||||
|
else
|
||||||
|
info "Mounting $EXISTING_OEMDRV_DEV to $MOUNT_POINT..."
|
||||||
|
[[ -d "$MOUNT_POINT" ]] || mkdir -p "$MOUNT_POINT"
|
||||||
|
mount -o "$MOUNT_OPTS" "$EXISTING_OEMDRV_DEV" "$MOUNT_POINT" || die "mount failed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "$MOUNT_POINT/system_setup/setup_system.inc.sh" ]]; then
|
||||||
|
info "Sourcing existing setup_system.inc.sh..."
|
||||||
|
pushd "$MOUNT_POINT/system_setup" > /dev/null
|
||||||
|
source setup_system.inc.sh
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Check existing git repository origin ──────────────────────────────
|
||||||
|
if git -C "$MOUNT_POINT" rev-parse --git-dir >/dev/null 2>&1; then
|
||||||
|
EXIST_URL=$(git -C "$MOUNT_POINT" remote get-url origin 2>/dev/null || true)
|
||||||
|
EXIST_BRANCH=$(git -C "$MOUNT_POINT" symbolic-ref --short HEAD 2>/dev/null \
|
||||||
|
|| git -C "$MOUNT_POINT" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
|
||||||
|
if [[ -n "$EXIST_URL" && ( "$EXIST_URL" != "$REPO_URL" || "$EXIST_BRANCH" != "$REPO_BRANCH" ) ]]; then
|
||||||
|
echo
|
||||||
|
echo " The existing repository differs from the configured values:"
|
||||||
|
printf " %-12s %-55s %s\n" "" "Origin" "Branch"
|
||||||
|
printf " %-12s %-55s %s\n" "Existing:" "$EXIST_URL" "$EXIST_BRANCH"
|
||||||
|
printf " %-12s %-55s %s\n" "Configured:" "$REPO_URL" "$REPO_BRANCH"
|
||||||
|
echo
|
||||||
|
echo " How should this be resolved?"
|
||||||
|
echo " 1) Keep existing origin/branch — pull latest from $EXIST_URL / $EXIST_BRANCH"
|
||||||
|
echo " 2) Switch to configured origin — migrate to $REPO_URL / $REPO_BRANCH (preserves local files)"
|
||||||
|
echo " 3) Fresh clone from configured origin — clears all existing content"
|
||||||
|
read -r -p " Choice [1/2/3]: " GIT_CHOICE
|
||||||
|
case "${GIT_CHOICE}" in
|
||||||
|
1)
|
||||||
|
REPO_URL="$EXIST_URL"
|
||||||
|
REPO_BRANCH="$EXIST_BRANCH"
|
||||||
|
info "Fetching latest from $REPO_URL (branch: $REPO_BRANCH)..."
|
||||||
|
git -C "$MOUNT_POINT" fetch --depth 1 origin "$REPO_BRANCH" \
|
||||||
|
|| die "git fetch failed."
|
||||||
|
git -C "$MOUNT_POINT" checkout -B "$REPO_BRANCH" FETCH_HEAD \
|
||||||
|
|| die "git checkout failed."
|
||||||
|
source "$MOUNT_POINT/system_setup/setup_system.inc.sh"
|
||||||
|
finish_install "$EXISTING_OEMDRV_DEV"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
info "Switching origin to $REPO_URL (branch: $REPO_BRANCH)..."
|
||||||
|
git -C "$MOUNT_POINT" remote set-url origin "$REPO_URL" \
|
||||||
|
|| die "git remote set-url failed."
|
||||||
|
git -C "$MOUNT_POINT" fetch --depth 1 origin "$REPO_BRANCH" \
|
||||||
|
|| die "git fetch failed."
|
||||||
|
git -C "$MOUNT_POINT" checkout -B "$REPO_BRANCH" FETCH_HEAD \
|
||||||
|
|| die "git checkout failed."
|
||||||
|
source "$MOUNT_POINT/system_setup/setup_system.inc.sh"
|
||||||
|
finish_install "$EXISTING_OEMDRV_DEV"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Option 3 or anything else: fall through to clear + fresh clone
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$(ls -A "$MOUNT_POINT" 2>/dev/null)" ]]; then
|
||||||
|
info "Clearing existing content in $MOUNT_POINT before fresh clone..."
|
||||||
|
find "$MOUNT_POINT" -mindepth 1 -delete
|
||||||
|
fi
|
||||||
|
|
||||||
|
do_clone_and_done "$EXISTING_OEMDRV_DEV"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
info "Verifying repository URL..."
|
info "Verifying repository URL..."
|
||||||
check_repo_url
|
check_repo_url
|
||||||
case $? in
|
case $? in
|
||||||
@@ -497,47 +626,6 @@ info "Mounting $OEMDRV_DEV to $MOUNT_POINT (options: $MOUNT_OPTS)..."
|
|||||||
[[ -d "$MOUNT_POINT" ]] || mkdir -p "$MOUNT_POINT"
|
[[ -d "$MOUNT_POINT" ]] || mkdir -p "$MOUNT_POINT"
|
||||||
mount -o "$MOUNT_OPTS" "$OEMDRV_DEV" "$MOUNT_POINT" || die "mount failed."
|
mount -o "$MOUNT_OPTS" "$OEMDRV_DEV" "$MOUNT_POINT" || die "mount failed."
|
||||||
|
|
||||||
# ── Clone repository ──────────────────────────────────────────────────────────
|
# ── Clone repository + done ───────────────────────────────────────────────────
|
||||||
|
|
||||||
info "Cloning $REPO_URL into $MOUNT_POINT..."
|
do_clone_and_done "$OEMDRV_DEV"
|
||||||
cd "$MOUNT_POINT" || die "Cannot cd to $MOUNT_POINT."
|
|
||||||
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' \
|
|
||||||
| sed 's/UUID: //' | tr '[:upper:]' '[:lower:]' \
|
|
||||||
| sed 's/[^0-9a-z]*//g' | xargs | tail -c 13 \
|
|
||||||
> "./config.d/machine_uuid.sys"
|
|
||||||
|
|
||||||
chmod o=rwX . -R # to make changes to the configuration possible after install
|
|
||||||
|
|
||||||
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
info "Done."
|
|
||||||
echo
|
|
||||||
echo " OEMDRV device : $OEMDRV_DEV"
|
|
||||||
echo " Mounted at : $MOUNT_POINT"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# ── Optionally run configure.sh ───────────────────────────────────────────────
|
|
||||||
|
|
||||||
CONF_SCRIPT="$MOUNT_POINT/system_setup/configure.sh"
|
|
||||||
|
|
||||||
echo
|
|
||||||
read -r -p "Run configure.sh now to set up your environment? [y/N]: " RUN_CONF
|
|
||||||
if [[ "${RUN_CONF,,}" == "y" ]]; then
|
|
||||||
if [[ -n "$SUDO_USER" ]]; then
|
|
||||||
info "Running configure.sh as user '$SUDO_USER'..."
|
|
||||||
su - "$SUDO_USER" -c "DISPLAY='${DISPLAY}' WAYLAND_DISPLAY='${WAYLAND_DISPLAY}' bash '$CONF_SCRIPT'"
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "configure.sh must be run as a non-root user. Please run:"
|
|
||||||
echo " bash $CONF_SCRIPT"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "Next steps:"
|
|
||||||
echo " 1. Run: bash $CONF_SCRIPT"
|
|
||||||
echo " 2. Boot the Kickstart installer — it will detect the OEMDRV partition automatically."
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user