forked from obel1x/fedora-OEMDRV
inc.sh: use BASH_SOURCE for path resolution; add --missingconfok; fix install.sh sourcing and git pull logic
setup_system.inc.sh: replace $(dirname "$0") with $(dirname "${BASH_SOURCE[0]:-$0}") so
paths resolve correctly whether the file is sourced or executed directly. Add --missingconfok
flag to warn-and-continue instead of prompting+aborting when config is missing. Fix machine_uuid
path (missing ../). Move `source config` into the else branch so it is not reached when
missingconfok skips the exit.
install.sh: source inc.sh instead of executing it as a subprocess so exported variables
(REPO_URL etc.) propagate back to the caller. Fix git-origin conflict handling: when reusing
an existing OEMDRV partition the user has already confirmed they want to keep it, so remove
the "fresh clone / wipe" option entirely. Now always pulls (fetch+checkout) when a git repo
is present; clears and fresh-clones only when no git repo exists on the partition.
basic_pre_script.inc: dot-source inc.sh so INSTALLDOCS and other config vars are available.
config.dist, sync_client_software.sh: rename UPGRADEURL/UPGRADEBRANCH to REPO_URL/REPO_BRANCH
to match the variable names already used in install.sh.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,29 +34,29 @@ echo ""
|
||||
#Do an upgrade of the Base package if its configured and if there are changes
|
||||
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
|
||||
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
|
||||
if [[ ! -z "${UPGRADEURL}" ]]; then
|
||||
echo "Checking for Upgrades on ${UPGRADEURL} and Branch ${UPGRADEBRANCH}"
|
||||
if [[ ! -z "${REPO_URL}" ]]; then
|
||||
echo "Checking for Upgrades on ${REPO_URL} and Branch ${REPO_BRANCH}"
|
||||
REMOTEURL=$( git config --get remote.origin.url )
|
||||
echo "Remote git URL is ${REMOTEURL}"
|
||||
if [[ "${REMOTEURL}" != "${UPGRADEURL}" ]]; then
|
||||
if [[ "${REMOTEURL}" != "${REPO_URL}" ]]; then
|
||||
echo "This Repo is not on the matching URL, so no update is possible. If you want to change this, check out the docs on how to setup from scratch."
|
||||
else
|
||||
GITBRANCH=$( git rev-parse --abbrev-ref HEAD )
|
||||
echo "Current branch is ${GITBRANCH}"
|
||||
if [[ "${GITBRANCH}" != "${UPGRADEBRANCH}" ]]; then
|
||||
if [[ "${GITBRANCH}" != "${REPO_BRANCH}" ]]; then
|
||||
echo "This Repo is not on the right branch, so no update is possible."
|
||||
else
|
||||
# Doing upgrade, discarding all local changes frist (is more save than forced pull)
|
||||
echo "Checks have passed, we are now upgrading via git."
|
||||
#Fetch latest Updates and remove all history
|
||||
git fetch origin && git reset --hard origin/${UPGRADEBRANCH} && git rebase HEAD^
|
||||
git fetch origin && git reset --hard origin/${REPO_BRANCH} && git rebase HEAD^
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failure while updating, will continue as is."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "UPGRADEURL is not specified in conf - No Upgrade option available."
|
||||
echo "REPO_URL is not specified in conf - No Upgrade option available."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user