-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-postman.sh
More file actions
executable file
·42 lines (36 loc) · 1.33 KB
/
Copy pathinstall-postman.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -euo pipefail
CURRENT_ARCH="$(uname -m)"
case "${CURRENT_ARCH}" in
x86_64)
DOWNLOAD_ARCH_KEY=""
;;
*)
echo "Unsupported architecture: ${CURRENT_ARCH}"
exit 1
;;
esac
TMP_DOWNLOAD_DIRECTORY="${HOME}/.cache/dotfiles-tmp-download-dir"
POSTMAN_LATEST_VERSION="12.11.3"
POSTMAN_ZIP_FILE_NAME="Postman-${POSTMAN_LATEST_VERSION}${DOWNLOAD_ARCH_KEY}.tar.gz"
POSTMAN_INSTALL_DIRECTORY="${HOME}/.local/share/Postman"
DOWNLOAD_URI="https://dl.pstmn.io/download/version/${POSTMAN_LATEST_VERSION}/linux"
rm -rf "${POSTMAN_INSTALL_DIRECTORY}"
mkdir -p "${POSTMAN_INSTALL_DIRECTORY}" "${HOME}/.local/share/applications" "${TMP_DOWNLOAD_DIRECTORY}"
if [[ ! -f "${TMP_DOWNLOAD_DIRECTORY}/${POSTMAN_ZIP_FILE_NAME}" ]]; then
echo "Downloading app image."
curl -fL --connect-timeout 10 --max-time 600 "${DOWNLOAD_URI}" -o "${TMP_DOWNLOAD_DIRECTORY}/${POSTMAN_ZIP_FILE_NAME}"
else
echo "AppImage File already exists"
fi
tar -zxvf "${TMP_DOWNLOAD_DIRECTORY}/${POSTMAN_ZIP_FILE_NAME}" -C "${POSTMAN_INSTALL_DIRECTORY}" --strip-components=1
tee "${HOME}/.local/share/applications/postman.desktop" <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=${POSTMAN_INSTALL_DIRECTORY}/Postman %u
Icon=${POSTMAN_INSTALL_DIRECTORY}/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOF