remove zip downloading from getGIT function
zip downloading doesn't preserve permissions
This commit is contained in:
18
install.sh
18
install.sh
@@ -27,7 +27,7 @@ then
|
||||
fi
|
||||
|
||||
# terminate with /
|
||||
command_package="git git/jq jq/wget wget/unzip unzip"
|
||||
command_package="git git/jq jq/wget wget"
|
||||
packages=()
|
||||
|
||||
while read -r -d '/' CMD PKG
|
||||
@@ -82,20 +82,14 @@ if (( $( { du -s "$ipath/git-db" 2>/dev/null || echo 0; } | cut -f1) > 150000 ))
|
||||
rm -rf "$ipath/git-db"
|
||||
fi
|
||||
|
||||
if ! command -v git &>/dev/null || ! command -v wget &>/dev/null || ! command -v unzip &>/dev/null; then
|
||||
apt-get update || true; apt-get install -y --no-install-recommends --no-install-suggests git wget unzip || true
|
||||
fi
|
||||
function getGIT() {
|
||||
# getGIT $REPO $BRANCH $TARGET (directory)
|
||||
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then echo "getGIT wrong usage, check your script or tell the author!" 1>&2; return 1; fi
|
||||
REPO="$1"; BRANCH="$2"; TARGET="$3"; pushd .; tmp=/tmp/getGIT-tmp.$RANDOM.$RANDOM
|
||||
if cd "$TARGET" &>/dev/null && git fetch --depth 1 origin "$BRANCH" && git reset --hard FETCH_HEAD; then popd && return 0; fi
|
||||
popd; if ! cd /tmp || ! rm -rf "$TARGET"; then return 1; fi
|
||||
if git clone --depth 1 --single-branch --branch "$2" "$1" "$3"; then return 0; fi
|
||||
if wget -O "$tmp" "${REPO%".git"}/archive/$BRANCH.zip" && unzip "$tmp" -d "$tmp.folder"; then
|
||||
if mv -fT "$tmp.folder/$(ls $tmp.folder)" "$TARGET"; then rm -rf "$tmp" "$tmp.folder"; return 0; fi
|
||||
fi
|
||||
rm -rf "$tmp" "$tmp.folder"; return 1
|
||||
REPO="$1"; BRANCH="$2"; TARGET="$3"; pushd .
|
||||
if cd "$TARGET" &>/dev/null && git fetch --depth 1 origin "$BRANCH" && git reset --hard FETCH_HEAD; then popd; return 0; fi
|
||||
if ! cd /tmp || ! rm -rf "$TARGET"; then popd; return 1; fi
|
||||
if git clone --depth 1 --single-branch --branch "$2" "$1" "$3"; then popd; return 0; fi
|
||||
popd; return 1;
|
||||
}
|
||||
|
||||
if ! { [[ "$1" == "test" ]] && cd "$ipath/git-db" && git rev-parse; }; then
|
||||
|
||||
Reference in New Issue
Block a user