From: ms Date: Tue, 3 Apr 2007 18:41:59 +0000 (+0000) Subject: Farbiger Bash-Prompt. X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=9520a3d09aca81139cbaac8078ee942ee55d0e6c Farbiger Bash-Prompt. PPPoE-Script zur Einwahl. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@475 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/etc/bashrc b/config/etc/bashrc index adf51876c..5a05df823 100644 --- a/config/etc/bashrc +++ b/config/etc/bashrc @@ -26,7 +26,8 @@ alias ls='ls --color=auto' # PS1 Environment Variable for a great case study behind this script # addendum.] -export PS1="[\u@\h \w]\\$ " +export PS1="\033[0m[\033[1;33m\u\033[1;37m@\033[1;32m\]\h \033[1;31m\w\033[0m]\\$ " +#export PS1="[\u@\h \w]\\$ " #export PS1='\u@\h:\w\$ ' # End /etc/bashrc diff --git a/src/initscripts/init.d/net/red/dhcpcd b/src/initscripts/init.d/net/common/dhcpcd similarity index 91% rename from src/initscripts/init.d/net/red/dhcpcd rename to src/initscripts/init.d/net/common/dhcpcd index ca5ea8099..f4f9218fe 100644 --- a/src/initscripts/init.d/net/red/dhcpcd +++ b/src/initscripts/init.d/net/common/dhcpcd @@ -30,11 +30,15 @@ case "$2" in exit 2 fi fi - /sbin/iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT - /sbin/iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT + if [ "$NAME" == "red" ]; then + /sbin/iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT + /sbin/iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT + fi + DHCP_START="-N -R -L /var/ipfire/dhcpc " + if [ -n "${DHCP_HOSTNAME}" ]; then - DHCP_START+="-h ${DHCP_HOSTNAME}" + DHCP_START+="-h ${DHCP_HOSTNAME} " fi /sbin/dhcpcd $1 $DHCP_START >/dev/null 2>&1 # Save the return value diff --git a/src/initscripts/init.d/net/ifup b/src/initscripts/init.d/net/ifup index 561a1e4f1..50dccc790 100644 --- a/src/initscripts/init.d/net/ifup +++ b/src/initscripts/init.d/net/ifup @@ -24,21 +24,7 @@ boot_mesg_flush ( eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) - # Loading the module if not already done... - if [ "$name" == "green" ]; then - modprobe ${GREEN_DRIVER} ${GREEN_DRIVER_OPTIONS} > /dev/null 2>&1 - DEVICE="${GREEN_DEV}" - elif [ "$name" == "blue" ]; then - modprobe ${BLUE_DRIVER} ${BLUE_DRIVER_OPTIONS} > /dev/null 2>&1 - DEVICE="${BLUE_DEV}" - elif [ "$name" == "orange" ]; then - modprobe ${ORANGE_DRIVER} ${ORANGE_DRIVER_OPTIONS} > /dev/null 2>&1 - DEVICE="${ORANGE_DEV}" - elif [ "$name" == "red" ]; then - DEVICE="${RED_DEV}" - fi - - # Check if interface is there... + # Check if an interface is there... if ip link show ${DEVICE} > /dev/null 2>&1; then link_status=`ip link show ${DEVICE} 2> /dev/null` if [ -n "${link_status}" ]; then @@ -55,34 +41,34 @@ boot_mesg_flush # Passing the variables to the script if [ "$name" == "green" ]; then - NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK}\ + NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \ NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \ /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up elif [ "$name" == "blue" ]; then - NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK}\ + NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \ NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \ /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up elif [ "$name" == "orange" ]; then - NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK}\ + NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \ NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \ /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up elif [ "$name" == "red" ]; then if [ "${RED_TYPE}" == "PPPOE" ]; then - echo + NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up elif [ "${RED_TYPE}" == "PPTP" ]; then echo elif [ "${RED_TYPE}" == "DHCP" ]; then NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \ PRINTIP=yes PRINTALL=yes \ - /etc/rc.d/init.d/net/red/dhcpcd ${RED_DEV} up + /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up elif [ "${RED_TYPE}" == "STATIC" ]; then - NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\ + NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \ NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \ DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} - /etc/rc.d/init.d/net/red/ipv4-static ${RED_DEV} up + /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up fi fi ) diff --git a/src/initscripts/init.d/net/red/pppoe b/src/initscripts/init.d/net/red/pppoe new file mode 100644 index 000000000..463fe2320 --- /dev/null +++ b/src/initscripts/init.d/net/red/pppoe @@ -0,0 +1,125 @@ +#!/bin/bash +######################################################################## +# Begin $network_devices/services/pppoe +# +# Description : PPPoE Script +# +# Authors : Michael Tremer - mitch@ipfire.org +# +# Version : 01.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings) + +case "${2}" in + up) + boot_mesg "Bringing up the PPPoE interface on ${1}..." + ip addr add 1.1.1.1/24 broadcast 1.1.1.255 dev ${1} + + if [ "${METHOD}" != "PPPOE_PLUGIN" ]; then + PPPCOMMAND="/usr/sbin/pppd pty" + PPPOECOMMAND="/usr/sbin/pppoe -p /var/run/pppoe.pid -I ${1} -T 80 -U -m 1412" + if [ -n ${SERVICENAME} ]; then + PPPOECOMMAND+=" -S ${SERVICENAME}" + fi + if [ -n ${CONCENTRATORNAME} ]; then + PPPOECOMMAND+=" -C ${CONCENTRATORNAME}" + fi + + if [ "${DNS}" == "Automatic" ]; then + ARGS+=" usepeerdns" + fi + + if [ "${AUTH}" == "pap" ]; then + ARGS+=" -chap" + elif [ "${AUTH}" == "chap" ]; then + ARGS+=" -pap" + fi + + if [ "${RECONNECTION}" != "persistent" ]; then + if [ "${TIMEOUT}" != "0" ]; then + SECONDS=$[${TIMEOUT} * 60] + ARGS+=" idle ${SECONDS}" + fi + if [ "${RECONNECTION}" == "dialondemand" ]; then + touch /var/ipfire/red/dial-on-demand + ARGS+=" demand nopersist connect /bin/true" + fi + ARGS+=" active-filter outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0" + fi + + ARGS+=" noipdefault default-asyncmap defaultroute hide-password local mtu 1492" + ARGS+=" mru 1492 noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp" + ARGS+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3 lcp-max-configure 50" + ARGS+=" maxfail ${MAXRETRIES}" + + if [ "${DEBUG}" == "on" ]; then + ARGS+=" debug" + fi + + $PPPCOMMAND "${PPPOECOMMAND}" $ARGS + evaluate_retval + + else + modprobe pppoe + PPPCOMMAND="/usr/sbin/pppd plugin rp-pppoe.so ${1}" + if [ "${DNS}" == "Automatic" ]; then + PPPCOMMAND+=" usepeerdns" + fi + + if [ "${AUTH}" == "pap" ]; then + PPPCOMMAND+=" -chap" + elif [ "${AUTH}" == "chap" ]; then + PPPCOMMAND+=" -pap" + fi + + if [ "${RECONNECTION}" != "persistent" ]; then + if [ "${TIMEOUT}" != "0" ]; then + SECONDS=$[${TIMEOUT} * 60] + PPPCOMMAND+=" idle ${SECONDS}" + fi + if [ "${RECONNECTION}" == "dialondemand" ]; then + touch /var/ipfire/red/dial-on-demand + PPPCOMMAND+=" demand nopersist" + fi + PPPCOMMAND+=" active-filter outbound and not icmp[0] == 3 & not tcp[13] & 4 != 0" + fi + + PPPCOMMAND+=" noipdefault defaultroute hide-password ipcp-accept-local" + PPPCOMMAND+=" ipcp-accept-remote passive noccp nopcomp novjccomp" + PPPCOMMAND+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3" + PPPCOMMAND+=" lcp-max-configure 50 maxfail ${MAXRETRIES}" + + if [ "${DEBUG}" == "on" ]; then + PPPCOMMAND+=" debug" + fi + + $PPPCOMMAND + evaluate_retval + fi + + ;; + + down) + boot_mesg "Bringing down the PPPoE interface on ${1}..." + + modprobe -r pppoe >/dev/null 2>&1 + killall pppd + sleep 2 + ip addr del 1.1.1.1/24 broadcast 1.1.1.255 dev ${1} + + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $network_devices/services/pppoe