| 1 | #!/bin/sh |
| 2 | |
| 3 | while [ $# -ge 1 ]; do |
| 4 | case "$1" in |
| 5 | --quick|-q) |
| 6 | QUICK=true |
| 7 | shift |
| 8 | ;; |
| 9 | -*) |
| 10 | echo "\ |
| 11 | Usage: pon [OPTIONS] [provider] [arguments] |
| 12 | -q|--quick pppd hangs up after all ip-up scripts are run |
| 13 | |
| 14 | If pon is invoked without arguments, /etc/ppp/ppp_on_boot file will be |
| 15 | run, presuming it exists and is executable. Otherwise, a PPP connection |
| 16 | will be started using settings from /etc/ppp/peers/provider. |
| 17 | If you specify one argument, a PPP connection will be started using |
| 18 | settings from the appropriate file in the /etc/ppp/peers/ directory, and |
| 19 | any additional arguments supplied will be passed as extra arguments to |
| 20 | pppd. |
| 21 | " |
| 22 | exit 0 |
| 23 | ;; |
| 24 | *) |
| 25 | break |
| 26 | ;; |
| 27 | esac |
| 28 | done |
| 29 | |
| 30 | if [ ! -r /etc/ppp/peers/ ]; then |
| 31 | echo "Error: only members of the 'dip' group can use this command." |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | if [ "$1" ]; then |
| 36 | PROVIDER=$1 |
| 37 | shift |
| 38 | fi |
| 39 | |
| 40 | if [ -z "$PROVIDER" ]; then |
| 41 | if [ -x /etc/ppp/ppp_on_boot ]; then |
| 42 | [ "$QUICK" ] && touch /var/run/ppp-quick |
| 43 | exec /etc/ppp/ppp_on_boot |
| 44 | fi |
| 45 | # try the default script |
| 46 | PROVIDER=provider |
| 47 | fi |
| 48 | |
| 49 | if [ ! -e "/etc/ppp/peers/$PROVIDER" ]; then |
| 50 | echo "\ |
| 51 | The file /etc/ppp/peers/$PROVIDER does not exist. Please create it or use |
| 52 | a command line argument to use another file in the /etc/ppp/peers/ directory." |
| 53 | exit 1 |
| 54 | fi |
| 55 | |
| 56 | [ "$QUICK" ] && touch /var/run/ppp-quick |
| 57 | exec /usr/sbin/pppd call $PROVIDER "$@" |
| 58 |