Skip to content

Commit

Permalink
Add new installer
Browse files Browse the repository at this point in the history
From time to time, new users experience issues that stem from installing
the Python package in unforeseen environments. This results in poor user
experience. In order to solve this, this commit introduces a sh-based
installer that creates a script wrapper for running popper via Docker.

Since Docker is a requirement already, this has a higher likelihood of
working, once a Docker installation has been successful.
  • Loading branch information
ivotron committed Jun 14, 2020
1 parent 60c7701 commit 6284a52
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh

POPPER_VERSION="v2.6.0"

OS_NAME="$(uname)"
if [ "$OS_NAME" != "Linux" ] && [ "$OS_NAME" != "Darwin" ]; then
echo "Popper only runs on Linux or MacOS. For Windows, we recommend WSL2."
exit 1
fi

command -v docker >/dev/null 2>&1 || { echo >&2 "docker command not found. Aborting."; exit 1; }

cat > ./popper << "EOF"
#!/usr/bin/env sh
docker run --rm -ti \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume $PWD:$PWD \
--workdir $PWD \
getpopper/popper:v2.6.0 $@
EOF

chmod +x "./popper"

echo "\nInstalled version $POPPER_VERSION to executable file $PWD/popper\n"

while true; do
read -p "Do you wish to move this binary to /usr/local/bin/? [Y/n] " yn < /dev/tty
case $yn in
[Yy]* ) echo "You might be asked for your (sudo) password."
if [ -d "/usr/local/bin" ]; then
sudo -p "password: " -- mv ./popper /usr/local/bin/
else
sudo -p "password: " -- mkdir -p /usr/local/bin/
sudo mv ./popper /usr/local/bin/
fi
echo "\nPopper is now available for all users in this system!"
break
;;
[Nn]* ) echo "\nTo make the popper command globally available, add it"
echo "to a folder reachable by the PATH variable.\n"
break
;;
* ) echo "\nPlease answer 'Y' or 'n'.\n"
;;
esac
done

0 comments on commit 6284a52

Please sign in to comment.