Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
rebuilding Init.d files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Six22
n00b
n00b


Joined: 26 Jun 2002
Posts: 1

PostPosted: Wed Jun 26, 2002 1:55 am    Post subject: rebuilding Init.d files Reply with quote

Ok, I was silly(or stupid cuz i didn't simply rename it) and removed my net.eth0 from the /etc/init.d directory. Any way I got my networking up and going now(which was a kernel problem, not a config file problem) so I'd like to know how to rebuild that file and or files if its possible? Thanks.

Six22
Back to top
View user's profile Send private message
mksoft
l33t
l33t


Joined: 28 May 2002
Posts: 844

PostPosted: Wed Jun 26, 2002 7:36 am    Post subject: Reply with quote

By rebuild I guess you mean restore.

The installation doc in code listing 35 says:
Code:
# cd /etc/init.d
# cp net.eth0 net.ethx
# rc-update add net.ethx default


So, if you still have net.ethx in /etc/init.d you can copy simply copy it.

BTW, why you've deleted net.eth0 ? If all you wanted was to prevent it from loading on startup, you could've done:
Code:
rc-update del net.eth0 default

removing it from the default runlevel.
_________________
There's someone in my head but it's not me - Pink Floyd
Back to top
View user's profile Send private message
Utoxin
Guru
Guru


Joined: 19 Apr 2002
Posts: 413
Location: American Fork, UT

PostPosted: Wed Jun 26, 2002 7:55 am    Post subject: Reply with quote

Code:
# cd /etc/init.d
# cp net.eth0 net.ethx
# rc-update add net.ethx default

is only supposed to be done if you have more than one NIC to add. (eth1, eth2, etc.)
_________________
Gentoo:
1. A small fast penguin from Antarctica.
2. A small fast penguin on your computer.

Cool.
Back to top
View user's profile Send private message
mksoft
l33t
l33t


Joined: 28 May 2002
Posts: 844

PostPosted: Wed Jun 26, 2002 8:55 am    Post subject: Reply with quote

Oops sorry :oops:

Well, I deserve it for posting before having my coffee. Here's my net.eth0:
Code:
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.eth0,v 1.15 2002/05/10 21:57:44 azarah Exp $

#NB: Config is in /etc/conf.d/net


#for pcmcia users. note that pcmcia must be added to the same
#runlevel as the net.* script that needs it.
depend() {
   use pcmcia
}

checkconfig() {
   if [ -z "$(eval echo \$\{iface_${IFACE}\})" ]
   then
      eerror "Please make sure that /etc/conf.d/net has \$iface_$IFACE set"
      return 1
   fi
}

start() {
   checkconfig || return 1
   local iface_args="$(eval echo \$\{iface_${IFACE}\})"
   local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\})"
   local retval=0
   ebegin "Bringing ${IFACE} up"
   if [ "$(eval echo \$\{iface_${IFACE}\})" != "dhcp" ]
   then
      /sbin/ifconfig ${IFACE} ${iface_args} >/dev/null || {
         retval=$?
         eend ${retval} "Failed to bring ${IFACE} up"
         return ${retval}
      }
   else
      /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
         retval=$?
         eend ${retval} "Failed to bring ${IFACE} up"
         return ${retval}
      }
   fi
   eend 0

   if [ -n "$(eval echo \$\{alias_${IFACE}\})" ]
   then
      local x=""
      local num=0
      local aliasbcast=""
      local aliasnmask=""

      if [ -n  "`eval echo \$\{broadcast_${IFACE}\}`" ]
      then
         aliasbcast="broadcast `eval echo \$\{broadcast_${IFACE}\}`"
      fi

      if [ -n  "`eval echo \$\{netmask_${IFACE}\}`" ]
      then
         aliasnmask="netmask `eval echo \$\{netmask_${IFACE}\}`"
      fi
      
      ebegin "  Adding aliases"
      for x in $(eval echo \$\{alias_${IFACE}\})
      do
         ebegin "    ${IFACE}:${num}"
         /sbin/ifconfig ${IFACE}:${num} ${x} \
            ${aliasbcast} ${aliasnmask} >/dev/null
         num=$((num + 1))
         eend 0
      done
      save_options "alias" "$(eval echo \$\{alias_${IFACE}\})"
   fi
   
   if [ -n "${gateway}" ] && [ "${gateway%/*}" = "${IFACE}" ]
   then
      ebegin "  Setting default gateway"
      /sbin/route add default gw ${gateway#*/} dev ${gateway%/*} \
         netmask 0.0.0.0 metric 1 >/dev/null || {
         
         local error=$?
         ifconfig ${IFACE} down &>/dev/null
         eend ${error} "Failed to bring ${IFACE} up"
         return ${error}
      }
      eend 0
   fi

   #enabling rp_filter causes wacky packets to be auto-dropped by
   #the kernel

   if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
   then
      echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
   fi
}

stop() {
   local myalias="$(get_options alias)"
   ebegin "Bringing ${IFACE} down"
   #do some cleanup in case the amount of aliases change
   if [ -n "${myalias}" ]
   then
      local x=""
      local num=0
      for x in ${myalias}
      do
         /sbin/ifconfig ${IFACE}:${num} down &>/dev/null
         num=$((num + 1))
      done
   fi

   if [ "$(eval echo \$\{iface_${IFACE}\})" == "dhcp" ]
   then
      /sbin/dhcpcd -k ${IFACE} &>/dev/null
   
      # Give dhcpcd time to properly shutdown
      local count=0
      einfon "  Waiting for dhcpcd to shutdown"
      while [ "${count}" -lt 5 ]
      do
         echo -n "."
         sleep 1
         count=$((count + 1))
      done
      echo "done"
   else
      /sbin/ifconfig ${IFACE} down &>/dev/null
   fi
   eend 0
}


# vim:ts=4


Copy & paste, save as /etc/init.d/net.eth0 .
_________________
There's someone in my head but it's not me - Pink Floyd
Back to top
View user's profile Send private message
Utoxin
Guru
Guru


Joined: 19 Apr 2002
Posts: 413
Location: American Fork, UT

PostPosted: Wed Jun 26, 2002 8:57 am    Post subject: Reply with quote

Hee. That's okay. I'd just had a big bottle of The Elixer Of Life (aka Mountain Dew) so I was thinking clearly.
_________________
Gentoo:
1. A small fast penguin from Antarctica.
2. A small fast penguin on your computer.

Cool.
Back to top
View user's profile Send private message
mksoft
l33t
l33t


Joined: 28 May 2002
Posts: 844

PostPosted: Wed Jun 26, 2002 9:04 am    Post subject: Reply with quote

Utoxin wrote:
Hee. That's okay. I'd just had a big bottle of The Elixer Of Life (aka Mountain Dew) so I was thinking clearly.


Ahh, think I can use one of those, can you send me via eMail ;) I need my thinking cleared and I need it now :)
_________________
There's someone in my head but it's not me - Pink Floyd
Back to top
View user's profile Send private message
Utoxin
Guru
Guru


Joined: 19 Apr 2002
Posts: 413
Location: American Fork, UT

PostPosted: Wed Jun 26, 2002 9:08 am    Post subject: Reply with quote

I would, but I don't want to gum up my T1 connection with caffiene residue. Sorry. ;)
_________________
Gentoo:
1. A small fast penguin from Antarctica.
2. A small fast penguin on your computer.

Cool.
Back to top
View user's profile Send private message
mksoft
l33t
l33t


Joined: 28 May 2002
Posts: 844

PostPosted: Wed Jun 26, 2002 9:15 am    Post subject: Reply with quote

Utoxin wrote:
I would, but I don't want to gum up my T1 connection with caffiene residue. Sorry. ;)

:lol:

T1 :o,
Now I need alcohol ;) getting depressed (and off topic)
_________________
There's someone in my head but it's not me - Pink Floyd
Back to top
View user's profile Send private message
DArtagnan
l33t
l33t


Joined: 30 Apr 2002
Posts: 942
Location: Israel, Jerusalem

PostPosted: Wed Jun 26, 2002 9:21 am    Post subject: Reply with quote

Meir, 1000k/sec :-)
Sounds cool huh?
huji has a nice net conenction....
_________________
All for one and one for All
--

MACPRO machine...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum