Browse Source

Add --repo user/repo[#branch] update option (#184)

partition-checks
Luke Childs 4 years ago
committed by GitHub
parent
commit
4390393ffd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      scripts/update/update

21
scripts/update/update

@ -24,11 +24,30 @@ if [[ "${1}" == "--ota" ]]; then
elif [[ "${1}" == "--path" ]]; then
update_type="path"
update_path="${2}"
elif [[ "${1}" == "--repo" ]]; then
update_type="repo"
descriptor="${2}"
if [[ "${descriptor}" != *"#"* ]]; then
descriptor="${descriptor}#master"
fi
repo="${descriptor%%#*}"
branch="${descriptor#*#}"
else
echo "Update requires \"--ota\" or \"--path <path>\" option."
echo "Update requires \"--ota\", \"--path <path>\", or \"--repo user/repo[#branch]\" option."
exit 1
fi
if [[ "${update_type}" == "repo" ]]; then
repo_path="/tmp/umbrel-update/"
rm -rf "${repo_path}" 2> /dev/null || true
mkdir -p "${repo_path}"
git clone --single-branch --branch "${branch}" "https://github.com/${repo}.git" "${repo_path}"
# Now hand over to the path updater
update_type="path"
update_path="${repo_path}"
fi
if [[ "${update_type}" == "path" ]] && [[ ! -f "${update_path}/.umbrel" ]]; then
echo "Update path doesn't seem to be an Umbrel install."
exit 1

Loading…
Cancel
Save