Author: alexander
Date: 2005-10-09 05:25:29 -0600 (Sun, 09 Oct 2005)
New Revision: 902

Added:
   branches/utf8-newmake/etc/ppp/peers/pppoe
Modified:
   branches/utf8-newmake/Makefile
   branches/utf8-newmake/doc/README
   branches/utf8-newmake/initramfs/Makefile
   branches/utf8-newmake/packages/binutils/Makefile
   branches/utf8-newmake/packages/firefox/Makefile
   branches/utf8-newmake/packages/gpm/Makefile
   branches/utf8-newmake/packages/ncurses/Makefile
   branches/utf8-newmake/packages/util-linux/Makefile
   branches/utf8-newmake/scripts/functions
   branches/utf8-newmake/scripts/net-setup
Log:
Merged various fixes from trunk


Modified: branches/utf8-newmake/Makefile
===================================================================
--- branches/utf8-newmake/Makefile      2005-10-09 09:57:24 UTC (rev 901)
+++ branches/utf8-newmake/Makefile      2005-10-09 11:25:29 UTC (rev 902)
@@ -1,11 +1,11 @@
 #
 # Makefiles for automating the LFS LiveCD build
 #
-# Written by Jeremy Huntwork | [EMAIL PROTECTED]
+# Written by Jeremy Huntwork | jhuntwork AT linuxfromscratch DOT org
 # Several additions and edits by Alexander Patrakov, Justin Knierim and
 # Thomas Pegg
 #
-# Version for x86 arch using LFS 6.2
+# These scripts are published under the GNU General Public License, version 2
 #
 #==============================================================================
 #
@@ -73,11 +73,15 @@
 #==============================================================================
 ifeq ($(LFS-ARCH),x86)
 export CFLAGS := -Os -s -march=i486
-export CXXFLAGS := $(CFLAGS)
-else
+endif
+ifeq ($(LFS-ARCH),sparc)
+export CFLAGS := -Os -s -mcpu=v8 -mtune=v8
+endif
+ifeq ($(LFS-ARCH),ppc)
 export CFLAGS := -Os -s
+endif
 export CXXFLAGS := $(CFLAGS)
-endif
+
 export chbash-pre-bash := SHELL=$(WD)/bin/bash
 export chbash-post-bash := SHELL=/bin/bash
 export WHICH= $(WD)/bin/which
@@ -123,6 +127,7 @@
        @su - lfs -c "$(lfsenv) '$(lfsbash) && $(MAKE) tools'"
        @touch $(PKG)/wget/.pass2
        @make prep-chroot
+       @-mkdir $(MP)/etc
        @install -m644 -oroot -groot $(ROOT)/etc/{group,passwd} $(MP)/etc
        @-mkdir $(MP)/bin
        @if [ ! -f $(MP)/bin/bash ] ; then if [ ! -d $(MP) ] ; then \

Modified: branches/utf8-newmake/doc/README
===================================================================
--- branches/utf8-newmake/doc/README    2005-10-09 09:57:24 UTC (rev 901)
+++ branches/utf8-newmake/doc/README    2005-10-09 11:25:29 UTC (rev 902)
@@ -1,7 +1,7 @@
 This is version [version] of the official Linux From Scratch LiveCD.
 
 PACKAGES
-================
+===========================
 Available packages on this cd for your use:
 
 Xorg (X Window System Environment)
@@ -51,12 +51,15 @@
 * gpm (console mouse)
 * pciutils
 * mdadm
+* LVM2
+* hdparm
+* xlockmore
 
 nALFS & ALFS profile for LFS 6.1
 (A tool for automating a Linux From Scratch installation)
 
 CONFIGURING X
-================
+===========================
 The Live CD attempts to configure X for your video card automatically. The
 process may fail if you have more than one video card, or if your video card
 doesn't support 24-bit color depth.
@@ -75,7 +78,7 @@
 read 'exec ion -i18n' or 'exec twm'.
 
 CUSTOMIZING THE CD CONTENTS
-================
+===========================
 It is possible to burn a customized version of the official Linux From
 Scratch LiveCD, with your own files added. To do that, follow the
 instructions below.
@@ -101,7 +104,7 @@
 
 
 AUTOSSHD
-================
+============================
 It is possible to start the sshd daemon automatically upon boot. To do that,
 you have to customize the CD as described above. Add the following files:
 
@@ -184,7 +187,7 @@
 languages. No additional configuration is required in order to use them.
 
 THANKS
-================
+===========================
 Special thanks to Alexander Patrakov, Andrew Sanch, Archaic, Matthew Burgess,
 Kevin Fleming, Jim Gifford, Justin Knierim, Robert Connolly, Bruce Dubbs,
 Roel Neefs and the many others in the LFS community whose suggestions & support

Added: branches/utf8-newmake/etc/ppp/peers/pppoe
===================================================================
--- branches/utf8-newmake/etc/ppp/peers/pppoe   2005-10-09 09:57:24 UTC (rev 
901)
+++ branches/utf8-newmake/etc/ppp/peers/pppoe   2005-10-09 11:25:29 UTC (rev 
902)
@@ -0,0 +1,10 @@
+plugin rp-pppoe.so
+eth0
+user "jdoe"
+noauth
+hide-password 
+debug
+defaultroute
+noipdefault 
+usepeerdns
+remotename pppoe

Modified: branches/utf8-newmake/initramfs/Makefile
===================================================================
--- branches/utf8-newmake/initramfs/Makefile    2005-10-09 09:57:24 UTC (rev 
901)
+++ branches/utf8-newmake/initramfs/Makefile    2005-10-09 11:25:29 UTC (rev 
902)
@@ -16,7 +16,8 @@
        'cd $(ROOT) && make ch-$(NM) $(chbash-post-bash)'
 
 stage2: Makefile
-       make compile-$@
+       @make compile-$@
+       @touch $@
 
 compile-stage2: init
        mkdir -p $(WDIR)/{dev,bin,.tmpfs,.union}

Modified: branches/utf8-newmake/packages/binutils/Makefile
===================================================================
--- branches/utf8-newmake/packages/binutils/Makefile    2005-10-09 09:57:24 UTC 
(rev 901)
+++ branches/utf8-newmake/packages/binutils/Makefile    2005-10-09 11:25:29 UTC 
(rev 902)
@@ -35,7 +35,7 @@
         make -C ld install && \
         SPECFILE=`dirname $$(gcc -print-libgcc-file-name)`/specs && \
         gcc -dumpspecs > $$SPECFILE && \
-         sed '[EMAIL PROTECTED]/lib/$(LINKER)@$(WD)&@g' $$SPECFILE > 
tempspecfile && \
+         sed 's@/lib/$(LINKER)@$(WD)&@g' $$SPECFILE > tempspecfile && \
          mv -f tempspecfile $$SPECFILE && unset SPECFILE && \
          GCC_INCLUDEDIR=`dirname $$(gcc -print-libgcc-file-name)`/include && \
         find $${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rf '{}' \; && 
\
@@ -45,7 +45,7 @@
        touch $@
 
 
-pass2: $(FILE)
+pass2: $(FILE) 
        $(sep_dir_build_noclean)
 
 
@@ -68,7 +68,7 @@
         make -C ld INSTALL=$(WD)/bin/install install && \
         SPECFILE=`dirname $$(gcc -print-libgcc-file-name)`/specs && \
         gcc -dumpspecs > $$SPECFILE && \
-        sed -i '[EMAIL PROTECTED](WD)/lib/$(LINKER)@/lib/$(LINKER)@g' 
$$SPECFILE && \
+        sed -i '[EMAIL PROTECTED](WD)/lib/$(LINKER)@/lib/$(LINKER)@g' 
$$SPECFILE && \
         unset SPECFILE ; fi
        make clean
        touch $@

Modified: branches/utf8-newmake/packages/firefox/Makefile
===================================================================
--- branches/utf8-newmake/packages/firefox/Makefile     2005-10-09 09:57:24 UTC 
(rev 901)
+++ branches/utf8-newmake/packages/firefox/Makefile     2005-10-09 11:25:29 UTC 
(rev 902)
@@ -39,7 +39,6 @@
        make -f client.mk build
        make -f client.mk install
        cp -ra $(ROOT)/root/.mozilla /root
-       mkdir -p /usr/lib/$(NM)-$(VRS)/plugins
        ln -sf /usr/lib/mozilla/plugins/libmozsvgdec.{so,a} \
         /usr/lib/$(NM)-$(VRS)/plugins
 

Modified: branches/utf8-newmake/packages/gpm/Makefile
===================================================================
--- branches/utf8-newmake/packages/gpm/Makefile 2005-10-09 09:57:24 UTC (rev 
901)
+++ branches/utf8-newmake/packages/gpm/Makefile 2005-10-09 11:25:29 UTC (rev 
902)
@@ -28,6 +28,7 @@
        $(std_build)
 
 compile-stage2:
+ifneq ($(LFS-ARCH),sparc)
        patch -Np1 -i ../$(PATCH1)
        patch -Np1 -i ../$(PATCH2)
        ./configure --prefix=/usr --sysconfdir=/etc \
@@ -36,6 +37,7 @@
        make install
        cp conf/gpm-root.conf /etc
        /sbin/ldconfig
+endif
 
 clean:
        -rm -rf $(DIR)

Modified: branches/utf8-newmake/packages/ncurses/Makefile
===================================================================
--- branches/utf8-newmake/packages/ncurses/Makefile     2005-10-09 09:57:24 UTC 
(rev 901)
+++ branches/utf8-newmake/packages/ncurses/Makefile     2005-10-09 11:25:29 UTC 
(rev 902)
@@ -50,13 +50,13 @@
        zcat ../$(PATCH3) | patch -Np1
 # The non-wide library is for commercial software only => not for the Live CD
 #      ./configure --prefix=/usr --with-shared --without-normal \
-#          --without-debug --with-gpm --without-cxx-binding
+#          --without-debug --without-cxx-binding
 #      make sources
 #      make $(PM) libs
 #      cp -av lib/lib*.so.5* /usr/lib
 #      make distclean
        ./configure --prefix=/usr --with-shared --without-debug \
-           --with-gpm --enable-widec --without-cxx-binding
+           --enable-widec --without-cxx-binding
        make sources
        make $(PM)
        make install

Modified: branches/utf8-newmake/packages/util-linux/Makefile
===================================================================
--- branches/utf8-newmake/packages/util-linux/Makefile  2005-10-09 09:57:24 UTC 
(rev 901)
+++ branches/utf8-newmake/packages/util-linux/Makefile  2005-10-09 11:25:29 UTC 
(rev 902)
@@ -12,16 +12,34 @@
 URL-$(PATCH1)= $(HTTP)/$(NM)/$(PATCH1)
 SHA-$(PATCH1)= 00f5192493b939c2c996df9c1f3f769abfa3fa8c
 
+PATCH31= $(DIR)-gcc4_fixes-1.patch
+URL-$(PATCH31)= 
http://www.linuxfromscratch.org/patches/downloads/$(NM)/$(PATCH31)
+SHA-$(PATCH31)= 638972c2f2b09cf20aac60ede91e803a96cea4d9
+
+STAGE1_DEPS = $(FILE)
+STAGE2_DEPS = $(FILE) $(PATCH1)
+
+ifeq ($(LFS-ARCH),sparc)
+STAGE1_DEPS+= $(PATCH31)
+STAGE2_DEPS+= $(PATCH31)
+endif
+
 # Targets
 
 include $(ROOT)/scripts/functions
 
-stage1: $(FILE)
+stage1: $(STAGE1_DEPS)
        $(std_build)
        cp $(SRC)/$(FILE) $(LFSSRC)
+ifeq ($(LFS-ARCH),sparc)
+       cp $(SRC)/$(PATCH31) $(LFSSRC)
+endif
 
 compile-stage1:
        sed -i 's@/usr/[EMAIL PROTECTED](WD)/[EMAIL PROTECTED]' configure
+ifeq ($(LFS-ARCH),sparc)
+       patch -Np1 -i ../$(PATCH31)
+endif
        ./configure
        make -C lib
        make -C mount mount umount
@@ -32,7 +50,7 @@
        chroot "$(MP)" $(chenv-post-bash) \
        'cd $(ROOT) && make ch-$(NM) $(chbash-post-bash)'
 
-stage2: Makefile $(FILE) $(PATCH1)
+stage2: Makefile $(STAGE2_DEPS)
        $(std_build)
        cp $(SRC)/$(PATCH1) $(LFSSRC)/
 
@@ -40,6 +58,9 @@
        sed -i '[EMAIL PROTECTED]/[EMAIL PROTECTED]/lib/hwclock/[EMAIL 
PROTECTED]' hwclock/hwclock.c
        mkdir -p /var/lib/hwclock
        patch -Np1 -i ../$(PATCH1)
+ifeq ($(LFS-ARCH),sparc)
+       patch -Np1 -i ../$(PATCH31)
+endif
        ./configure
        make $(PM) HAVE_KILL=yes HAVE_SLN=yes
        make HAVE_KILL=yes HAVE_SLN=yes install

Modified: branches/utf8-newmake/scripts/functions
===================================================================
--- branches/utf8-newmake/scripts/functions     2005-10-09 09:57:24 UTC (rev 
901)
+++ branches/utf8-newmake/scripts/functions     2005-10-09 11:25:29 UTC (rev 
902)
@@ -42,7 +42,7 @@
 endef
 
 define sep_dir_build_noclean
-       @$(call echo_message,Building)
+       @$(call echo_message, Building)
        @unpack $(FILE) >$(DIR)[EMAIL PROTECTED] 2>&1
        @rm -rf $(NM)-build >>$(DIR)[EMAIL PROTECTED] 2>&1
        @mkdir -v $(NM)-build >>$(DIR)[EMAIL PROTECTED] 2>&1

Modified: branches/utf8-newmake/scripts/net-setup
===================================================================
--- branches/utf8-newmake/scripts/net-setup     2005-10-09 09:57:24 UTC (rev 
901)
+++ branches/utf8-newmake/scripts/net-setup     2005-10-09 11:25:29 UTC (rev 
902)
@@ -6,7 +6,7 @@
 #
 # Written by Jeremy Huntwork 09.17.2004
 # Additional features by Justin Knierim with the help
-#   of Alexander Patrakov 08.08.05
+#   of Alexander Patrakov
 #
 
 # Locations of network configs, ifup and ifdown
@@ -14,12 +14,6 @@
 IFUP=$DIR/ifup
 IFDOWN=$DIR/ifdown
 
-# Set variables after network device is selected
-set_devvars(){
-       ETHXCFG=$DIR/ifconfig.$DEV
-       LINKTEST=`/sbin/ip link show $DEV 2> /dev/null`
-}
-
 # Form to enter nameservers for /etc/resolv.conf
 set_dns(){
        DLG_COMMAND="dialog --title \"DNS Servers - /etc/resolv.conf\" 
--no-cancel \
@@ -29,44 +23,37 @@
        \"Server 3:\" 3 1 \"$F_DNS3\" 3 25 15 0"
        SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
-       STATUS=$?
-       if [ "$STATUS" -ne 0 ] ; then
-               exit 1
-       fi
+       [ $? -eq 0 ] || exit 1
 
        unset F_DNS1 F_DNS2 F_DNS3
        eval "`echo "$SELECTION" | sed -e '1s,^,F_DNS1=",' -e '2s,^,F_DNS2=",' \
              -e '3s,^,F_DNS3=",' | sed -e 's,$,",'`"
 
        # Validate DNS IP addresses
-       DNS_OK=1
-       if [ -n "$F_DNS1" -a "${F_DNS1##?*.?*.?*.?*}" ] || \
-          [ -n "$F_DNS2" -a "${F_DNS2##?*.?*.?*.?*}" ] || \
-          [ -n "$F_DNS3" -a "${F_DNS3##?*.?*.?*.?*}" ] ; then
-                DNS_OK=0
-               DNS_ERRMSG="One of the entered IP addresses is not valid."
-        fi
+       unset ERRMSG
+       for addr in $F_DNS1 $F_DNS2 $F_DNS3 ; do
+          if [ -n "$addr" -a "${addr##?*.?*.?*.?*}" ] ; then
+               ERRMSG="$addr is not a valid IP address."
+           fi
+       done
 
-       if [ "$DNS_OK" -eq 1 ] ; then
+       if [ -z "$ERRMSG" ] ; then
                rm -f /etc/resolv.conf
-               [ -n "$F_DNS1" ] && echo "nameserver $F_DNS1" >> 
/etc/resolv.conf
-               [ -n "$F_DNS2" ] && echo "nameserver $F_DNS2" >> 
/etc/resolv.conf
-               [ -n "$F_DNS3" ] && echo "nameserver $F_DNS3" >> 
/etc/resolv.conf
+               for addr in $F_DNS1 $F_DNS2 $F_DNS3 ; do
+                  [ -n "$addr" ] && echo "nameserver $addr" >> /etc/resolv.conf
+               done
 
-               unset F_DNS1 F_DNS2 F_DNS3 SELECTION DLG_COMMAND STATUS
-               unset DNS_OK DNS_ERRMSG
+               unset F_DNS1 F_DNS2 F_DNS3 SELECTION DLG_COMMAND ERRMSG
        else
-               DLG_COMMAND="dialog --title \"DNS IP Validation Error\" \
-               --msgbox \"$DNS_ERRMSG\" 6 60"
-               eval $DLG_COMMAND
-               set_dns;        
+               dialog --title "Validation Error" --msgbox "$ERRMSG" 6 60
+               set_dns;
        fi
 }              
 
 # Setup IP address, prefix, gateway and broadcast
 set_static_cfg(){
-       # Default values (only apply on first run-through, meaning SIP_OK 
doesn't exist)
-       if [ -z "$SIP_OK" ] ; then
+       # Default values
+       if [ -z "$ERRMSG" ] ; then
                F_PREFIX=24
        fi
 
@@ -78,87 +65,75 @@
        \"Gateway:\" 4 1 \"$F_GATEWAY\" 4 25 15 0"
         SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
-        STATUS=$?
-        if [ "$STATUS" -ne 0 ] ; then
-                exit 1
-        fi
+        [ $? -eq 0 ] || exit 1
 
        unset F_IPADDR F_PREFIX F_BROADCAST F_GATEWAY
         eval "`echo "$SELECTION" | sed -e '1s,^,F_IPADDR=",' -e 
'2s,^,F_PREFIX=",' \
               -e '3s,^,F_BROADCAST=",' -e '4s,^,F_GATEWAY=",' | sed -e 
's,$,",'`"
 
         # Validate entries (Must give IP, prefix and broadcast.  Gateway 
optional.)
-        SIP_OK=1
+        unset ERRMSG
         if [ -n "$F_IPADDR" -a "${F_IPADDR##?*.?*.?*.?*}" ] || \
            [ -n "$F_BROADCAST" -a "${F_BROADCAST##?*.?*.?*.?*}" ] || \
            [ -n "$F_GATEWAY" -a "${F_GATEWAY##?*.?*.?*.?*}" ] ; then
-                SIP_OK=0
-               SIP_ERRMSG="One of the entered IP addresses or prefix is not 
valid."
+               ERRMSG="One of the entered IP addresses or prefix is not valid."
        fi
        if [ "$F_PREFIX" -lt 8 -o "$F_PREFIX" -gt 30 ] ; then
-               SIP_OK=0
-               SIP_ERRMSG="The prefix is not valid.  Please enter a value from 
8 to 30."
+               ERRMSG="The prefix is not valid.  Please enter a value from 8 
to 30."
        fi
        if [ -z "$F_IPADDR" -o -z "$F_BROADCAST" -o -z "$F_PREFIX" ] ; then
-               SIP_OK=0
-               SIP_ERRMSG="Please enter an IP address, broadcast and prefix."  
        
+               ERRMSG="Please enter an IP address, broadcast and prefix."      
        
         fi
 
-        if [ "$SIP_OK" -eq 1 ] ; then
+        if [ -z "$ERRMSG" ] ; then
                 echo "IP=$F_IPADDR" >> $ETHXCFG
                echo "PREFIX=$F_PREFIX" >> $ETHXCFG
                echo "BROADCAST=$F_BROADCAST" >> $ETHXCFG
                [ -n "$F_GATEWAY" ] && echo "GATEWAY=$F_GATEWAY" >> $ETHXCFG
 
-                unset F_IPADDR F_PREFIX F_BROADCAST F_GATEWAY DLG_COMMAND 
STATUS
-                unset SELECTION SIP_OK SIP_ERRMSG
+                unset F_IPADDR F_PREFIX F_BROADCAST F_GATEWAY DLG_COMMAND
+                unset SELECTION ERRMSG
        else
-                DLG_COMMAND="dialog --title \"Static IP Validation Error\" \
-                --msgbox \"$SIP_ERRMSG\" 6 60"
-                eval $DLG_COMMAND
+               dialog --title "Validation Error" --msgbox "$ERRMSG" 6 60
                 set_static_cfg;
        fi
 }
 
 # GPRS Device options
 set_gprs_cfg(){
-        # Default values (only apply on first run-through, meaning GPRS_OK 
doesn't exist)
-        if [ -z "$GPRS_OK" ] ; then
+        # Default values
+        if [ -z "$ERRMSG" ] ; then
                 F_DEVICE=/dev/ttyS1
                 F_SPEED=115200
                F_SETTING=1
         fi
 
         DLG_COMMAND="dialog --title \"GPRS Device Configuration\" --no-cancel \
-        --form \"Please enter the GPRS device details below. The default value 
for the setting number is 1.\" 0 0 4 \
+        --form \"Please enter the GPRS device details below.\" 0 0 4 \
         \"APN:\" 1 1 \"$F_APN\" 1 25 30 0 \
         \"Device:\" 2 1 \"$F_DEVICE\" 2 25 20 0 \
         \"Speed:\" 3 1 \"$F_SPEED\" 3 25 10 0 \
        \"Setting Number:\" 4 1 \"$F_SETTING\" 4 25 4 0"
         SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
-        STATUS=$?
-        if [ "$STATUS" -ne 0 ] ; then
-                exit 1
-        fi
+       [ $? -eq 0 ] || exit 1
 
        unset F_APN F_DEVICE F_SPEED F_SETTING
         eval "`echo "$SELECTION" | sed -e '1s,^,F_APN=",' -e 
'2s,^,F_DEVICE=",' \
               -e '3s,^,F_SPEED=",' -e '4s,^,F_SETTING=",' | sed -e 's,$,",'`"
 
         # Validate entries (All values are required.)
-        GPRS_OK=1
+        unset ERRMSG
        if [ -z "$F_APN" -o -z "$F_DEVICE" -o -z "$F_SPEED" -o -z "$F_SETTING" 
] ; then
-               GPRS_OK=0
-               GPRS_ERRMSG="All fields are required to setup your GPRS device."
+               ERRMSG="All fields are required to setup your GPRS device."
        fi
 
-        if [ "$GPRS_OK" -eq 1 ] ; then
+        if [ -z "$ERRMSG" ] ; then
                # Make a backup and restore before changes, so the sed's work 
correctly.
-               [ -f /etc/ppp/peers/gprs.orig ] || cp /etc/ppp/peers/gprs 
/etc/ppp/peers/gprs.orig
-               [ -f /etc/ppp/gprs.chat.orig ] || cp /etc/ppp/gprs.chat 
/etc/ppp/gprs.chat.orig
-               cp /etc/ppp/peers/gprs.orig /etc/ppp/peers/gprs
-               cp /etc/ppp/gprs.chat.orig /etc/ppp/gprs.chat
+               [ -f /etc/ppp/peers/gprs.orig ] || cp 
/etc/ppp/peers/gprs{,.orig}
+               [ -f /etc/ppp/gprs.chat.orig ] || cp /etc/ppp/gprs.chat{,.orig}
+               cp /etc/ppp/peers/gprs{.orig,}
+               cp /etc/ppp/gprs.chat{.orig,}
 
                # Alter /etc/ppp/peers/gprs file.
                sed -i -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" -e 
"s@/dev/[EMAIL PROTECTED]@g" \
@@ -168,20 +143,18 @@
                sed -i -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" \
                        -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" 
/etc/ppp/gprs.chat
 
-                unset F_APN F_DEVICE F_SPEED F_SETTING DLG_COMMAND STATUS
-                unset SELECTION GPRS_OK GPRS_ERRMSG
+                unset F_APN F_DEVICE F_SPEED F_SETTING DLG_COMMAND
+                unset SELECTION ERRMSG
         else
-                DLG_COMMAND="dialog --title \"GPRS Validation Error\" \
-                --msgbox \"$GPRS_ERRMSG\" 6 60"
-                eval $DLG_COMMAND
+               dialog --title "Validation Error" --msgbox "$ERRMSG" 6 60
                 set_gprs_cfg;
         fi
 }
 
 # Modem Device options
 set_modem_cfg(){
-        # Default values (only apply on first run-through, meaning MODEM_OK 
doesn't exist)
-        if [ -z "$MODEM_OK" ] ; then
+        # Default values
+        if [ -z "$ERRMSG" ] ; then
                 F_DEVICE=/dev/ttyS1
                 F_SPEED=115200
         fi
@@ -195,48 +168,74 @@
         \"Speed:\" 5 1 \"$F_SPEED\" 5 25 10 0"
         SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
-        STATUS=$?
-        if [ "$STATUS" -ne 0 ] ; then
-                exit 1
-        fi
+        [ $? -eq 0 ] || exit 1
 
         unset F_PHONE F_USERNAME F_PASSWORD F_DEVICE F_SPEED
         eval "`echo "$SELECTION" | sed -e '1s,^,F_PHONE=",' -e 
'2s,^,F_USERNAME=",' \
               -e '3s,^,F_PASSWORD=",' -e '4s,^,F_DEVICE=",' -e 
'5s,^,F_SPEED=",' | sed -e 's,$,",'`"
 
         # Validate entries (All values except password are required.)
-        MODEM_OK=1
+        unset ERRMSG
         if [ -z "$F_PHONE" -o -z "$F_USERNAME" -o -z "$F_DEVICE" -o -z 
"$F_SPEED" ] ; then
-                MODEM_OK=0
-                MODEM_ERRMSG="The telephone number, username, device and speed 
are required fields."
+                ERRMSG="The telephone number, username, device and speed are 
required fields."
         fi
 
-        if [ "$MODEM_OK" -eq 1 ] ; then
+        if [ -z "$ERRMSG" ] ; then
                 # Make a backup and restore before changes, so the sed's work 
correctly.
-                [ -f /etc/ppp/peers/dialup.orig ] || cp /etc/ppp/peers/dialup 
/etc/ppp/peers/dialup.orig
-                [ -f /etc/ppp/pap-secrets.orig ] || cp /etc/ppp/pap-secrets 
/etc/ppp/pap-secrets.orig
-                cp /etc/ppp/peers/dialup.orig /etc/ppp/peers/dialup
-                cp /etc/ppp/pap-secrets.orig /etc/ppp/pap-secrets
+                [ -f /etc/ppp/peers/dialup.orig ] || cp 
/etc/ppp/peers/dialup{,.orig}
+                cp /etc/ppp/peers/dialup{.orig,}
 
                 # Alter /etc/ppp/peers/dialup file.
                 sed -i -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" -e 
"s@/dev/[EMAIL PROTECTED]@g" \
                        -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" -e "[EMAIL 
PROTECTED]"jdoe\"@\"$F_USERNAME\"@g" \
                       /etc/ppp/peers/dialup
 
-                # Alter /etc/ppp/pap-secrets
-               echo $F_USERNAME dialup $F_PASSWORD >> /etc/ppp/pap-secrets
-
-                unset F_PHONE F_USERNAME F_PASSWORD F_DEVICE F_SPEED 
DLG_COMMAND STATUS
-                unset SELECTION MODEM_OK MODEM_ERRMSG
+               setup_papsecrets;
+                
+               unset F_PHONE F_USERNAME F_PASSWORD F_DEVICE F_SPEED DLG_COMMAND
+                unset SELECTION ERRMSG
         else
-                DLG_COMMAND="dialog --title \"Modem Validation Error\" \
-                --msgbox \"$MODEM_ERRMSG\" 6 60"
-                eval $DLG_COMMAND
+               dialog --title "Modem Validation Error" --msgbox "$ERRMSG" 6 60
                 set_modem_cfg;
         fi
 }
 
-# Main Menu for Network Devices
+# pppoe device options
+set_pppoe_cfg(){
+        DLG_COMMAND="dialog --title \"Modem Configuration\" --no-cancel \
+        --form \"Please enter the modem details below:\" 0 0 2 \
+        \"User:\" 1 1 \"$F_USERNAME\" 2 25 30 0 \
+        \"Password:\" 2 1 \"$F_PASSWORD\" 3 25 30 0"
+        SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
+
+        [ $? -eq 0 ] || exit 1
+
+        unset F_USERNAME F_PASSWORD
+        eval "`echo "$SELECTION" | sed -e '1s,^,F_USERNAME=",' -e 
'2s,^,F_PASSWORD=",' | sed -e 's,$,",'`"
+
+       PPPOEUSER=$F_USERNAME
+        setup_papsecrets;
+
+       # Make a backup and restore before changes, so the sed's work correctly.
+       [ -f /etc/ppp/peers/pppoe.orig ] || cp /etc/ppp/peers/pppoe{,.orig}
+       cp /etc/ppp/peers/pppoe{.orig,}
+
+       # Alter /etc/ppp/peers/pppoe file.
+       sed -i -e "[EMAIL PROTECTED]@[EMAIL PROTECTED]" -e "[EMAIL 
PROTECTED]@[EMAIL PROTECTED]" /etc/ppp/peers/pppoe
+
+        unset F_USERNAME F_PASSWORD DLG_COMMAND SELECTION
+}
+
+# Common function to put user and password in pap-secrets
+setup_papsecrets(){
+       [ -f /etc/ppp/pap-secrets.orig ] || cp /etc/ppp/pap-secrets{,.orig}
+       cp /etc/ppp/pap-secrets{.orig,}
+
+       # Alter /etc/ppp/pap-secrets
+       echo $F_USERNAME dialup $F_PASSWORD >> /etc/ppp/pap-secrets
+}
+
+# Main Menu for network devices
 net_service_menu(){
        # Remove previous config, so ifup won't get confused.
        rm -f $ETHXCFG
@@ -259,16 +258,11 @@
                        echo "SERVICE=dhcpcd" > $ETHXCFG
                        echo "DHCP_START=\"\"" >> $ETHXCFG
                        echo "DHCP_STOP=\"-k\"" >> $ETHXCFG
-
-                       # Start the service
                        $IFUP $DEV
 
                        # Test if dhcp worked and did not set DNS.
-                       # If so run set_dns function.
                        if echo "$LINKTEST" | grep -q UP ; then                 
-                               if [ ! -f /etc/resolv.conf ] ; then
-                                       set_dns;
-                               fi
+                               [ -f /etc/resolv.conf ] || set_dns;
                                ip addr show $DEV
                        fi
                        ;;
@@ -281,7 +275,10 @@
                        ;;
        
                pppoe)
-                       adsl-setup
+                       set_pppoe_cfg;
+                       modprobe ppp ; modprobe pppoe
+                       ip link set $DEV up
+                       pppd plugin rp-pppoe.so $DEV user $PPPOEUSER noauth
                        ;;
                *)
                        exit 0
@@ -289,15 +286,15 @@
        esac
 }
 
-# Main Menu for ppp modem devices
-ppp_modem_menu(){
+# Main Menu for ppp devices
+ppp_menu(){
         unset ARGS
-        ARGS="$ARGS configure \"Configure your modem.\""
-        ARGS="$ARGS dial \"Dial modem and exit.\""
-        ARGS="$ARGS hangup \"Hang up modem and exit.\""
+        ARGS="$ARGS configure \"Configure your $DEV device.\""
+        ARGS="$ARGS dial \"Dial $DEV device and exit.\""
+        ARGS="$ARGS hangup \"Hang up $DEV device and exit.\""
 
-        DLG_COMMAND="dialog --title \"Modem - Actions\" --default-item 
configure \
-                --menu \"Select the action to perform for your modem:\" \
+        DLG_COMMAND="dialog --title \"$DEV device - Actions\" --default-item 
configure \
+                --menu \"Select the action to perform for your $DEV device:\" \
                 0 0 0 $ARGS"
         SERVICE=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
@@ -306,12 +303,13 @@
         case "$SERVICE" in
 
                 configure)
-                        set_modem_cfg;
+                       [ "$DEV" = "gprs" ] && set_modem_cfg;
+                       [ "$DEV" = "dialup" ] && set_gprs_cfg;
                         ;;
 
                 dial)
                         [ -e /dev/ppp ] || mknod /dev/ppp c 108 0
-                        modprobe ppp-generic ; pppd call dialup
+                        modprobe ppp-generic ; pppd call $DEV
                         exit 0
                         ;;
 
@@ -324,59 +322,15 @@
                         ;;
         esac
 
-        ppp_modem_menu;
+        ppp_menu;
 }
 
-# Main Menu for ppp gprs devices
-ppp_gprs_menu(){
-        unset ARGS
-        ARGS="$ARGS configure \"Configure your GPRS device.\""
-        ARGS="$ARGS dial \"Dial GPRS device and exit.\""
-        ARGS="$ARGS hangup \"Hang up GPRS device and exit.\""
-
-        DLG_COMMAND="dialog --title \"GPRS Device - Actions\" --default-item 
configure \
-                --menu \"Select the action to perform for your GPRS device:\" \
-                0 0 0 $ARGS"
-        SERVICE=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
-
-        unset DLG_COMMAND ARGS
-
-        case "$SERVICE" in
-
-                configure)
-                       set_gprs_cfg;
-                        ;;
-
-                dial)
-                       [ -e /dev/ppp ] || mknod /dev/ppp c 108 0 
-                       modprobe ppp-generic ; pppd call gprs
-                       exit 0
-                        ;;
-
-                hangup)
-                       killall pppd
-                       exit 0
-                        ;;
-                *)
-                        exit 0
-                        ;;
-        esac
-
-       ppp_gprs_menu;
-}
-
 # Script starts here. Check for root user.
 if [ `whoami` != "root" ] ; then
        echo "You must be root to use $0"
        exit 1;
 fi
 
-# Get list of devices and prompt user to select one
-if [ ! -d /sys/class/net ] ; then
-       echo "No devices found or sysfs not mounted!"
-       exit 1;
-fi
-
 for EDEV in /sys/class/net/eth* /sys/class/net/wlan* ; do
        EDEV=`basename $EDEV`
        if echo $EDEV | grep -q "*" ; then continue ; fi
@@ -387,7 +341,7 @@
        fi
        DEVLIST="$DEVLIST `basename $EDEV` \"$EDEVSTATUS\""
 done
-DEVLIST="$DEVLIST ppp-modem \"Configure a dial-up Modem\" ppp-gprs \"Configure 
a GPRS Modem\""
+DEVLIST="$DEVLIST dialup \"Configure a dial-up modem.\" gprs \"Configure a 
GPRS modem.\""
 
 DLG_COMMAND="dialog --title \"Network Configuration\" --default-item eth0 \
                --timeout 30 --menu \"Select the network device to configure:\" 
\
@@ -397,18 +351,17 @@
 
 # Continue if device was selected, exit if otherwise.
 if [ -n "$DEV" ] ; then
-       if [ "$DEV" == "ppp-modem" ] ; then
-               ppp_modem_menu;
+       if [ "$DEV" = "dialup" -o "$DEV" = "gprs" ] ; then
+               ppp_menu;
                exit 0
        fi
-       if [ "$DEV" == "ppp-gprs" ] ; then
-               ppp_gprs_menu;
-               exit 0
-       fi
+
+       ETHXCFG=$DIR/ifconfig.$DEV
+       LINKTEST=`/sbin/ip link show $DEV 2> /dev/null`
+
         # If the menu times out, activate eth0 with dhcpcd and exit.
-        if [ "$DEV" == "timeout" ] ; then
+        if [ "$DEV" = "timeout" ] ; then
                 DEV="eth0"
-                set_devvars;
                 rm -f $ETHXCFG
                 echo "SERVICE=dhcpcd" > $ETHXCFG
                 echo "DHCP_START=\"\"" >> $ETHXCFG
@@ -417,9 +370,6 @@
                 exit 0
         fi
        
-       # If not ppp-modem or ppp-gprs, then network device to configure
-       set_devvars;
-
        if [ -n "$LINKTEST" ] ; then
                # Link is up. Bring it down and start service menu.
                if echo "$LINKTEST" | grep -q UP ; then
@@ -428,9 +378,8 @@
 
                net_service_menu;
        else
-               DLG_COMMAND="dialog --title \"Device Not Found\" \
-                --msgbox \"Device $DEV is not present on this system.\" 6 60"
-                eval $DLG_COMMAND
+               dialog --title "Device Not Found" --msgbox \
+                "Device $DEV is not present on this system." 6 60
                exit 1
        fi
 fi

-- 
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to