wok annotate rp-pppoe/stuff/pppoe-setup @ rev 7194

Disabled upnp in vlc. This cause the new libupnp causes vlc to not compile.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Nov 09 03:18:42 2010 +0000 (2010-11-09)
parents 580279b0298b
children
rev   line source
pankso@8 1 #!/bin/sh
pankso@8 2 #***********************************************************************
pankso@8 3 #
pankso@8 4 # pppoe-setup
pankso@8 5 #
pankso@8 6 # All-purpose slicing/dicing shell script to configure rp-pppoe.
pankso@8 7 #
pankso@8 8 # LIC: GPL
pankso@8 9 #
pankso@8 10 # Copyright (C) 2000 Roaring Penguin Software Inc.
pankso@8 11 #
pankso@8 12 # $Id: pppoe-setup.in,v 1.2 2005/08/10 00:25:18 dfs Exp $
pankso@8 13 #***********************************************************************
pankso@8 14
pankso@8 15 # From AUTOCONF
pankso@8 16 prefix=/usr
pankso@8 17 exec_prefix=${prefix}
pankso@8 18
pankso@8 19 # Paths to programs
pankso@8 20 IFCONFIG=/sbin/ifconfig
pankso@8 21 PPPD=/usr/sbin/pppd
pankso@8 22 PPPOE=${exec_prefix}/sbin/pppoe
pankso@8 23 ECHO=/bin/echo
pankso@8 24 LOGGER="/usr/bin/logger -t `basename $0`"
pankso@8 25
pankso@8 26 # Set to "C" locale so we can parse messages from commands
pankso@8 27 LANG=C
pankso@8 28 export LANG
pankso@8 29
pankso@8 30 CONFIG=/etc/ppp/pppoe.conf
pankso@8 31
pankso@8 32 # Protect created files
pankso@8 33 umask 077
pankso@8 34
pankso@8 35 copy() {
pankso@8 36 cp $1 $2
pankso@8 37 if [ "$?" != 0 ] ; then
pankso@8 38 $ECHO "*** Error copying $1 to $2"
pankso@8 39 $ECHO "*** Quitting."
pankso@8 40 exit 1
pankso@8 41 fi
pankso@8 42 }
pankso@8 43
pankso@8 44 $ECHO "Welcome to the Roaring Penguin PPPoE client setup. First, I will run"
pankso@8 45 $ECHO "some checks on your system to make sure the PPPoE client is installed"
pankso@8 46 $ECHO "properly..."
pankso@8 47 $ECHO ""
pankso@8 48
pankso@8 49 # Must be root
pascal@1965 50 if [ "`/bin/id -u`" != 0 ] ; then
pankso@8 51 $ECHO "$0: Sorry, you must be root to run this script"
pankso@8 52 exit 1
pankso@8 53 fi
pankso@8 54
pankso@8 55 # Prototype config file must exist
pankso@8 56 if [ ! -r "$CONFIG" ] ; then
pankso@8 57 $ECHO "Oh, dear, I don't see the file '$CONFIG' anywhere. Please"
pankso@8 58 $ECHO "re-install the PPPoE client."
pankso@8 59 exit 1
pankso@8 60 fi
pankso@8 61
pankso@8 62 # Must have pppd
pankso@8 63 if [ ! -x $PPPD ] ; then
pankso@8 64 $ECHO "Oops, I can't execute the program '$PPPD'. You"
pankso@8 65 $ECHO "must install the PPP software suite, version 2.3.10 or later."
pankso@8 66 exit 1
pankso@8 67 fi
pankso@8 68 export CONFIG
pankso@8 69 . $CONFIG
pankso@8 70
pankso@8 71 if [ "$DEMAND" = "" ] ; then
pankso@8 72 DEMAND=no
pankso@8 73 fi
pankso@8 74
pankso@8 75 # pppoe must exist
pankso@8 76 if [ ! -x "$PPPOE" ] ; then
pankso@8 77 $ECHO "Oh, dear, I can't execute the program '$PPPOE'. Please"
pankso@8 78 $ECHO "re-install the rp-pppoe client."
pankso@8 79 exit 1
pankso@8 80 fi
pankso@8 81
pankso@8 82 $ECHO "Looks good! Now, please enter some information:"
pankso@8 83
pankso@8 84 while [ true ] ; do
pankso@8 85 $ECHO ""
pankso@8 86 $ECHO "USER NAME"
pankso@8 87 $ECHO ""
pankso@8 88 printf "%s" ">>> Enter your PPPoE user name (default $USER): "
pankso@8 89 read U
pankso@8 90
pankso@8 91 if [ "$U" = "" ] ; then
pankso@8 92 U="$USER"
pankso@8 93 fi
pankso@8 94
pankso@8 95 # Under Linux, "fix" the default interface if eth1 is not available
pankso@8 96 if test `uname -s` = "Linux" ; then
pankso@8 97 $IFCONFIG $ETH > /dev/null 2>&1 || ETH=eth0
pankso@8 98 fi
pankso@8 99 $ECHO ""
pankso@8 100 $ECHO "INTERFACE"
pankso@8 101 $ECHO ""
pankso@8 102 $ECHO ">>> Enter the Ethernet interface connected to the DSL modem"
pankso@8 103 $ECHO "For Solaris, this is likely to be something like /dev/hme0."
pankso@8 104 $ECHO "For Linux, it will be ethn, where 'n' is a number."
pankso@8 105 printf "%s" "(default $ETH): "
pankso@8 106 read E
pankso@8 107
pankso@8 108 if [ "$E" = "" ] ; then
pankso@8 109 E="$ETH"
pankso@8 110 fi
pankso@8 111
pankso@8 112 $ECHO ""
pankso@8 113 $ECHO "Do you want the link to come up on demand, or stay up continuously?"
pankso@8 114 $ECHO "If you want it to come up on demand, enter the idle time in seconds"
pankso@8 115 $ECHO "after which the link should be dropped. If you want the link to"
pankso@8 116 $ECHO "stay up permanently, enter 'no' (two letters, lower-case.)"
pankso@8 117 $ECHO "NOTE: Demand-activated links do not interact well with dynamic IP"
pankso@8 118 $ECHO "addresses. You may have some problems with demand-activated links."
pankso@8 119 printf "%s" ">>> Enter the demand value (default $DEMAND): "
pankso@8 120 read D
pankso@8 121 if [ "$D" = "" ] ; then
pankso@8 122 D=$DEMAND
pankso@8 123 fi
pankso@8 124
pankso@8 125 $ECHO ""
pankso@8 126 $ECHO "DNS"
pankso@8 127 $ECHO ""
pankso@8 128 $ECHO "Please enter the IP address of your ISP's primary DNS server."
pankso@8 129 $ECHO "If your ISP claims that 'the server will provide DNS addresses',"
pankso@8 130 $ECHO "enter 'server' (all lower-case) here."
pankso@8 131 $ECHO "If you just press enter, I will assume you know what you are"
pankso@8 132 $ECHO "doing and not modify your DNS setup."
pankso@8 133 printf "%s" ">>> Enter the DNS information here: "
pankso@8 134
pankso@8 135 read DNS1
pankso@8 136
pankso@8 137
pankso@8 138 if [ "$DNS1" != "" ] ; then
pankso@8 139 if [ "$DNS1" != "server" ] ; then
pankso@8 140 $ECHO "Please enter the IP address of your ISP's secondary DNS server."
pankso@8 141 $ECHO "If you just press enter, I will assume there is only one DNS server."
pankso@8 142 printf "%s" ">>> Enter the secondary DNS server address here: "
pankso@8 143 read DNS2
pankso@8 144 fi
pankso@8 145 fi
pankso@8 146
pankso@8 147 while [ true ] ; do
pankso@8 148 $ECHO ""
pankso@8 149 $ECHO "PASSWORD"
pankso@8 150 $ECHO ""
pankso@8 151 stty -echo
pankso@8 152 printf "%s" ">>> Please enter your PPPoE password: "
pankso@8 153 read PWD1
pankso@8 154 $ECHO ""
pankso@8 155 printf "%s" ">>> Please re-enter your PPPoE password: "
pankso@8 156 read PWD2
pankso@8 157 $ECHO ""
pankso@8 158 stty echo
pankso@8 159 if [ "$PWD1" = "$PWD2" ] ; then
pankso@8 160 break
pankso@8 161 fi
pankso@8 162
pankso@8 163 printf "%s" ">>> Sorry, the passwords do not match. Try again? (y/n)"
pankso@8 164 read ANS
pankso@8 165 case "$ANS" in
pankso@8 166 N|No|NO|Non|n|no|non)
pankso@8 167 $ECHO "OK, quitting. Bye."
pankso@8 168 exit 1
pankso@8 169 esac
pankso@8 170 done
pankso@8 171
pankso@8 172 # Firewalling
pankso@8 173 $ECHO ""
pankso@8 174 $ECHO "FIREWALLING"
pankso@8 175 $ECHO ""
pankso@8 176 if test `uname -s` != "Linux" ; then
pankso@8 177 $ECHO "Sorry, firewalling is only supported under Linux. Consult"
pankso@8 178 $ECHO "your operating system manuals for details on setting up"
pankso@8 179 $ECHO "packet filters for your system."
pankso@8 180 FIREWALL=NONE
pankso@8 181 else
pankso@8 182 $ECHO "Please choose the firewall rules to use. Note that these rules are"
pankso@8 183 $ECHO "very basic. You are strongly encouraged to use a more sophisticated"
pankso@8 184 $ECHO "firewall setup; however, these will provide basic security. If you"
pankso@8 185 $ECHO "are running any servers on your machine, you must choose 'NONE' and"
pankso@8 186 $ECHO "set up firewalling yourself. Otherwise, the firewall rules will deny"
pankso@8 187 $ECHO "access to all standard servers like Web, e-mail, ftp, etc. If you"
pankso@8 188 $ECHO "are using SSH, the rules will block outgoing SSH connections which"
pankso@8 189 $ECHO "allocate a privileged source port."
pankso@8 190 $ECHO ""
pankso@8 191 while [ true ] ; do
pankso@8 192 $ECHO "The firewall choices are:"
pankso@8 193 $ECHO "0 - NONE: This script will not set any firewall rules. You are responsible"
pankso@8 194 $ECHO " for ensuring the security of your machine. You are STRONGLY"
pankso@8 195 $ECHO " recommended to use some kind of firewall rules."
pankso@8 196 $ECHO "1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation"
pankso@8 197 $ECHO "2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway"
pankso@8 198 $ECHO " for a LAN"
pankso@8 199 printf "%s" ">>> Choose a type of firewall (0-2): "
pankso@8 200 read a
pankso@8 201 if [ "$a" = 0 -o "$a" = 1 -o "$a" = 2 ] ; then
pankso@8 202 break
pankso@8 203 fi
pankso@8 204 $ECHO "Please enter a number from 0 to 2"
pankso@8 205 done
pankso@8 206
pankso@8 207 case "$a" in
pankso@8 208 0)
pankso@8 209 FIREWALL=NONE
pankso@8 210 ;;
pankso@8 211 1)
pankso@8 212 FIREWALL=STANDALONE
pankso@8 213 ;;
pankso@8 214 2)
pankso@8 215 FIREWALL=MASQUERADE
pankso@8 216 ;;
pankso@8 217 esac
pankso@8 218 fi
pankso@8 219
pankso@8 220 $ECHO ""
pankso@8 221 $ECHO "** Summary of what you entered **"
pankso@8 222 $ECHO ""
pankso@8 223 $ECHO "Ethernet Interface: $E"
pankso@8 224 $ECHO "User name: $U"
pankso@8 225 if [ "$D" = "no" ] ; then
pankso@8 226 $ECHO "Activate-on-demand: No"
pankso@8 227 else
pankso@8 228 $ECHO "Activate-on-demand: Yes; idle timeout = $D seconds"
pankso@8 229 fi
pankso@8 230
pankso@8 231 if [ "$DNS1" != "" ] ; then
pankso@8 232 if [ "$DNS1" = "server" ] ; then
pankso@8 233 $ECHO "DNS addresses: Supplied by ISP's server"
pankso@8 234 else
pankso@8 235 $ECHO "Primary DNS: $DNS1"
pankso@8 236 if [ "$DNS2" != "" ] ; then
pankso@8 237 $ECHO "Secondary DNS: $DNS2"
pankso@8 238 fi
pankso@8 239 fi
pankso@8 240 else
pankso@8 241 $ECHO "DNS: Do not adjust"
pankso@8 242 fi
pankso@8 243 $ECHO "Firewalling: $FIREWALL"
pankso@8 244 $ECHO ""
pankso@8 245 while [ true ] ; do
pankso@8 246 printf "%s" '>>> Accept these settings and adjust configuration files (y/n)? '
pankso@8 247 read ANS
pankso@8 248 case "ANS" in
pankso@8 249 Y|y|yes|Yes|oui|Oui)
pankso@8 250 ANS=y
pankso@8 251 ;;
pankso@8 252 N|n|no|No|non|Non)
pankso@8 253 ANS=n
pankso@8 254 ;;
pankso@8 255 esac
pankso@8 256 if [ "$ANS" = "y" -o "$ANS" = "n" ] ; then
pankso@8 257 break
pankso@8 258 fi
pankso@8 259 done
pankso@8 260 if [ "$ANS" = "y" ] ; then
pankso@8 261 break
pankso@8 262 fi
pankso@8 263 done
pankso@8 264
pankso@8 265 # Adjust configuration files. First to $CONFIG
pankso@8 266
pankso@8 267 $ECHO "Adjusting $CONFIG"
pankso@8 268
pankso@8 269 copy $CONFIG $CONFIG-bak
pankso@8 270 if [ "$DNS1" = "server" ] ; then
pankso@8 271 DNSTYPE=SERVER
pankso@8 272 DNS1=""
pankso@8 273 PEERDNS=yes
pankso@8 274 else
pankso@8 275 PEERDNS=no
pankso@8 276 if [ "$DNS1" = "" ] ; then
pankso@8 277 DNSTYPE=NOCHANGE
pankso@8 278 else
pankso@8 279 DNSTYPE=SPECIFY
pankso@8 280 fi
pankso@8 281 fi
pankso@8 282
pankso@8 283 # Where is pppd likely to put its pid?
pankso@8 284 if [ -d /var/run ] ; then
pankso@8 285 VARRUN=/var/run
pankso@8 286 else
pankso@8 287 VARRUN=/etc/ppp
pankso@8 288 fi
pankso@8 289
pankso@8 290 # Some #$(*& ISP's use a slash in the user name...
pankso@8 291 sed -e "s&^USER=.*&USER='$U'&" \
pankso@8 292 -e "s&^ETH=.*&ETH='$E'&" \
pankso@8 293 -e "s&^PIDFILE=.*&PIDFILE=\"$VARRUN/\$CF_BASE-pppoe.pid\"&" \
pankso@8 294 -e "s/^FIREWALL=.*/FIREWALL=$FIREWALL/" \
pankso@8 295 -e "s/^DEMAND=.*/DEMAND=$D/" \
pankso@8 296 -e "s/^DNSTYPE=.*/DNSTYPE=$DNSTYPE/" \
pankso@8 297 -e "s/^DNS1=.*/DNS1=$DNS1/" \
pankso@8 298 -e "s/^DNS2=.*/DNS2=$DNS2/" \
pankso@8 299 -e "s/^PEERDNS=.*/PEERDNS=$PEERDNS/" \
pankso@8 300 < $CONFIG-bak > $CONFIG
pankso@8 301
pankso@8 302 if [ $? != 0 ] ; then
pankso@8 303 $ECHO "** Error modifying $CONFIG"
pankso@8 304 $ECHO "** Quitting"
pankso@8 305 exit 1
pankso@8 306 fi
pankso@8 307
pankso@8 308 if [ "$DNS1" != "" ] ; then
pankso@8 309 if [ "$DNS1" != "server" ] ; then
pankso@8 310 $ECHO "Adjusting /etc/resolv.conf"
pankso@8 311 if [ -r /etc/resolv.conf ] ; then
pankso@8 312 grep -s "MADE-BY-RP-PPPOE" /etc/resolv.conf > /dev/null 2>&1
pankso@8 313 if [ "$?" != 0 ] ; then
pankso@8 314 $ECHO " (But first backing it up to /etc/resolv.conf-bak)"
pankso@8 315 copy /etc/resolv.conf /etc/resolv.conf-bak
pankso@8 316 fi
pankso@8 317 fi
pankso@8 318 $ECHO "# MADE-BY-RP-PPPOE" > /etc/resolv.conf
pankso@8 319 $ECHO "nameserver $DNS1" >> /etc/resolv.conf
pankso@8 320 if [ "$DNS2" != "" ] ; then
pankso@8 321 $ECHO "nameserver $DNS2" >> /etc/resolv.conf
pankso@8 322 fi
pankso@8 323 fi
pankso@8 324 fi
pankso@8 325
pankso@8 326 $ECHO "Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets"
pankso@8 327 if [ -r /etc/ppp/pap-secrets ] ; then
pankso@8 328 $ECHO " (But first backing it up to /etc/ppp/pap-secrets-bak)"
pankso@8 329 copy /etc/ppp/pap-secrets /etc/ppp/pap-secrets-bak
pankso@8 330 else
pankso@8 331 cp /dev/null /etc/ppp/pap-secrets-bak
pankso@8 332 fi
pankso@8 333 if [ -r /etc/ppp/chap-secrets ] ; then
pankso@8 334 $ECHO " (But first backing it up to /etc/ppp/chap-secrets-bak)"
pankso@8 335 copy /etc/ppp/chap-secrets /etc/ppp/chap-secrets-bak
pankso@8 336 else
pankso@8 337 cp /dev/null /etc/ppp/chap-secrets-bak
pankso@8 338 fi
pankso@8 339
pankso@8 340 egrep -v "^$U|^\"$U\"" /etc/ppp/pap-secrets-bak > /etc/ppp/pap-secrets
pankso@8 341 $ECHO "\"$U\" * \"$PWD1\"" >> /etc/ppp/pap-secrets
pankso@8 342 egrep -v "^$U|^\"$U\"" /etc/ppp/chap-secrets-bak > /etc/ppp/chap-secrets
pankso@8 343 $ECHO "\"$U\" * \"$PWD1\"" >> /etc/ppp/chap-secrets
pankso@8 344
pankso@8 345 $ECHO ""
pankso@8 346 $ECHO ""
pankso@8 347 $ECHO ""
pankso@8 348 $ECHO "Congratulations, it should be all set up!"
pankso@8 349 $ECHO ""
pankso@8 350 $ECHO "Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring"
pankso@8 351 $ECHO "it down. Type 'pppoe-status' to see the link status."
pankso@8 352 exit 0