Skip to content

Instantly share code, notes, and snippets.

@lira
Forked from jcharlier/postman-update.sh
Last active October 26, 2023 11:16
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save lira/52ec288483f8620c416030b235ca5a2c to your computer and use it in GitHub Desktop.
Save lira/52ec288483f8620c416030b235ca5a2c to your computer and use it in GitHub Desktop.
Install/Update postman or postman canary (beta) for linux. Tested in ubuntu 17.10 gnome3
#!/bin/bash
cd /tmp || exit
read -r -p "[s]table or [b]eta? [sS/bB] " choice
choice=${choice,,} # tolower
if [[ ! "$choice" =~ ^(s|b)$ ]]; then
exit
fi
if [[ "$choice" = "s" ]]; then
url=https://dl.pstmn.io/download/latest/linux64
name=Postman
elif [[ "$choice" = "b" ]]; then
url="https://dl.pstmn.io/download/channel/canary/linux_64"
name=PostmanCanary
fi
echo "Downloading $name ..."
echo "URL: $url"
wget -c "$url" -O $name.tar.gz -q --show-progress
tar -xzf $name.tar.gz
echo "Changing ownership of files to root ..."
sudo chown -R root:root $name
rm $name.tar.gz
echo "Installing to opt..."
if [ -d "/opt/$name" ];then
sudo rm -rf /opt/$name
fi
sudo mv $name /opt/$name
echo "Creating symbolic link..."
if [ -L "/usr/bin/$name" ];then
sudo rm -f /usr/bin/$name
fi
sudo ln -s /opt/$name/$name /usr/bin/$name
if [ -f "/usr/share/applications/$name.desktop" ];then
sudo rm -rf /usr/share/applications/$name.desktop
fi
echo "[Desktop Entry]
Encoding=UTF-8
Name=$name
Exec=$name
Icon=/opt/$name/app/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;" | sudo tee /usr/share/applications/$name.desktop 2&>1;
echo "Installation completed successfully."
echo "You can now run the latest version of $name! by running the command '$name'."
@deyvisonborges
Copy link

Amazing brow. Tanks.

@leandronascimento
Copy link

Awesome. Thanks!!

@alexandrtovmach
Copy link

Amazing, thank you!

@yashpalchhajer
Copy link

Great buddy, Working fine on Ubuntu 18.
Thanks..!

@mitakshgupta
Copy link

mitakshgupta commented Oct 31, 2019

Worked like a charm on Ubuntu 18.04

@DominusKelvin
Copy link

This is great. Worked on Pop_OS as well. Thanks man

@bcode2
Copy link

bcode2 commented Jun 16, 2021

Excellent, working on Ubunto 20.10
Thanks!!!!!

@Michkail
Copy link

Michkail commented Jan 5, 2022

GG Gaming, anjaayy. Mainnya hebatt!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment