Always cd back to original pwd

This commit is contained in:
Max Weiss 2021-04-29 15:34:05 -07:00
parent fed7a5ed1d
commit 9e48a70ce9
Signed by untrusted user: maxweiss
GPG Key ID: C2D8443BA1D372DB

View File

@ -11,11 +11,12 @@ function clone_ipxe_upstream() {
#git clone git://git.ipxe.org/ipxe.git "$ipxe_src_dir" || return 1
git submodule update --init --recursive
curr="$(pwd)"
cd "$ipxe_src_dir"
# Known good commit
git checkout 56f7d44fde1d6ac196d115cc7dddd58e7ec098fa || return 1
cd "$curr"
return 0
}
@ -77,11 +78,12 @@ function make_ipxe_lkrn() {
return 1
fi
curr="$(pwd)"
cd "${ipxe_src_dir}/src/" || return 1
#make bin/ipxe.lkrn EMBED="${embed_file}" CERT="${signing_cert},${ca_cert}" TRUST="${ca_cert}" || return 2
echo lkrn > bin/ipxe.lkrn
cd "$curr"
return 0
}
@ -112,10 +114,12 @@ function make_ipxe_iso() {
return 1
fi
curr="$(pwd)"
cd "${ipxe_src_dir}/src/" || return 1
#make bin/ipxe.iso EMBED="${embed_file}" CERT="${signing_cert},${ca_cert}" TRUST="${ca_cert}" || return 2
echo iso > bin/ipxe.iso
cd "$curr"
return 0
}
@ -135,10 +139,11 @@ function make_ipxe_bin_shasums() {
return 1
fi
curr="$(pwd)"
cd "${ipxe_src_dir}/src/bin/" || return 1
sha256sum ipxe.lkrn ipxe.iso > SHA256SUMS || return 2
cd "$curr"
return 0
}
@ -163,6 +168,7 @@ function tag_head_and_push() {
return 1
fi
curr="$(pwd)"
cd "$git_repo_dir"
git config user.name "BuildBot"
@ -175,12 +181,13 @@ function tag_head_and_push() {
fi
git tag -a "g_$(git rev-parse HEAD)" HEAD -m "BuildBot: tag commit for release $(git rev-parse HEAD)" || return 2
env GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git push --tags origin master
git push --tags origin master
if [ $? -ne 0 ]; then
>&2 echo 'Error during attempted git push of new tag'
return 3
fi
cd "$curr"
return 0
}
@ -212,6 +219,7 @@ function create_release() {
return 1
fi
curr="$(pwd)"
cd "$git_repo_dir"
head="$(git rev-parse HEAD)"
@ -245,6 +253,7 @@ EOF
return 2
fi
cd "$curr"
return 0
}
@ -293,6 +302,7 @@ function upload_release_ipxe_lkrn() {
return 1
fi
curr="$(pwd)"
cd "$git_repo_dir"
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
@ -324,6 +334,7 @@ function upload_release_ipxe_lkrn() {
return 2
fi
cd "$curr"
return 0
}
@ -372,6 +383,7 @@ function upload_release_ipxe_iso() {
return 1
fi
curr="$(pwd)"
cd "$git_repo_dir"
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
@ -403,6 +415,7 @@ function upload_release_ipxe_iso() {
return 2
fi
cd "$curr"
return 0
}
@ -451,6 +464,7 @@ function upload_release_ipxe_shasums() {
return 1
fi
curr="$(pwd)"
cd "$git_repo_dir"
cat release_results.txt | grep ^HTTP/ | grep 201 >/dev/null
@ -482,6 +496,7 @@ function upload_release_ipxe_shasums() {
return 2
fi
cd "$curr"
return 0
}