Implement clean install option in tools.func (#7785)
This commit is contained in:
parent
d1ff8201b1
commit
01b6bec1fe
|
|
@ -306,6 +306,9 @@ function fetch_and_deploy_gh_release() {
|
||||||
|
|
||||||
msg_info "Fetching GitHub release: $app ($version)"
|
msg_info "Fetching GitHub release: $app ($version)"
|
||||||
|
|
||||||
|
local clean_install=false
|
||||||
|
[[ -n "${CLEAN_INSTALL:-}" && "$CLEAN_INSTALL" == "1" ]] && clean_install=true
|
||||||
|
|
||||||
### Tarball Mode ###
|
### Tarball Mode ###
|
||||||
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
||||||
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
||||||
|
|
@ -319,6 +322,10 @@ function fetch_and_deploy_gh_release() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p "$target"
|
mkdir -p "$target"
|
||||||
|
if [[ "${CLEAN_INSTALL:-0}" == "1" ]]; then
|
||||||
|
rm -rf "${target:?}/"*
|
||||||
|
fi
|
||||||
|
|
||||||
tar -xzf "$tmpdir/$filename" -C "$tmpdir"
|
tar -xzf "$tmpdir/$filename" -C "$tmpdir"
|
||||||
local unpack_dir
|
local unpack_dir
|
||||||
unpack_dir=$(find "$tmpdir" -mindepth 1 -maxdepth 1 -type d | head -n1)
|
unpack_dir=$(find "$tmpdir" -mindepth 1 -maxdepth 1 -type d | head -n1)
|
||||||
|
|
@ -425,6 +432,9 @@ function fetch_and_deploy_gh_release() {
|
||||||
local unpack_tmp
|
local unpack_tmp
|
||||||
unpack_tmp=$(mktemp -d)
|
unpack_tmp=$(mktemp -d)
|
||||||
mkdir -p "$target"
|
mkdir -p "$target"
|
||||||
|
if [[ "${CLEAN_INSTALL:-0}" == "1" ]]; then
|
||||||
|
rm -rf "${target:?}/"*
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$filename" == *.zip ]]; then
|
if [[ "$filename" == *.zip ]]; then
|
||||||
if ! command -v unzip &>/dev/null; then
|
if ! command -v unzip &>/dev/null; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user