Skip to content

Commit

Permalink
Add install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdaGnsrn committed Mar 19, 2024
1 parent a7652a3 commit a67a8b1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

set -e

downloadFolder="${TMPDIR:-/tmp}"
downloaded_file="${downloadFolder}/pvm"
executable_folder="/usr/local/bin"
exe_name="pvm"
asset_uri="https://github.com/ardagnsrn/pvm-ubuntu/releases/latest/download/${exe_name}"

mkdir -p "${downloadFolder}"

echo "[1/3] Download ${asset_uri} to ${downloadFolder}"
rm -f "${downloaded_file}"
curl --fail --location --output "${downloaded_file}" "${asset_uri}"

echo "[2/3] Install PVM to the ${executable_folder}"
rm -f ${executable_folder}/${exe_name}
mv "${downloaded_file}" ${executable_folder}
exe=${executable_folder}/${exe_name}
chmod +x ${exe}

echo "[3/3] Set environment variables"
echo "PHP Version Manager (pvm) is installed successfully!"
if command -v $exe_name >/dev/null; then
echo "Run '$exe_name' to get started."
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export PATH=${executable_folder}:\$PATH"
echo "Run '$exe_name' to get started."
fi

exit 0

0 comments on commit a67a8b1

Please sign in to comment.