Skip to content

Commit 9ebac97

Browse files
committed
feat(core): if github branch doesnt exist default to master
1 parent 0bec0ca commit 9ebac97

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

linuxgsm.sh

+12
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,18 @@ fn_install_file() {
320320
exit
321321
}
322322

323+
# Check that git branch exists.
324+
if [ "${remotereponame}" == "GitHub" ]; then
325+
branchexistscheck=$(curl -s -o /dev/null -w "%{http_code}" "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null)
326+
else
327+
branchexistscheck=$(curl -s -o /dev/null -w "%{http_code}" "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null)
328+
fi
329+
330+
if [ "${branchexistscheck}" != "200" ]; then
331+
echo -e "${githubbranch} branch does not exist. Defaulting to master branch."
332+
githubbranch="master"
333+
fi
334+
323335
# Prevent LinuxGSM from running as root. Except if doing a dependency install.
324336
if [ "$(whoami)" == "root" ] && [ ! -f /.dockerenv ]; then
325337
if [ "${userinput}" == "install" ] || [ "${userinput}" == "auto-install" ] || [ "${userinput}" == "i" ] || [ "${userinput}" == "ai" ]; then

0 commit comments

Comments
 (0)