1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#!/bin/bash
# <h2>This is the PageKite mini-installer!</h2><p>
# Run with: <b>curl http://pagekite.net/pk/ |sudo bash</b>
# <br>
# or just: <b>curl http://pagekite.net/pk/ |bash</b>
# </p><hr><pre>
###############################################################################
# Check if SSL works
if [ "$(which curl)" == "" ]; then
cat <<tac
WARNING: You don't seem to have curl installed!
This script depends on it. Sorry. :-(
You can manually download pagekite.py from these URLs instead:
Basic version: https://pagekite.net/pk/pagekite.py
Alpha GTK GUI: https://pagekite.net/pk/pagekite-gtk.py
Android/SL4A: https://pagekite.net/pk/pagekite-android.py
Remember to run 'chmod +x pagekite*.py' after downloading.
There are also Debian and RPM packages on: https://pagekite.net/downloads/
tac
exit 0
else
if ! curl -s https://pagekite.net/pk/ >/dev/null; then
cat <<tac
WARNING: Your curl does not handle the pagekite.net SSL certificate
properly. Bailing out! If you aren't afraid of the evil
hax0rz, you can install over plain HTTP like so:
$ curl http://pagekite.net/pk/ |sed -e s/https:/http:/g | sudo bash
tac
exit 0
fi
fi
###############################################################################
# Choose our destination
DEST=/usr/local/bin
echo ":$PATH:" |grep -c :$DEST: >/dev/null 2>&1 || DEST=/usr/bin
if [ ! -d "$DEST" ]; then
mkdir -p "$DEST" >/dev/null 2>&1 || true
fi
if [ ! -w "$DEST" ]; then
[ -w "$HOME/bin" ] && DEST="$HOME/bin" || DEST="$HOME"
fi
DESTFILE="$DEST/pagekite.py"
PAGEKITE="$DESTFILE"
echo ":$PATH:" |grep -c :$DEST: >/dev/null 2>&1 && PAGEKITE=pagekite.py
export DESTFILE
DESTFILE_GTK=
echo 'import gtk' |python 2>/dev/null && DESTFILE_GTK="$DEST/pagekite-gtk.py"
PAGEKITE_GTK="$DESTFILE_GTK"
echo ":$PATH:" |grep -c :$DEST: >/dev/null 2>&1 && PAGEKITE_GTK=pagekite-gtk.py
export DESTFILE_GTK
###############################################################################
# Install!
(
set -x
curl https://pagekite.net/pk/pagekite.py >"$DESTFILE" || exit 1
chmod +x "$DESTFILE" || exit 2
if [ "$DESTFILE_GTK" != "" ]; then
curl https://pagekite.net/pk/pagekite-gtk.py >"$DESTFILE_GTK" || exit 3
chmod +x "$DESTFILE_GTK" || exit 4
fi
)\
&& cat <<tac
~~~~'~~~~~,~~~~~~'~~~~</>
Welcome to PageKite!
PageKite has been installed to $DESTFILE !
Some useful commands:
$ $PAGEKITE --signup # Sign up for service
$ $PAGEKITE 80 NAME.pagekite.me # Expose port 80 as NAME.pagekite.me
For further instructions:
$ $PAGEKITE --help |less
tac
if [ "$PAGEKITE" != "pagekite.py" ]; then
echo 'To install system-wide, run: '
echo
echo " $ sudo mv $PAGEKITE /usr/local/bin"
echo
fi
if [ "$DESTFILE_GTK" != "" ]; then
cat <<tac
Alternately, you can try the experimental GUI version by running:
$ $PAGEKITE_GTK &
tac
fi
|