Skip to content

Instantly share code, notes, and snippets.

@danielcarr
Created June 5, 2017 11:49
Show Gist options
  • Save danielcarr/e6c79a76da7a12421bc63efac58ac611 to your computer and use it in GitHub Desktop.
Save danielcarr/e6c79a76da7a12421bc63efac58ac611 to your computer and use it in GitHub Desktop.
Update the Postman linux app automatically
#! /usr/bin/env bash
POSTMAN_URL="https://dl.pstmn.io/download/latest/linux64"
DL_LOCATION="/tmp/postman"
UPDATE_NAME="update.tar.gz"
ORIG_NAME="Postman"
NEW_NAME="postman"
LINK_LOCATION="/opt/bin"
DL_ARCHIVE="${DL_LOCATION}/${UPDATE_NAME}"
DL_DIR="${DL_LOCATION}/${ORIG_NAME}"
POSTMAN_LOCATION="/opt/${NEW_NAME}"
curl -LC - "${POSTMAN_URL}" --create-dirs -o "${DL_ARCHIVE}"
tar xzf "${DL_ARCHIVE}" -C "${DL_LOCATION}"
mv "${DL_DIR}/${ORIG_NAME}" "${DL_DIR}/${NEW_NAME}"
rm -r "${POSTMAN_LOCATION}"
mv -T "${DL_DIR}" "${POSTMAN_LOCATION}"
rm -r "${DL_LOCATION}"
ln -sf "${POSTMAN_LOCATION}/${NEW_NAME}" "${LINK_LOCATION}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment