Skip to content

Commit 6284a52

Browse files
committed
Add new installer
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.
1 parent 60c7701 commit 6284a52

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

install.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env sh
2+
3+
POPPER_VERSION="v2.6.0"
4+
5+
OS_NAME="$(uname)"
6+
if [ "$OS_NAME" != "Linux" ] && [ "$OS_NAME" != "Darwin" ]; then
7+
echo "Popper only runs on Linux or MacOS. For Windows, we recommend WSL2."
8+
exit 1
9+
fi
10+
11+
command -v docker >/dev/null 2>&1 || { echo >&2 "docker command not found. Aborting."; exit 1; }
12+
13+
cat > ./popper << "EOF"
14+
#!/usr/bin/env sh
15+
docker run --rm -ti \
16+
--volume /var/run/docker.sock:/var/run/docker.sock \
17+
--volume $PWD:$PWD \
18+
--workdir $PWD \
19+
getpopper/popper:v2.6.0 $@
20+
EOF
21+
22+
chmod +x "./popper"
23+
24+
echo "\nInstalled version $POPPER_VERSION to executable file $PWD/popper\n"
25+
26+
while true; do
27+
read -p "Do you wish to move this binary to /usr/local/bin/? [Y/n] " yn < /dev/tty
28+
case $yn in
29+
[Yy]* ) echo "You might be asked for your (sudo) password."
30+
if [ -d "/usr/local/bin" ]; then
31+
sudo -p "password: " -- mv ./popper /usr/local/bin/
32+
else
33+
sudo -p "password: " -- mkdir -p /usr/local/bin/
34+
sudo mv ./popper /usr/local/bin/
35+
fi
36+
echo "\nPopper is now available for all users in this system!"
37+
break
38+
;;
39+
[Nn]* ) echo "\nTo make the popper command globally available, add it"
40+
echo "to a folder reachable by the PATH variable.\n"
41+
break
42+
;;
43+
* ) echo "\nPlease answer 'Y' or 'n'.\n"
44+
;;
45+
esac
46+
done

0 commit comments

Comments
 (0)