Saturday, September 23, 2006
linux ifconfig compact output - part 2
Where to find the ifconfig source code?
Since Fedora Core is supposed to be open source,
it has got to be somewhere.
Turns out the Fedora home page
has a distribution page, and on that page,
there is a link to a mirror site.
Source SRPMs are available after all.
http://fedoraproject.org/wiki/Distribution
http://fedora.redhat.com/Download/mirrors.html
http://mirror.linux.duke.edu/pub/fedora/linux/core/5/source/SRPMS/
Which SRPM to get?
At the Fedora core 5 shell promt, find the path of ifconfig,
then find the package it belongs to.
Then assume that the SRPM has the same base name as the RPM.
which ifconfig
/sbin/ifconfig
rpm -qf /sbin/ifconfig
net-tools-1.60-62.1
So we need the net-tools SRPM.
wget http://mirror.linux.duke.edu/pub/fedora/linux/core/5/source/SRPMS/net-tools-1.60-62.1.src.rpm
It is a good idea to install RPM build tools as a non-privileged user.
yum install fedora-rpmdevtools
Then create an RPM build file directory structure:
fedora-buildrpmtree
After the above command, a file and a folder is created
in your homedir:
ls $HOME/.rpmmacros $HOME/rpmbuild
Then install the net-tools source
rpm --install net-tools-1.60-62.1.src.rpm
The above command install SRPMs in $HOME/rpmbuild
by default, no matter where your current working directory
is.
Then build the net-tools:
cd $HOME/rpmbuild/SPECS
rpmbuild -ba net-tools.spec
On my test PC, there are a lot of warnings,
but no fatal errors I could see. I got a new ifconfig
binary after a few seconds. Lets do a test:
$HOME/rpmbuild/BUILD/net-tools-1.60/ifconfig
Output is the same as that from /sbin/ifconfig.
Now all we have to figure out is where to make a few changes.
Since Fedora Core is supposed to be open source,
it has got to be somewhere.
Turns out the Fedora home page
has a distribution page, and on that page,
there is a link to a mirror site.
Source SRPMs are available after all.
http://fedoraproject.org/wiki/Distribution
http://fedora.redhat.com/Download/mirrors.html
http://mirror.linux.duke.edu/pub/fedora/linux/core/5/source/SRPMS/
Which SRPM to get?
At the Fedora core 5 shell promt, find the path of ifconfig,
then find the package it belongs to.
Then assume that the SRPM has the same base name as the RPM.
which ifconfig
/sbin/ifconfig
rpm -qf /sbin/ifconfig
net-tools-1.60-62.1
So we need the net-tools SRPM.
wget http://mirror.linux.duke.edu/pub/fedora/linux/core/5/source/SRPMS/net-tools-1.60-62.1.src.rpm
It is a good idea to install RPM build tools as a non-privileged user.
yum install fedora-rpmdevtools
Then create an RPM build file directory structure:
fedora-buildrpmtree
After the above command, a file and a folder is created
in your homedir:
ls $HOME/.rpmmacros $HOME/rpmbuild
Then install the net-tools source
rpm --install net-tools-1.60-62.1.src.rpm
The above command install SRPMs in $HOME/rpmbuild
by default, no matter where your current working directory
is.
Then build the net-tools:
cd $HOME/rpmbuild/SPECS
rpmbuild -ba net-tools.spec
On my test PC, there are a lot of warnings,
but no fatal errors I could see. I got a new ifconfig
binary after a few seconds. Lets do a test:
$HOME/rpmbuild/BUILD/net-tools-1.60/ifconfig
Output is the same as that from /sbin/ifconfig.
Now all we have to figure out is where to make a few changes.