scripts/development/postman/postman-install.sh
2024-04-04 12:09:20 +02:00

56 lines
1014 B
Bash
Executable File

#!/bin/bash
#### Variables
APT_INST="apt -y install"
DST_INST="/usr/local/share"
DST_BIN="/usr/local/bin/postman"
PKG_DEPS=(wget)
URL_SRC="https://dl.pstmn.io/download/latest/linux_64"
#### Functions
check_root() {
if [ "$EUID" -ne 0 ]; then
echo "Must be root to run $0"
exit
fi
}
choice() {
echo -ne "[y/n]"
while true
do
read -rN1 input
case $input in
[yY][eE][sS]|[yY])
return 0
break
;;
[nN][oO]|[nN])
return 1
;;
esac
done
}
postman_install() {
echo "* download postman"
wget --quiet --show-progress "$URL_SRC" -O /tmp/postman-linux-x64.tar.gz
echo "* extract postman to $DST_INST"
tar -xf /tmp/postman-linux-x64.tar.gz -C "$DST_INST"
ln -f -s "$DST_INST/Postman/Postman" "$DST_BIN"
cp postman.desktop /usr/share/applications
echo "* cleanup ..."
rm -f /tmp/postman-linux-x64.tar.gz
echo "* installation of postman completed"
}
#### Main
check_root
postman_install