Unbenutztes Nash geloescht.

Revert der tripwire.cgi
mISDN-Tools eingebaut und im Kernel aktualisiert.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@608 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-06-05 00:11:03 +00:00
parent afbda81596
commit 8bba296515
15 changed files with 108 additions and 3387 deletions

View File

@@ -0,0 +1,37 @@
usr/bin/isdnbridge
usr/bin/loadfirm
usr/bin/misdnportinfo
usr/bin/sendhwctrl
usr/bin/testcon
usr/bin/testcon_l2
usr/bin/testlayer1
usr/bin/testlayer3
usr/bin/testlib
usr/bin/tstlib
usr/bin/voipisdn
#usr/include/mISDNuser/asn1.h
#usr/include/mISDNuser/asn1_diversion.h
#usr/include/mISDNuser/bchannel.h
#usr/include/mISDNuser/fsm.h
#usr/include/mISDNuser/g711.h
#usr/include/mISDNuser/helper.h
#usr/include/mISDNuser/ibuffer.h
#usr/include/mISDNuser/isdn_debug.h
#usr/include/mISDNuser/isdn_msg.h
#usr/include/mISDNuser/isdn_net.h
#usr/include/mISDNuser/isound.h
#usr/include/mISDNuser/l3dss1.h
#usr/include/mISDNuser/mISDNlib.h
#usr/include/mISDNuser/net_l2.h
#usr/include/mISDNuser/net_l3.h
#usr/include/mISDNuser/suppserv.h
#usr/include/mISDNuser/tone.h
#usr/lib/libisdnnet.a
usr/lib/libisdnnet.so
#usr/lib/libisdnnet_pic.a
#usr/lib/libmISDN.a
usr/lib/libmISDN.so
#usr/lib/libmISDN_pic.a
#usr/lib/libsuppserv.a
usr/lib/libsuppserv.so
#usr/lib/libsuppserv_pic.a

View File

@@ -154,6 +154,7 @@
* logwatch_7.3.1
* lzo-2.02
* m4-1.4.4
* mISDNuser-1_1_3
* mailx-12.0
* make-3.80
* man-db-2.4.3

View File

@@ -114,10 +114,10 @@ if ($tripwiresettings{'ACTION'} eq 'addcron')
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<tr><td align='center' colspan='2'>HH<input type='text' size='2' name='HOUR' value='08'/>MM<input type='text' size='2' name='MINUTE' value='00'/><br /><br /></td></tr>
<tr><td align='right' width='50%'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='addcronyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -133,10 +133,10 @@ if ($tripwiresettings{'ACTION'} eq 'globalreset')
<tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'resetglobals'}</b>
<tr><td colspan='2' align='center'><font color=red>$Lang::tr{'defaultwarning'}<br /><br /></font></td></tr>
<tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='globalresetyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -154,10 +154,10 @@ if ($tripwiresettings{'ACTION'} eq 'generatepolicypw')
<tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'sitekey'}</td><td align='left'><input type='password' name='SITEKEY' value='$tripwiresettings{'SITEKEY'}' size="30" /></td></tr>
<tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
<tr><td align='right' width='50%'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' tilte='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='generatepolicyyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -175,10 +175,10 @@ if ($tripwiresettings{'ACTION'} eq 'policyresetpw')
<tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'sitekey'}</td><td align='left'><input type='password' name='SITEKEY' value='$tripwiresettings{'SITEKEY'}' size="30" /></td></tr>
<tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
<tr><td align='right' width='50%'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='resetpolicyyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -195,10 +195,10 @@ if ($tripwiresettings{'ACTION'} eq 'updatedatabasepw')
<tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningdatabase'}<br /><br /></font></td></tr>
<tr><td align='left' width='40%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'localkey'}</td><td align='left'><input type='password' name='LOCALKEY' value='$tripwiresettings{'LOCALKEY'}' size="30" /><br /><br /></td></tr>
<tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='updatedatabaseyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -213,10 +213,10 @@ if ($tripwiresettings{'ACTION'} eq 'keyreset')
<tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'keyreset'}</b>
<tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
<tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='keyresetyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -232,10 +232,10 @@ if ($tripwiresettings{'ACTION'} eq 'generatekeys')
<tr><td bgcolor='$color{'color20'}' colspan='2' align='center'><b>$Lang::tr{'generatekeys'}</b>
<tr><td colspan='2' align='center'><font color=red>$Lang::tr{'tripwirewarningkeys'}<br /><br /></font></td></tr>
<tr><td align='right' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
$Lang::tr{'ok'} <input type='image' alt='$Lang::tr{'ok'}' title='$Lang::tr{'ok'}' src='/images/edit-redo.png' />
<input type='hidden' name='ACTION' value='generatekeysyes' /></form></td>
<td align='left' width='50%'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='image' alt='$Lang::tr{'cancel'}' title='$Lang::tr{'cancel'}' src='/images/dialog-error.png' /> $Lang::tr{'cancel'}
<input type='hidden' name='ACTION' value='cancel' /></form></td>
</tr>
</table>
@@ -329,13 +329,13 @@ print <<END
<table width='10%' cellspacing='0'>
<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
<input type='image' alt='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td>
<input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='globalreset' />
<input type='image' alt='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
<input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='globalcaption' />
<input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
<input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
</table>
</from>
END
@@ -346,8 +346,8 @@ print <<END
<br />
<table width='95%' cellspacing='0'>
<tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
<tr><td align='right' width='33%'><img src='/images/media-floppy.png' /></td><td align='left'>$Lang::tr{'save settings'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' /></td><td align='left'>$Lang::tr{'restore settings'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/media-floppy.png' alt='$Lang::tr{'save settings'}' /></td><td align='left'>$Lang::tr{'save settings'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'restore settings'}' /></td><td align='left'>$Lang::tr{'restore settings'}</td></tr>
</table>
END
;
@@ -373,13 +373,13 @@ print <<END
<table width='10%' cellspacing='0'>
<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='generatekeys'/>
<input type='image' alt='$Lang::tr{'generatekeys'}' src='/images/system-lock-screen.png' /></form></td>
<input type='image' alt='$Lang::tr{'generatekeys'}' title='$Lang::tr{'generatekeys'}' src='/images/system-lock-screen.png' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='keyreset' />
<input type='image' alt='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
<input type='image' alt='$Lang::tr{'reset'}' title='$Lang::tr{'reset'}' src='/images/reload.gif' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='keycaption' />
<input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
<input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
</table>
</from>
END
@@ -390,8 +390,8 @@ print <<END
<br />
<table width='95%' cellspacing='0'>
<tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
<tr><td align='right' width='33%'><img src='/images/system-lock-screen.png' /></td><td align='left'>$Lang::tr{'generatekeys'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' /></td><td align='left'>$Lang::tr{'keyreset'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/system-lock-screen.png' alt='$Lang::tr{'generatekeys'}' /></td><td align='left'>$Lang::tr{'generatekeys'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'keyreset'}' /></td><td align='left'>$Lang::tr{'keyreset'}</td></tr>
</table>
END
;
@@ -410,19 +410,19 @@ print <<END
<table width='95%' cellspacing='0'>
<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='generatepolicypw'/>
<input type='image' alt='$Lang::tr{'generatepolicy'}' src='/images/document-new.png' /></form></td>
<input type='image' alt='$Lang::tr{'generatepolicy'}' title='$Lang::tr{'generatepolicy'}' src='/images/document-new.png' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='policyresetpw' />
<input type='image' alt='$Lang::tr{'resetpolicy'}' src='/images/reload.gif' /></form></td>
<input type='image' alt='$Lang::tr{'resetpolicy'}' title='$Lang::tr{'resetpolicy'}' src='/images/reload.gif' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='generatereport' />
<input type='image' alt='$Lang::tr{'generatereport'}' src='/images/document-properties.png' /></form></td>
<input type='image' alt='$Lang::tr{'generatereport'}' title='$Lang::tr{'generatereport'}' src='/images/document-properties.png' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='updatedatabasepw' />
<input type='image' alt='$Lang::tr{'updatedatabase'}' src='/images/network-server.png' /></form></td>
<input type='image' alt='$Lang::tr{'updatedatabase'}' title='$Lang::tr{'updatedatabase'}' src='/images/network-server.png' /></form></td>
<td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='policycaption' />
<input type='image' alt='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
<input type='image' alt='$Lang::tr{'caption'}' title='$Lang::tr{'caption'}' src='/images/help-browser.png' /></form></td></tr>
</table>
END
;
@@ -432,10 +432,10 @@ print <<END
<br />
<table width='95%' cellspacing='0'>
<tr><td align='center' colspan='2'><b>$Lang::tr{'caption'}</b></td></tr>
<tr><td align='right' width='33%'><img src='/images/document-new.png' /></td><td align='left'>$Lang::tr{'generatepolicy'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' /></td><td align='left'>$Lang::tr{'resetpolicy'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/document-properties.png' /></td><td align='left'>$Lang::tr{'generatereport'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/network-server.png' /></td><td align='left'>$Lang::tr{'updatedatabase'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/document-new.png' alt='$Lang::tr{'generatepolicy'}' /></td><td align='left'>$Lang::tr{'generatepolicy'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/reload.gif' alt='$Lang::tr{'resetpolicy'}' /></td><td align='left'>$Lang::tr{'resetpolicy'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/document-properties.png' alt='$Lang::tr{'generatereport'}' /></td><td align='left'>$Lang::tr{'generatereport'}</td></tr>
<tr><td align='right' width='33%'><img src='/images/network-server.png' alt='$Lang::tr{'updatedatabase'}' /></td><td align='left'>$Lang::tr{'updatedatabase'}</td></tr>
</table>
END
;
@@ -459,7 +459,7 @@ END
foreach my $log (@Logs) {chomp $log;print"<option value='$log'>$log</option>";}
print <<END
</select></td><td align='left'><input type='hidden' name='ACTION' value='showlog' /><input type='image' alt='view Log' src='/images/format-justify-fill.png' /></td></tr>
</select></td><td align='left'><input type='hidden' name='ACTION' value='showlog' /><input type='image' alt='view Log' title='view log' src='/images/format-justify-fill.png' /></td></tr>
</table>
</form>
END

View File

@@ -53,7 +53,7 @@ endif
# Top-level Rules
###############################################################################
objects =$(DL_FILE) \
mISDN-CVS-2007-01-26.tar.bz2 \
mISDN-1_1_3.tar.gz \
squashfs3.2-r2.tar.gz \
iptables-1.3.5.tar.bz2 \
patch-o-matic-ng-20061210.tar.bz2 \
@@ -67,7 +67,7 @@ iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
netfilter-layer7-v2.9.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.9.tar.gz
patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
squashfs3.2-r2.tar.gz = $(URL_IPFIRE)/squashfs3.2-r2.tar.gz
mISDN-CVS-2007-01-26.tar.bz2 = $(URL_IPFIRE)/mISDN-CVS-2007-01-26.tar.bz2
mISDN-1_1_3.tar.gz = $(URL_IPFIRE)/mISDN-1_1_3.tar.gz
openswan-2.5.13.tar.gz = $(URL_IPFIRE)/openswan-2.5.13.tar.gz
$(DL_FILE)_MD5 = cc2106c6188675187d636aa518b04958
@@ -77,7 +77,7 @@ iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
netfilter-layer7-v2.9.tar.gz_MD5 = ebf9043a5352ebe6dbd721989ef83dee
patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
squashfs3.2-r2.tar.gz_MD5 = bf360b92eba9e6d5610196ce2e02fcd1
mISDN-CVS-2007-01-26.tar.bz2_MD5 = 844c70dc851faffcae7549fd738c7b49
mISDN-1_1_3.tar.gz_MD5 = d29bcf48f16fc8a9b9f3552d111b308d
openswan-2.5.13.tar.gz_MD5 = b83a42ea00ee24ed34413bc122cada51
install : $(TARGET)
@@ -165,8 +165,8 @@ endif
# mISDN
cd $(DIR_SRC) && rm -rf mISDN-*
cd $(DIR_SRC) && tar xfj $(DIR_DL)/mISDN-CVS-2007-01-26.tar.bz2
cd $(DIR_SRC)/mISDN-CVS-2007-01-26 && yes 'yes' | ./std2kern -k /usr/src/linux
cd $(DIR_SRC) && tar xfz $(DIR_DL)/mISDN-1_1_3.tar.gz
cd $(DIR_SRC)/mISDN-1_1_3 && yes 'yes' | ./std2kern -k /usr/src/linux
ifeq "$(SMP)" ""
# Only do this once on the non-SMP pass

View File

@@ -26,9 +26,11 @@
include Config
VER = ipfire
VER = 1_1_3
THISAPP = nash
THISAPP = mISDNuser-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
@@ -36,22 +38,41 @@ TARGET = $(DIR_INFO)/$(THISAPP)
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 546c42271307b0ffe1dd55fd899adda8
install : $(TARGET)
check :
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :
download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 :
md5 : $(subst %,%_MD5,$(objects))
###############################################################################
# Downloading, checking, md5sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_MD5,$(objects)) :
@$(MD5)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && mkdir $(DIR_APP) && cp -R $(DIR_SRC)/src/nash/* $(DIR_APP)
cd $(DIR_APP) && make
cd $(DIR_APP) && install -m 0755 nash mkinitrd /sbin
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && make MISDNDIR=/usr/src/linux
cd $(DIR_APP) && make install MISDNDIR=/usr/src/linux
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -414,6 +414,7 @@ buildipfire() {
ipfiremake iputils
ipfiremake l7-protocols
# ipfiremake isdn4k-utils # What about mISDN???
ipfiremake mISDN
ipfiremake hwdata
ipfiremake kudzu
ipfiremake logrotate
@@ -421,7 +422,6 @@ buildipfire() {
ipfiremake misc-progs
ipfiremake mtools
ipfiremake nano
ipfiremake nash
ipfiremake nasm
ipfiremake URI
ipfiremake HTML-Tagset

View File

@@ -1,21 +0,0 @@
CFLAGS=-Wall -Werror -DVERSION=\"$(VERSION)\" -g -D_FORTIFY_SOURCE=2
VERSION=$(shell awk -F= '/^VERSION=/ { print $$2 }' mkinitrd)
ARCH := $(patsubst i%86,i386,$(shell uname -m))
ARCH := $(patsubst sparc%,sparc,$(ARCH))
STATIC=-static
mandir=usr/share/man
nash: nash.o mount_by_label.o name_to_dev_t.o
$(CC) $(STATIC) -g $(LDFLAGS) -o $@ $^
clean:
rm -f nash $(MINILIBC) *.o
install:
mkdir -p $(BUILDROOT)/sbin
mkdir -p $(BUILDROOT)/$(mandir)/man8
install -m 755 -s nash $(BUILDROOT)/sbin
install -m 644 nash.8 $(BUILDROOT)/$(mandir)/man8

View File

@@ -1,181 +0,0 @@
/* Including <linux/fs.h> became more and more painful.
Below a very abbreviated version of some declarations,
only designed to be able to check a magic number
in case no filesystem type was given. */
#ifndef BLKGETSIZE
#ifndef _IO
/* pre-1.3.45 */
#define BLKGETSIZE 0x1260 /* return device size */
#else
/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
#define BLKGETSIZE _IO(0x12,96)
#endif
#endif
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
struct minix_super_block {
unsigned char s_dummy[16];
unsigned char s_magic[2];
};
#define minixmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8))
#define ISODCL(from, to) (to - from + 1)
#define ISO_STANDARD_ID "CD001"
struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)];
char version[ISODCL(7,7)];
char data[ISODCL(8,2048)];
};
#define HS_STANDARD_ID "CDROM"
struct hs_volume_descriptor {
char foo[ISODCL ( 1, 8)]; /* 733 */
char type[ISODCL ( 9, 9)]; /* 711 */
char id[ISODCL ( 10, 14)];
char version[ISODCL ( 15, 15)]; /* 711 */
char data[ISODCL(16,2048)];
};
#define EXT_SUPER_MAGIC 0x137D
struct ext_super_block {
unsigned char s_dummy[56];
unsigned char s_magic[2];
};
#define extmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8))
#define EXT2_PRE_02B_MAGIC 0xEF51
#define EXT2_SUPER_MAGIC 0xEF53
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
struct ext2_super_block {
unsigned char s_dummy1[56];
unsigned char s_magic[2];
unsigned char s_dummy2[34];
unsigned char s_feature_compat[4];
unsigned char s_feature_incompat[4];
unsigned char s_feature_ro_compat[4];
unsigned char s_uuid[16];
unsigned char s_volume_name[16];
unsigned char s_dummy3[88];
unsigned char s_journal_inum[4]; /* ext3 only */
};
#define ext2magic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8))
struct reiserfs_super_block
{
unsigned char s_block_count[4];
unsigned char s_free_blocks[4];
unsigned char s_root_block[4];
unsigned char s_journal_block[4];
unsigned char s_journal_dev[4];
unsigned char s_orig_journal_size[4];
unsigned char s_journal_trans_max[4];
unsigned char s_journal_block_count[4];
unsigned char s_journal_max_batch[4];
unsigned char s_journal_max_commit_age[4];
unsigned char s_journal_max_trans_age[4];
unsigned char s_blocksize[2];
unsigned char s_oid_maxsize[2];
unsigned char s_oid_cursize[2];
unsigned char s_state[2];
unsigned char s_magic[12];
};
#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
#define _XIAFS_SUPER_MAGIC 0x012FD16D
struct xiafs_super_block {
unsigned char s_boot_segment[512]; /* 1st sector reserved for boot */
unsigned char s_dummy[60];
unsigned char s_magic[4];
};
#define xiafsmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8) + \
(((unsigned int) s.s_magic[2]) << 16) + \
(((unsigned int) s.s_magic[3]) << 24))
/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */
#define UFS_SUPER_MAGIC 0x00011954
struct ufs_super_block {
unsigned char s_dummy[0x55c];
unsigned char s_magic[4];
};
#define ufsmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8) + \
(((unsigned int) s.s_magic[2]) << 16) + \
(((unsigned int) s.s_magic[3]) << 24))
/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */
#define NTFS_SUPER_MAGIC "NTFS"
struct ntfs_super_block {
unsigned char s_dummy[3];
unsigned char s_magic[4];
};
/* From inspection of a few FAT filesystems - aeb */
/* Unfortunately I find almost the same thing on an extended partition;
it looks like a primary has some directory entries where the extended
has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */
struct fat_super_block {
unsigned char s_dummy[3];
unsigned char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
/* mtools-3.9.4 writes "MTOOL394" */
unsigned char s_dummy2[32];
unsigned char s_label[11]; /* for DOS? */
unsigned char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */
/* OS/2 BM has "FAT " here. */
unsigned char s_dummy3[9];
unsigned char s_label2[11]; /* for Windows? */
unsigned char s_fs2[8]; /* garbage or "FAT32 " */
};
#define XFS_SUPER_MAGIC "XFSB"
struct xfs_super_block {
unsigned char s_magic[4];
unsigned char s_dummy[28];
unsigned char s_uuid[16];
unsigned char s_dummy2[60];
unsigned char s_fname[12];
};
#define CRAMFS_SUPER_MAGIC 0x28cd3d45
struct cramfs_super_block {
unsigned char s_magic[4];
unsigned char s_dummy[12];
unsigned char s_id[16];
};
#define cramfsmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8) + \
(((unsigned int) s.s_magic[2]) << 16) + \
(((unsigned int) s.s_magic[3]) << 24))
#define HFS_SUPER_MAGIC 0x4244
struct hfs_super_block {
unsigned char s_magic[2];
unsigned char s_dummy[18];
unsigned char s_blksize[4];
};
#define hfsmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8))
#define hfsblksize(s) ((unsigned int) s.s_blksize[0] + \
(((unsigned int) s.s_blksize[1]) << 8) + \
(((unsigned int) s.s_blksize[2]) << 16) + \
(((unsigned int) s.s_blksize[3]) << 24))
#define HPFS_SUPER_MAGIC 0xf995e849
struct hpfs_super_block {
unsigned char s_magic[4];
unsigned char s_magic2[4];
};
#define hpfsmagic(s) ((unsigned int) s.s_magic[0] + (((unsigned int) s.s_magic[1]) << 8) + \
(((unsigned int) s.s_magic[2]) << 16) + \
(((unsigned int) s.s_magic[3]) << 24))
struct adfs_super_block {
unsigned char s_dummy[448];
unsigned char s_blksize[1];
unsigned char s_dummy2[62];
unsigned char s_checksum[1];
};
#define adfsblksize(s) ((unsigned int) s.s_blksize[0])

View File

@@ -1,821 +0,0 @@
#!/bin/bash --norc
# mkinitrd
#
# Copyright 2005 Red Hat, Inc.
#
# Written by Erik Troan <ewt@redhat.com>
#
# Contributors:
# Elliot Lee <sopwith@cuc.edu>
# Miguel de Icaza <miguel@nuclecu.unam.mx>
# Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de>
# Michael K. Johnson <johnsonm@redhat.com>
# Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
# Jakub Jelinek <jakub@redhat.com>
# Carlo Arenas Belon (carenas@chasqui.lared.net.pe>
# Keith Owens <kaos@ocs.com.au>
# Bernhard Rosenkraenzer <bero@redhat.com>
# Matt Wilson <msw@redhat.com>
# Trond Eivind Glomsr<73>d <teg@redhat.com>
# Jeremy Katz <katzj@redhat.com>
# Preston Brown <pbrown@redhat.com>
# Bill Nottingham <notting@redhat.com>
# Guillaume Cottenceau <gc@mandrakesoft.com>
# Peter Jones <pjones@redhat.com>
umask 0022
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
export PATH
VERSION=4.2.11
compress=1
allowmissing=""
target=""
kernel=""
force=""
verbose=""
MODULES=""
img_vers=""
builtins=""
pivot=1
squashfs=1
initramfs=""
modulefile=/etc/modules.conf
rc=0
IMAGESIZE=8000
PRESCSIMODS="scsi_mod sd_mod unknown"
fstab="/etc/fstab"
if [ -f /etc/udev/udev.conf ]; then
USE_UDEV="yes"
UDEV_TMPFS="yes"
UDEV_KEEP_DEV="yes"
. /etc/udev/udev.conf
[ -x /sbin/udev.static ] || USE_UDEV=
fi
usage () {
echo "usage: `basename $0` [--version] [-v] [-f] [--preload <module>]" >&2
echo " [--omit-scsi-modules] [--omit-raid-modules] [--omit-lvm-modules]" >&2
echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]" >&2
echo " [--builtin=<module>] [--nopivot] [--nosquashfs] <initrd-image> <kernel-version>" >&2
echo "" >&2
echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" >&2
exit 1
}
moduledep() {
if [ ! -f "/lib/modules/$kernel/modules.dep" ]; then
echo "No dep file found for kernel $kernel" >&2
exit 1
fi
[ -n "$verbose" ] && echo -n "Looking for deps of module $1"
deps=$(gawk 'BEGIN { searched=ARGV[2]; ARGV[2]=""; rc=1 } \
function modname(filename) { match(filename, /\/([^\/]+)\.k?o:?$/, ret); return ret[1] } \
function show() { if (orig == searched) { print dep; orig=""; rc=0; exit } } \
/^\/lib/ { show(); \
orig=modname($1); dep=""; \
if ($2) { for (i = 2; i <= NF; i++) { dep=sprintf("%s %s", dep, modname($i)); } } } \
/^ / { dep=sprintf("%s %s", dep, modname($1)); } \
END { show(); exit(rc) }' /lib/modules/$kernel/modules.dep $1)
[ -n "$verbose" ] && echo -e "\t$deps"
}
findmodule() {
skiperrors=""
if [ $1 == "--skiperrors" ]; then
skiperrors=--skiperrors
shift
fi
local modName=$1
if [ "$modName" = "off" -o "$modName" = "null" ]; then
return
fi
if [ $(echo $modName | cut -b1) = "-" ]; then
skiperrors=--skiperrors
modName=$(echo $modName | cut -b2-)
fi
if echo $builtins | egrep -q '(^| )'$modName'( |$)' ; then
[ -n "$verbose" ] && echo "module $modName assumed to be built in"
set +x
return
fi
# special cases
if [ "$modName" = "i2o_block" ]; then
findmodule i2o_core
findmodule -i2o_pci
modName="i2o_block"
elif [ "$modName" = "ppa" ]; then
findmodule parport
findmodule parport_pc
modName="ppa"
elif [ "$modName" = "sbp2" ]; then
findmodule ieee1394
findmodule ohci1394
modName="sbp2"
else
moduledep $modName
for i in $deps; do
findmodule $i
done
fi
for modExt in o.gz o ko ; do
if [ -d /lib/modules/$kernel/updates ]; then
fmPath=`(cd /lib/modules/$kernel/updates; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | gawk {'print $1; exit;'}`
fi
if [ -f /lib/modules/$kernel/updates/$fmPath ]; then
fmPath=updates/$fmPath
break
fi
fmPath=`(cd /lib/modules/$kernel; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | gawk {'print $1; exit;'}`
if [ -f /lib/modules/$kernel/$fmPath ]; then
break
fi
done
if [ ! -f /lib/modules/$kernel/$fmPath ]; then
if [ -n "$skiperrors" ]; then
return
fi
# ignore the absence of the scsi modules
for n in $PRESCSIMODS; do
if [ "$n" = "$modName" ]; then
return;
fi
done;
if [ -n "$allowmissing" ]; then
echo "WARNING: No module $modName found for kernel $kernel, continuing anyway" >&2
return
fi
echo "No module $modName found for kernel $kernel, aborting." >&2
exit 1
fi
# only need to add each module once
if ! echo $MODULES | grep -q "$fmPath" 2>/dev/null ; then
MODULES="$MODULES $fmPath"
fi
}
inst() {
if [ "$#" != "2" ];then
echo "usage: inst <file> <destination>"
return
fi
[ -n "$verbose" ] && echo "$1 -> $2"
cp $1 $2
}
while [ $# -gt 0 ]; do
case $1 in
--fstab*)
if echo $1 | grep -q '=' ; then
fstab=`echo $1 | sed 's/^--fstab=//'`
else
fstab=$2
shift
fi
;;
--with-usb)
withusb=yes
;;
--with*)
if echo $1 | grep -q '=' ; then
modname=`echo $1 | sed 's/^--with=//'`
else
modname=$2
shift
fi
basicmodules="$basicmodules $modname"
;;
--builtin*)
if echo $1 | grep -q '=' ; then
modname=`echo $1 | sed 's/^--builtin=//'`
else
modname=$2
shift
fi
builtins="$builtins $modname"
;;
--version)
echo "mkinitrd: version $VERSION"
exit 0
;;
-v)
verbose=-v
;;
--nocompress)
compress=""
;;
--nopivot)
pivot=""
;;
--nosquashfs)
squashfs=""
;;
--ifneeded)
# legacy
;;
-f)
force=1
;;
--preload*)
if echo $1 | grep -q '=' ; then
modname=`echo $1 | sed 's/^--preload=//'`
else
modname=$2
shift
fi
PREMODS="$PREMODS $modname"
;;
--omit-scsi-modules)
PRESCSIMODS=""
noscsi=1;
;;
--omit-raid-modules)
noraid=1;
;;
--omit-lvm-modules)
nolvm=1
;;
--image-version)
img_vers=yes
;;
--noudev)
USE_UDEV=
;;
--allow-missing)
allowmissing=yes
;;
*)
if [ -z "$target" ]; then
target=$1
elif [ -z "$kernel" ]; then
kernel=$1
else
usage
fi
;;
esac
shift
done
if [ -z "$target" -o -z "$kernel" ]; then
usage
fi
if [ -n "$img_vers" ]; then
target="$target-$kernel"
fi
if [ -z "$force" -a -f $target ]; then
echo "$target already exists." >&2
exit 1
fi
if [ ! -d /lib/modules/$kernel ]; then
echo "/lib/modules/$kernel is not a directory." >&2
exit 1
fi
if [ $UID != 0 ]; then
echo "mkinitrd must be run as root"
exit 1
fi
kernelmajor=`echo $kernel | cut -d . -f 1,2`
if [ "$kernelmajor" == "2.4" ]; then
if [ -n "$verbose" ]; then echo "Creating old-style initrd"; fi
USE_UDEV=
else
if [ -n "$verbose" ]; then echo "Creating initramfs"; fi
modulefile=/etc/modprobe.conf
initramfs=1
pivot=""
fi
# if we're not using udev, don't set any of the other bits
[ -z "$USE_UDEV" ] && UDEV_TMPFS= && UDEV_KEEP_DEV=
# find a temporary directory which doesn't use tmpfs
TMPDIR=""
for t in /tmp /var/tmp /root ${PWD}; do
if [ ! -d $t ]; then continue; fi
if ! echo access -w $t | /sbin/nash --quiet; then continue; fi
fs=$(df -T $t 2>/dev/null | gawk '{line=$1;} END {printf $2;}')
if [ "$fs" != "tmpfs" ]; then
TMPDIR=$t
break
fi
done
if [ -z "$TMPDIR" ]; then
echo "no temporary directory could be found" >&2
exit 1
fi
if [ $TMPDIR = "/root" -o $TMPDIR = "${PWD}" ]; then
echo "WARNING: using $TMPDIR for temporary files" >&2
fi
for n in $PREMODS; do
findmodule $n
done
needusb=""
if [ -n "$withusb" ]; then
# If / or /boot is on a USB device include the driver. With root by
# label we could still get some odd behaviors
for fs in / /boot ; do
esc=$(echo $fs | sed 's,/,\\/,g')
dev=$(mount | gawk "/ on ${esc} / { print \$1 }" | sed 's/[0-9]*$//' | cut -d/ -f3)
if [ "$(echo $dev | cut -c1-2)" = sd ]; then
if [ `which kudzu 2>/dev/null` ]; then
host=$(kudzu --probe -b scsi |
gawk '/^device: '${dev}'/,/^host:/ { if (/^host/) { print $2; exit; } }')
if [ -d /proc/scsi/usb-storage-${host} -o -f /proc/scsi/usb-storage/${host} ]; then
needusb=1
fi
fi
fi
done
fi
if [ -n "$needusb" ]; then
drivers=$(gawk '/^alias[[:space:]]+usb-controller[0-9]* / { print $3}' < $modulefile)
if [ -n "$drivers" ]; then
for driver in $drivers; do
findmodule $driver
done
findmodule scsi_mod
findmodule sd_mod
findmodule usb-storage
fi
fi
if [ -z "$noscsi" ]; then
if [ ! -f $modulefile ]; then
modulefile=/etc/conf.modules
fi
if [ -f $modulefile ]; then
scsimodules=`grep "alias[[:space:]]\+scsi_hostadapter" $modulefile | grep -v '^[ ]*#' | LC_ALL=C sort -u | gawk '{ print $3 }'`
if [ -n "$scsimodules" ]; then
for n in $PRESCSIMODS; do
findmodule $n
done
for n in $scsimodules; do
# for now allow scsi modules to come from anywhere. There are some
# RAID controllers with drivers in block/
findmodule $n
done
fi
fi
fi
# If we have ide devices and module ide, do the right thing
ide=/proc/ide/ide*
if [ -n "$ide" ]; then
findmodule -ide-disk
fi
# If we use LVM, include lvm-mod
if [ -z "$nolvm" ]; then
if [ -f /proc/lvm/global ]; then
if grep -q '^VG:' /proc/lvm/global ; then
if [ "$kernelmajor" == "2.4" ]; then
findmodule -lvm-mod
else
findmodule -dm-mod
fi
fi
fi
if [ -x /sbin/dmsetup -a -e /dev/mapper/control ]; then
dmout=$(/sbin/dmsetup ls 2>/dev/null)
if [ "$dmout" != "No devices found" -a "$dmout" != "" ]; then
findmodule -dm-mod
fi
fi
fi
# If we have dasd devices, include the necessary modules (S/390)
if [ -d /proc/dasd ]; then
findmodule -dasd_mod
findmodule -dasd_eckd_mod
findmodule -dasd_fba_mod
fi
if [ -z "$noraid" -a -f /proc/mdstat ]; then
# load appropriate raid devices if necessary -- we'll load whatever
# /proc/mdstat suggests
# note that the gawk below contains a space and a tab
for level in $(gawk '/^md[0-9][0-9]*[ ]*:/ { print $4 }' \
/proc/mdstat | sort -u); do
case $level in
linear)
findmodule linear
startraid=1
;;
multipath)
findmodule multipath
startraid=1
;;
raid[01456])
findmodule $level
startraid=1
;;
*)
echo "raid level $level (in /proc/mdstat) not recognized" >&2
;;
esac
done
if [ -n "$startraid" ]; then
raiddevices=$(gawk '/^md[0-9][0-9]*[ ]*:/ { print $1 }' \
/proc/mdstat | sort)
fi
fi
# check to see if we need to set up a loopback filesystem
rootdev=$(gawk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
if echo $rootdev | cut -d/ -f3 | grep -q loop ; then
key="^# $(echo $rootdev | cut -d/ -f3 | tr '[a-z]' '[A-Z]'):"
if ! grep "$key" $fstab >> /dev/null; then
echo "The root filesystem is on a $rootdev, but there is no magic entry in $fstab" >&2
echo "for this device. Consult the mkinitrd man page for more information" >&2
exit 1
fi
line=$(grep "$key" $fstab)
loopDev=$(echo $line | gawk '{print $3}')
loopFs=$(echo $line | gawk '{print $4}')
loopFile=$(echo $line | gawk '{print $5}')
basicmodules="$basicmodules -loop"
if [ "$loopFs" = "vfat" -o "$loopFs" = "msdos" ]; then
basicmodules="$basicmodules -fat"
fi
basicmodules="$basicmodules -${loopFs}"
# check if the root fs is on a logical volume
elif ! echo $rootdev | cut -c1-6 |grep -q "LABEL=" ; then
root_vg=$(echo $rootdev | cut -d/ -f3)
rootdev=$(echo "readlink $rootdev" | /sbin/nash --quiet)
major=`ls -l $rootdev | sed -e "s/.* \\([0-9]\+\\), *[0-9]\+.*/\\1/"`
[ "$major" != "58" ] || root_lvm=1
if echo $rootdev |grep -q /dev/mapper 2>/dev/null ; then root_lvm=1 ; fi
fi
rootfs=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
rootopts=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab \
| sed -e 's/\(^rw,\|rw,$\)//' -e 's/,rw,/,/' -e 's/^rw$/ro/')
# in case the root filesystem is modular
findmodule -${rootfs}
if [ -n "$root_lvm" ]; then
if [ "$kernelmajor" == "2.4" ]; then
findmodule -lvm-mod
else
findmodule -dm-mod
# DM requires all of these to be there in case someone used the
# feature. broken. (#132001)
findmodule -dm-mirror
findmodule -dm-zero
findmodule -dm-snapshot
fi
fi
for n in $basicmodules; do
findmodule $n
done
if [ -n "$verbose" ]; then
echo "Using modules: $MODULES"
fi
MNTIMAGE=`mktemp -d ${TMPDIR}/initrd.XXXXXX`
IMAGE=`mktemp ${TMPDIR}/initrd.img.XXXXXX`
if [ -z "$initramfs" ]; then
MNTPOINT=`mktemp -d ${TMPDIR}/initrd.mnt.XXXXXX`
RCFILE=$MNTIMAGE/linuxrc
else
RCFILE=$MNTIMAGE/init
fi
if [ -z "$MNTIMAGE" -o -z "$IMAGE" ]; then
echo "Error creating temporaries. Try again" >&2
exit 1
fi
if [ -z "$initramfs" ]; then
dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGESIZE 2> /dev/null || exit 1
LODEV=$(echo findlodev | /sbin/nash --quiet)
if [ -z "$LODEV" ]; then
rm -rf $MNTIMAGE $MNTPOINT $IMAGE
echo "All of your loopback devices are in use." >&2
exit 1
fi
losetup ${LODEV} $IMAGE || exit 1
# We have to "echo y |" so that it doesn't complain about $IMAGE not
# being a block device
echo y | mkfs.minix -i 100 $LODEV $IMAGESIZE >/dev/null 2>/dev/null
if [ -n "$verbose" ]; then
echo "Using loopback device $LODEV"
fi
mkdir -p $MNTPOINT
mount -t minix $LODEV $MNTPOINT || {
echo "Can't get a loopback device"
exit 1
}
# We don't need this directory, so let's save space
rmdir $MNTPOINT/lost+found >/dev/null 2>&1
fi
mkdir -p $MNTIMAGE
mkdir -p $MNTIMAGE/lib
mkdir -p $MNTIMAGE/bin
mkdir -p $MNTIMAGE/etc
mkdir -p $MNTIMAGE/dev
mkdir -p $MNTIMAGE/hd
mkdir -p $MNTIMAGE/loopfs
mkdir -p $MNTIMAGE/proc
mkdir -p $MNTIMAGE/sys
mkdir -p $MNTIMAGE/sysroot
ln -s bin $MNTIMAGE/sbin
inst /sbin/nash "$MNTIMAGE/bin/nash"
inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
ln -s /sbin/nash $MNTIMAGE/sbin/modprobe
if [ -n "$USE_UDEV" ]; then
inst /sbin/udev.static $MNTIMAGE/sbin/udev
inst /sbin/udevstart.static $MNTIMAGE/sbin/udevstart
mkdir -p $MNTIMAGE/etc/udev
inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
ln -s /sbin/nash $MNTIMAGE/sbin/hotplug
fi
for MODULE in $MODULES; do
if [ -x /usr/bin/strip ]; then
/usr/bin/strip -g $verbose /lib/modules/$kernel/$MODULE -o $MNTIMAGE/lib/$(basename $MODULE)
else
cp $verbose -a /lib/modules/$kernel/$MODULE $MNTIMAGE/lib
fi
done
# mknod'ing the devices instead of copying them works both with and
# without devfs...
mknod $MNTIMAGE/dev/console c 5 1
mknod $MNTIMAGE/dev/null c 1 3
mknod $MNTIMAGE/dev/ram b 1 1
mknod $MNTIMAGE/dev/systty c 4 0
for i in 1 2 3 4; do
mknod $MNTIMAGE/dev/tty$i c 4 $i
done
# FIXME -- this won't work if you're using devfs
if [ -n "$root_lvm" -a "$kernelmajor" == "2.4" ]; then
pvs=$(/sbin/pvscan | grep " PV " | gawk {'print $5;'} |sed 's/"//g')
for pv in $pvs; do
cp $verbose --parents -a $pv $MNTIMAGE/
done
inst /sbin/vgwrapper "$MNTIMAGE/bin/vgwrapper"
ln "$MNTIMAGE/bin/vgwrapper" "$MNTIMAGE/bin/vgscan"
ln "$MNTIMAGE/bin/vgwrapper" "$MNTIMAGE/bin/vgchange"
mknod $MNTIMAGE/dev/lvm b 109 0
fi
if [ -n "$root_lvm" -a "$kernelmajor" == "2.6" ]; then
inst /sbin/lvm.static "$MNTIMAGE/bin/lvm"
if [ -f /etc/lvm/lvm.conf ]; then
cp $verbose --parents /etc/lvm/lvm.conf $MNTIMAGE/
fi
fi
echo "#!/bin/nash" >| $RCFILE
echo "" >> $RCFILE
echo "mount -t proc /proc /proc" >> $RCFILE
echo "setquiet" >> $RCFILE
echo "echo Mounted /proc filesystem" >> $RCFILE
if [ "$kernelmajor" != "2.4" ]; then
echo "echo Mounting sysfs" >> $RCFILE
echo "mount -t sysfs /sys /sys" >> $RCFILE
fi
if [ -n "$USE_UDEV" ]; then
if [ -n "$UDEV_TMPFS" ]; then
cat >> $RCFILE <<EOF
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mkdir /dev/pts
mkdir /dev/shm
EOF
fi
cat >> $RCFILE <<EOF
echo Starting udev
/sbin/udevstart
echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
EOF
fi
for MODULE in $MODULES; do
text=""
module=`echo $MODULE | sed "s|.*/||" | sed "s/.k\?o$//"`
fullmodule=`echo $MODULE | sed "s|.*/||"`
options=`sed -n -e "s/^options[ ][ ]*$module[ ][ ]*//p" $modulefile 2>/dev/null`
if [ -n "$verbose" ]; then
if [ -n "$options" ]; then
text=" with options $options"
fi
echo "Loading module $module$text"
fi
echo "echo \"Loading $fullmodule module\"" >> $RCFILE
echo "insmod /lib/$fullmodule $options" >> $RCFILE
# Hack - we need a delay after loading usb-storage to give things
# time to settle down before we start looking a block devices
if [ "$module" = "usb-storage" ]; then
echo "sleep 8" >> $RCFILE
fi
if [ "$module" = "zfcp" -a -f /etc/zfcp.conf ]; then
echo "sleep 2" >> $RCFILE
cat /etc/zfcp.conf | grep -v "^#" | tr "A-Z" "a-z" | while read DEVICE SCSIID WWPN SCSILUN FCPLUN; do
echo "echo -n $WWPN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/port_add" >>$RCFILE
echo "echo -n $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/$WWPN/unit_add" >>$RCFILE
echo "echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online" >>$RCFILE
done
fi
done
# HACK: module loading + device creation isn't necessarily synchronous...
# this will make sure that we have all of our devices before trying
# things like RAID or LVM
if [ -n "$USE_UDEV" ]; then
echo "/sbin/udevstart" >> $RCFILE
fi
echo "sleep 2" >> $RCFILE
if [ -n "$startraid" ]; then
for dev in $raiddevices; do
cp -a /dev/${dev} $MNTIMAGE/dev
echo "raidautorun /dev/${dev}" >> $RCFILE
done
fi
if [ -z "$USE_UDEV" ]; then
echo "echo Creating block devices" >> $RCFILE
echo "mkdevices /dev" >> $RCFILE
fi
echo "mknod /dev/loop0 b 7 0" >> $RCFILE
if [ -n "$loopDev" ]; then
mkdir /initrd
cp -a $loopDev $MNTIMAGE/dev
cp -a $rootdev $MNTIMAGE/dev
echo "echo Mounting device containing loopback root filesystem" >> $RCFILE
echo "mount -t $loopFs $loopDev /loopfs" >> $RCFILE
echo "echo Setting up loopback device $rootdev" >> $RCFILE
echo "losetup $rootdev /loopfs$loopFile" >> $RCFILE
elif [ -n "$root_lvm" ]; then
if [ "$kernelmajor" == "2.4" ]; then
echo "echo Scanning logical volumes" >> $RCFILE
echo "vgscan" >> $RCFILE
echo "echo Activating logical volumes" >> $RCFILE
echo "vgchange -ay" >> $RCFILE
else
echo "echo Making device-mapper control node" >> $RCFILE
echo "mkdmnod" >> $RCFILE
echo "echo Scanning logical volumes" >> $RCFILE
echo "lvm vgscan --ignorelockingfailure" >> $RCFILE
echo "echo Activating logical volumes" >> $RCFILE
echo "lvm vgchange -ay --ignorelockingfailure $root_vg" >> $RCFILE
fi
fi
echo "echo Creating root device" >> $RCFILE
echo "mkrootdev /dev/root" >> $RCFILE
rootdev=/dev/root
if [ -n "$initramfs" ]; then
echo "echo Mounting root filesystem" >> $RCFILE
if [ -n "$squashfs" ]; then
echo "mount -o $rootopts --ro -t $rootfs $rootdev /sysroot" >> $RCFILE
else
echo "fsck.minix $rootdev" >> $RCFILE
echo "mount -o $rootopts -t minix $rootdev /hd" >> $RCFILE
echo "losetup /dev/loop0 /hd/ipcop-1.5.0a1.squashfs" >> $RCFILE
echo "mount --ro -t squashfs /dev/loop0 /sysroot" >> $RCFILE
echo "mount -t tmpfs none /sysroot/var" >> $RCFILE
echo "echo Unpacking IPCop configuration.. Please wait.." >> $RCFILE
echo "tar -C /sysroot -xjf /hd/ipcop.tbz2" >> $RCFILE
fi
echo "echo Switching to new root" >> $RCFILE
if [ -n "$UDEV_KEEP_DEV" ]; then
echo "switchroot --movedev /sysroot" >> $RCFILE
else
echo "switchroot /sysroot" >> $RCFILE
fi
else
if [ "$kernelmajor" != "2.4" ]; then
echo "umount /sys" >> $RCFILE
fi
if [ -n "$pivot" ]; then
echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $RCFILE
echo "echo Mounting root filesystem" >> $RCFILE
if [ -n "$squashfs" ]; then
echo "mount -o $rootopts --ro -t $rootfs $rootdev /sysroot" >> $RCFILE
else
echo "fsck.minix $rootdev" >> $RCFILE
echo "mount -o $rootopts -t minix $rootdev /hd" >> $RCFILE
echo "losetup /dev/loop0 /hd/ipcop-1.5.0a1.squashfs" >> $RCFILE
echo "mount --ro -t squashfs /dev/loop0 /sysroot" >> $RCFILE
echo "mount -t tmpfs none /sysroot/var" >> $RCFILE
echo "echo Unpacking IPCop configuration.. Please wait.." >> $RCFILE
echo "tar -C /sysroot -xjf /hd/ipcop.tbz2" >> $RCFILE
fi
echo "pivot_root /sysroot /sysroot/initrd" >> $RCFILE
echo "umount /initrd/proc" >> $RCFILE
else
echo "umount /proc" >> $RCFILE
fi
[ -n "$UDEV_TMPFS" ] && echo "umount /initrd/dev" >> $RCFILE
fi
chmod +x $RCFILE
if [ -z "$initramfs" ]; then
(cd $MNTIMAGE; tar cf - .) | (cd $MNTPOINT; tar xf -) || exit 1
umount $MNTPOINT
losetup -d $LODEV
else
(cd $MNTIMAGE; find . | cpio --quiet -c -o) >| $IMAGE || exit 1
fi
if [ -n "$compress" ]; then
gzip -9 < $IMAGE >| $target || rc=1
else
cp -a $IMAGE $target || rc=1
fi
rm -rf $MNTIMAGE $IMAGE
if [ -n "$MNTPOINT" ]; then rm -rf $MNTPOINT ; fi
exit $rc

View File

@@ -1,300 +0,0 @@
/*
* taken from util-linux 2.11g and hacked into nash
*
* mount_by_label.c - aeb
*
* 1999-02-22 Arkadiusz Mi<4D>kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 2000-01-20 James Antill <james@and.org>
* - Added error message if /proc/partitions cannot be opened
* 2000-05-09 Erik Troan <ewt@redhat.com>
* - Added cache for UUID and disk labels
* 2000-11-07 Nathan Scott <nathans@sgi.com>
* - Added XFS support
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include "linux_fs.h"
#include "mount_by_label.h"
#define PROC_PARTITIONS "/proc/partitions"
#define DEVLABELDIR "/dev"
#define _(str) (str)
static struct uuidCache_s {
struct uuidCache_s *next;
char uuid[16];
char *device;
char *label;
int major, minor;
} *uuidCache = NULL;
/* for now, only ext2, ext3 and xfs are supported */
static int
get_label_uuid(const char *device, char **label, char *uuid) {
/* start with ext2/3 and xfs tests, taken from mount_guess_fstype */
/* should merge these later */
int fd;
int rv = 1;
size_t namesize;
struct ext2_super_block e2sb;
struct xfs_super_block xfsb;
fd = open(device, O_RDONLY);
if (fd < 0)
return rv;
if (lseek(fd, 1024, SEEK_SET) == 1024
&& read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb)
&& (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) {
memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid));
namesize = sizeof(e2sb.s_volume_name);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, e2sb.s_volume_name, namesize);
rv = 0;
}
else if (lseek(fd, 0, SEEK_SET) == 0
&& read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb)
&& (strncmp((char *)xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0)) {
memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid));
namesize = sizeof(xfsb.s_fname);
if ((*label = calloc(namesize + 1, 1)) != NULL)
memcpy(*label, xfsb.s_fname, namesize);
rv = 0;
}
close(fd);
return rv;
}
static void
uuidcache_addentry(char * device, int major, int minor, char *label, char *uuid) {
struct uuidCache_s *last;
if (!uuidCache) {
last = uuidCache = malloc(sizeof(*uuidCache));
} else {
for (last = uuidCache; last->next; last = last->next) ;
last->next = malloc(sizeof(*uuidCache));
last = last->next;
}
last->next = NULL;
last->label = label;
last->device = device;
last->major = major;
last->minor = minor;
memcpy(last->uuid, uuid, sizeof(last->uuid));
}
static void
uuidcache_init(void) {
char line[100];
char *s;
int ma, mi, sz;
static char ptname[100];
FILE *procpt;
char uuid[16], *label;
char device[110];
int firstPass;
int handleOnFirst;
char * chptr, * endptr;
if (uuidCache)
return;
procpt = fopen(PROC_PARTITIONS, "r");
if (!procpt) {
static int warn = 0;
if (!warn++)
fprintf (stderr, _("mount: could not open %s, so UUID and LABEL "
"conversion cannot be done.\n"),
PROC_PARTITIONS);
return;
}
for (firstPass = 1; firstPass >= 0; firstPass--) {
fseek(procpt, 0, SEEK_SET);
while (fgets(line, sizeof(line), procpt)) {
/* The original version of this code used sscanf, but
diet's sscanf is quite limited */
chptr = line;
if (*chptr++ != ' ') continue;
ma = strtol(chptr, &endptr, 0);
if (endptr == chptr) continue;
while (isspace(*endptr)) endptr++;
chptr = endptr;
mi = strtol(chptr, &endptr, 0);
if (endptr == chptr) continue;
while (isspace(*endptr)) endptr++;
chptr = endptr;
sz = strtol(chptr, &endptr, 0);
if (endptr == chptr) continue;
while (isspace(*endptr)) endptr++;
chptr = endptr;
while (!isspace(*endptr) && *endptr != '\n') endptr++;
if (chptr == endptr) continue;
strncpy(ptname, chptr, endptr - chptr);
ptname[endptr - chptr] = '\0';
/* skip extended partitions (heuristic: size 1) */
if (sz == 1)
continue;
/* look only at md devices on first pass */
handleOnFirst = !strncmp(ptname, "md", 2);
if (firstPass != handleOnFirst)
continue;
/* skip entire disk (minor 0, 64, ... on ide;
0, 16, ... on sd) */
/* heuristic: partition name ends in a digit */
for(s = ptname; *s; s++);
if (isdigit(s[-1])) {
char * ptr;
char * deviceDir = NULL;
int mustRemove = 0;
int mustRemoveDir = 0;
int i;
sprintf(device, "%s/%s", DEVLABELDIR, ptname);
if (access(device, F_OK)) {
ptr = device;
i = 0;
while (*ptr)
if (*ptr++ == '/')
i++;
if (i > 2) {
deviceDir = alloca(strlen(device) + 1);
strcpy(deviceDir, device);
ptr = deviceDir + (strlen(device) - 1);
while (*ptr != '/')
*ptr-- = '\0';
if (mkdir(deviceDir, 0644)) {
printf("mkdir: cannot create directory %s: %d\n", deviceDir, errno);
} else {
mustRemoveDir = 1;
}
}
mknod(device, S_IFBLK | 0600, makedev(ma, mi));
mustRemove = 1;
}
if (!get_label_uuid(device, &label, uuid))
uuidcache_addentry(strdup(device), ma, mi,
label, uuid);
if (mustRemove) unlink(device);
if (mustRemoveDir) rmdir(deviceDir);
}
}
}
fclose(procpt);
}
#define UUID 1
#define VOL 2
static char *
get_spec_by_x(int n, const char *t, int * majorPtr, int * minorPtr) {
struct uuidCache_s *uc;
uuidcache_init();
uc = uuidCache;
while(uc) {
switch (n) {
case UUID:
if (!memcmp(t, uc->uuid, sizeof(uc->uuid))) {
*majorPtr = uc->major;
*minorPtr = uc->minor;
return uc->device;
}
break;
case VOL:
if (!strcmp(t, uc->label)) {
*majorPtr = uc->major;
*minorPtr = uc->minor;
return uc->device;
}
break;
}
uc = uc->next;
}
return NULL;
}
static unsigned char
fromhex(char c) {
if (isdigit(c))
return (c - '0');
else if (islower(c))
return (c - 'a' + 10);
else
return (c - 'A' + 10);
}
char *
get_spec_by_uuid(const char *s, int * major, int * minor) {
unsigned char uuid[16];
int i;
if (strlen(s) != 36 ||
s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-')
goto bad_uuid;
for (i=0; i<16; i++) {
if (*s == '-') s++;
if (!isxdigit(s[0]) || !isxdigit(s[1]))
goto bad_uuid;
uuid[i] = ((fromhex(s[0])<<4) | fromhex(s[1]));
s += 2;
}
return get_spec_by_x(UUID, (char *)uuid, major, minor);
bad_uuid:
fprintf(stderr, _("mount: bad UUID"));
return 0;
}
char *
get_spec_by_volume_label(const char *s, int * major, int * minor) {
return get_spec_by_x(VOL, s, major, minor);
}
int display_uuid_cache(void) {
struct uuidCache_s * u;
size_t i;
uuidcache_init();
u = uuidCache;
while (u) {
printf("%s %s ", u->device, u->label);
for (i = 0; i < sizeof(u->uuid); i++) {
if (i == 4 || i == 6 || i == 8 || i == 10)
printf("-");
printf("%x", u->uuid[i] & 0xff);
}
printf("\n");
u = u->next;
}
return 0;
}

View File

@@ -1,2 +0,0 @@
char * get_spec_by_uuid(const char *uuid, int * major, int * minor);
char * get_spec_by_volume_label(const char *volumelabel, int * major, int * minor);

View File

@@ -1,139 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <stdio.h>
#include <fcntl.h>
static dev_t try_name(char *name, int part)
{
char path[64];
char buf[32];
int range;
dev_t res;
char *s;
int len;
int fd;
unsigned int maj, min;
/* read device number from .../dev */
sprintf(path, "/sys/block/%s/dev", name);
fd = open(path, O_RDONLY);
if (fd < 0)
goto fail;
len = read(fd, buf, 32);
close(fd);
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
if (sscanf(buf, "%u:%u", &maj, &min) != 2)
goto fail;
res = makedev(maj, min);
if (maj != major(res) || min != minor(res))
goto fail;
/* if it's there and we are not looking for a partition - that's it */
if (!part)
return res;
/* otherwise read range from .../range */
snprintf(path, 64, "/sys/block/%s/range", name);
fd = open(path, O_RDONLY);
if (fd < 0)
goto fail;
len = read(fd, buf, 32);
close(fd);
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
range = strtoul(buf, &s, 10);
if (*s)
goto fail;
/* if partition is within range - we got it */
if (part < range)
return res + part;
fail:
return 0;
}
/*
* Convert a name into device number. We accept the following variants:
*
* 1) device number in hexadecimal represents itself
* 2) /dev/nfs represents Root_NFS (0xff)
* 3) /dev/<disk_name> represents the device number of disk
* 4) /dev/<disk_name><decimal> represents the device number
* of partition - device number of disk plus the partition number
* 5) /dev/<disk_name>p<decimal> - same as the above, that form is
* used when disk name of partitioned disk ends on a digit.
*
* If name doesn't have fall into the categories above, we return 0.
* sysfs is used to check if something is a disk name - it has
* all known disks under bus/block/devices. If the disk name
* contains slashes, name of driverfs node has them replaced with
* bangs. try_name() does the actual checks, assuming that sysfs
* is mounted on /sys.
*
* Note that cases (1) and (2) are already handled by the kernel,
* so we can ifdef them out, provided that we check real-root-dev
* first.
*/
dev_t name_to_dev_t(char *name)
{
char s[32];
char *p;
dev_t res = 0;
int part;
if (strncmp(name, "/dev/", 5) != 0) {
#if 1 /* kernel used to do this */
unsigned maj, min;
if (sscanf(name, "%u:%u", &maj, &min) == 2) {
res = makedev(maj, min);
if (maj != major(res) || min != minor(res))
return 0;
} else {
res = strtoul(name, &p, 16);
if (*p)
return 0;
}
#endif
return res;
}
name += 5;
#if 1 /* kernel used to do this */
if (strcmp(name, "nfs") == 0)
return makedev(0, 255);
#endif
if (strlen(name) > 31)
return 0;
strcpy(s, name);
for (p = s; *p; p++)
if (*p == '/')
*p = '!';
res = try_name(s, 0);
if (res)
return res;
while (p > s && isdigit(p[-1]))
p--;
if (p == s || !*p || *p == '0')
return 0;
part = strtoul(p, NULL, 10);
*p = '\0';
res = try_name(s, part);
if (res)
return res;
if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
return 0;
p[-1] = '\0';
return try_name(s, part);
}

View File

@@ -1,149 +0,0 @@
.TH NASH 8 "Mon Aug 02 2004"
.SH NAME
nash \- script interpretor to interpret linuxrc images
.SH SYNOPSIS
\fBnash\fR [--quiet] [--force] \fIscript\fR
.SH DESCRIPTION
\fBnash\fR is a very simple script interpretor designed to be as small as
possible. It is primarily designed to run simple linuxrc scripts on an initrd
image. Arguments to commands may be enclosed in either single or double
quotes to allow spaces to be included in the arguments. Spaces outside of
quotations always delineate arguments, and so backslash escaping is supported.
Additionally, if nash is invoked as \fBmodprobe\fR, it will immediately
exit with a return code of zero. This is to allow initrd's to prevent some
extraneous kernel error messages during startup.
There are two types of commands, built in and external. External commands
are run from the filesystem via execve(). If commands names are given without
a path, nash will search it's builtin PATH, which is /usr/bin, /bin,
/sbin, /usr/sbin.
Currently, \fBnash\fR supports the following built in commands.
.TP
\fBaccess -[r][w][x][f] \fIpath\fR
Tells whether the current user has sufficient permissions to read, write, or
execture \fIpath\fR, or if the file exists (see \fBaccess(2)\fR for more
information).
.TP
\fBecho [item]* [> \fIfilename\fR]\fR
Echos the text strings given to a file, with a space in between each
item. The output may be optionally redirected to a file.
\fBexec\fR \fI<command>\fR
The command given is execed, overlaying the nash process.
.TP
\fBfind \fIdir\fR -name \fIname\fR
Display the path to files named \fIname\fR in or below directory \fIdir\FR.
This is a \fBvery\fR limited implementation of find(1).
.TP
\fBfindlodev\fR
Prints the full path to the first unused loopback block device on the
system. If none is available, no output is displayed.
.TP
\fBlosetup \fI/dev/loopdev\fR \fIfile\fR
Binds \fIfile\fR to the loopback device \fI/dev/loopdev\fR. See
\fBlosetup(8)\fR for information on loopback devices.
.TP
\fBmkdevices\fR \fIpath\fR
Creates device files for all of the block devices listed in
\fB/proc/partitions\fR in the directory specfied by \fIpath\fR.
.TP
\fBmkdir\fR \fI[-p]\fR \fIpath\fR
Creates the directory \fIpath\fR. If \fI-p\fR is specified, this command
will not complain if the directory exists. Note this is a subset of the
standard \fBmkdir\fR \fI-p\fR behavior.
.TP
\fBmknod\fR \fIpath\fR \fI[c|b]\fR \fImajor\fR \fIminor\fR
Creates a device inode for \fIpath\fR. This is identical to \fBmkdev\fR(1)
which the exceptions that it will not create named pipes and if the directories
in \fIpath\fR do not exist they will be automatically created.
.TP
\fBmkdmnod\fR
Creates a device inode for the device mapper control inode as
\fI/dev/mapper/control\fR. If it already exists with the correct
major/minor, it will not be recreated.
.TP
\fBmkrootdev \fIpath\fR
Makes \fIpath\fR a block inode for the device which should be mounted
as root. To determine this device nash uses
the device suggested by the root= kernel command line argument (if
root=LABEL is used devices are probed to find one with that label). If
no root= argument is available, /proc/sys/kernel/real-root-dev provides
the device number.
.TP
\fBmount \fI[--ro]\fR -o \fIopts\fR -t \fItype\fR \fIdevice\fR \fImntpoint\fR
Mounts a filesystem. It does not support NFS, and it must be used in
the form given above (arguments must go first). If \fIdevice\fR is of the form
\fBLABEL=\fIfoo\fR the devices listed in /fB/proc/partitions\fR will
be searched, and the first device with a volume label of \fIfoo\fR will
be mounted. Normal \fBmount\fR(2) options are supported, and \fB--ro\fR will
mount the filesystem read only for compatibility with older versions of nash.
The \fBdefaults\fR mount option is silently ignored.
.TP
\fBpivot_root \fInewrootpath\fR \fIoldrootpath\fR
Makes the filesystem mounted at \fInewrootpath\fR the new root filesystem,
and mounts the current root filesystem as \fIoldrootpath\fR.
.TP
\fBreadlink \fIpath\fR
Displays the value of the symbolic link \fIpath\fR.
.TP
\fBraidautorun \fImddevice\fR
Runs raid autodetection on all raid-typed partitions. \fImddevice\fR must
be a raid device (any will do).
.TP
\fBsetquiet\fR
Cause any later echos in this script to not be displayed.
.TP
\fBshowlabels\fR
Display a table of devices, their filesystem labels, and their uuids.
.TP
\fBsleep \fInum\fR
Sleep for \fInum\fR seconds
.TP
\fBswitchroot \fInewrootpath\fR
Makes the filesystem mounted at \fInewrootpath\fR the new root
filesystem by moving the mountpoint. This will only work in 2.6 or
later kernels.
.TP
\fBumount \fIpath\fR
Unmounts the filesystem mounted at \fIpath\fR.
.SH RETURN VALUE
Returns 0 is the last command succeeded or 1 if it failed.
.SH OPTIONS
.TP
\fB-\-force\fR
Allows \fBforce\fR really execute the script, even though \fBnash\fR doesn't
appear to be running from an initrd image.
.SH BUGS
Probably many. \fBnash\fR is \fbnot a shell\fR, and it shouldn't be thought of
as one. It isn't entirely different from a shell, but that's mostly by
accident.
.SH AUTHOR
.nf
Erik Troan <ewt@redhat.com>
.fi

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
#!nash
# this is a comment
echo "hello"
echo "hello world" > foo
echo "hi" "there" everyone
insmod /lib/modules/2.4.0-0.36/kernel/drivers/usb/storage/usb-storage.o 'foo=bar' "bell=hops"
mount -t ext2 /dev/hda1 /boot
losetup /dev/loop0 /tmp/bootnet.img