This commit is contained in:
2026-07-10 15:11:51 +08:00
parent 8bfcf23bc2
commit da17239d7d
148 changed files with 2542 additions and 4873 deletions
+47 -13
View File
@@ -1,21 +1,48 @@
#!/usr/bin/env bash
##makedesc: Install postman (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
# https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
set -eo pipefail
# set -ex
installed() { command -v "$1" >/dev/null 2>&1; }
title
download() {
if installed wget; then
wget -q --show-progress "$1" -O "$2"
else
curl -fsSL "$1" -o "$2"
fi
}
mkdir -p "$HOME/install" && \
"$HOME/.local/bin" && \
"$HOME/.local/share/applications"
unpack_targz() {
tar -xzvf "$1" -C "$2"
}
download "https://dl.pstmn.io/download/latest/linux64" "$HOME/install/postman.tar.gz" && \
unpack_targz "$HOME/install/postman.tar.gz" "$HOME/install" && \
symlink "$HOME/install/Postman/Postman" "$HOME/.local/bin/postman" && \
cat << EOF > "$HOME/.local/share/applications/Postman.desktop" && sudo update-desktop-database
install() {
if [ "$(uname -s)" = "Darwin" ]; then
if installed brew; then
brew install --cask postman
else
echo "ERROR: Install Homebrew first." >&2
exit 1
fi
return
fi
echo
echo "==============================================="
echo "Installing postman"
echo "==============================================="
echo
# https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
mkdir -p "$HOME/install" "$HOME/.local/bin" "$HOME/.local/share/applications"
download "https://dl.pstmn.io/download/latest/linux64" "$HOME/install/postman.tar.gz"
unpack_targz "$HOME/install/postman.tar.gz" "$HOME/install"
ln -sf "$HOME/install/Postman/Postman" "$HOME/.local/bin/postman"
cat << EOF > "$HOME/.local/share/applications/Postman.desktop"
[Desktop Entry]
Name=Postman
Exec=$HOME/.local/bin/postman %U
@@ -26,8 +53,15 @@ Type=Application
Encoding=UTF-8
EOF
[ $? = 0 ] && {
if command -v update-desktop-database >/dev/null 2>&1; then
sudo update-desktop-database
fi
echo
success "Postman installed!"
echo "Finish!"
echo
}
case "$1" in
*) install ;;
esac