Skip to content

Instantly share code, notes, and snippets.

@flyudvik
Forked from aviskase/Postman.desktop
Last active May 3, 2018 11:15
Show Gist options
  • Save flyudvik/57492e721ac89e6a61474ab4c6fdc1fb to your computer and use it in GitHub Desktop.
Save flyudvik/57492e721ac89e6a61474ab4c6fdc1fb to your computer and use it in GitHub Desktop.
Install Postman. `bash install-postman.sh`
#!/bin/bash
progressfilt ()
{
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c
do
if $flag
then
printf '%c' "$c"
else
if [[ $c != $cr && $c != $nl ]]
then
count=0
else
((count++))
if ((count > 1))
then
flag=true
fi
fi
fi
done
}
cd /tmp || exit
echo "Downloading Postman ..."
wget --progress=bar:force https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz 2>&1 | progressfilt
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman
fi
sudo mv Postman /opt/Postman
echo "Creating symbolic link..."
if [ -L "/usr/bin/postman" ];then
sudo rm -f /usr/bin/postman
fi
sudo ln -s /opt/Postman/Postman /usr/bin/postman
echo "Creating desktop shortcut in ~/.local/share/applications/"
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL
echo "Installation completed successfully."
echo "You can use Postman!"
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment