心想事成 发表于 2004-12-31 15:29:38

routeros启动后,默认的shell是ash以下是启动脚本:inittab

CODE
id:3:initdefault:# System initialization.si::sysinit:/etc/rc.d/rc.sysinit# haltl0:0:wait:/etc/rc.d/rc.halt# startingl3:3:wait:/etc/rc.d/rc.start# rebootingl6:6:wait:/etc/rc.d/rc.reboot# Things to run in every runlevel.ud::once:/sbin/update# Trap CTRL-ALT-DELETEca::ctrlaltdel:/sbin/shutdown -t3 -r now# Consoles1:3:respawn:/sbin/getty 38400 tty12:3:respawn:/sbin/getty 38400 tty2# Serial lines#s1:3:respawn:/sbin/getty -L 9600 ttyS0 vt100
rc.sysinit

CODE
#!/bin/bash## /etc/rc.d/rc.sysinit - run once at boot time## Set the hostname./bin/hostname localhost/sbin/fsck -v -T -A -R -y >/dev/null 2>&1CHECK=noFSCK_ARGS=if [ -f /.fsck ]; then    CHECK=yes    FSCK_ARGS=-felif ! /sbin/diskman --big-disk; then    CHECK=yeselif [ ! -f /.asked ]; then    echo    echo "It is recomended to check your disk drive for errors,"    echo "but it may take a while (~1min for 1Gb)."    echo "It can be done later with \"/system check-disk\"."    if /bin/ask -t 10 "Do you want to do it now?"; then CHECK=yes; fi    echofiRC=if [ "$CHECK" = "yes" ]; then    echo "Checking disk integrity..."    /sbin/fsck $FSCK_ARGS -v -T -y / >/dev/null 2>&1    RC=$?elif [ ! -f /.nofsck ]; then    echo "Doing full check..."    /sbin/fsck -v -T -p -y / >dev/null 2>&1    RC=$?fiif [ "$RC" = "" ]; then    echo -nelif [ $RC -eq 0 ]; then    echo "No errors found."    echoelif [ $RC -eq 1 ] || [ $RC -eq 2 ] || [ $RC -eq 3 ]; then    echo "Found errors, corrected."    kill -INT 1    exit 1else    echo "ERROR: Your disk file system is corrupted!"    echo "Please, reinstall your router"    kill -WINCH 1    exit 1fi# Remount the root filesystem read-write.echo "Remounting root filesystem in read-write mode." >/dev/null/bin/mount -n -o remount,rw,noatime /rm -f /.fsckecho >/.asked# Clear mtab: >/etc/mtab# Enter root into mtab./bin/mount -f /# Should be removed later/bin/ln -f /etc/ld.so.cache /etc/ld.so.cache.old/sbin/ldconfig 2>/dev/null# Mount all other filesystems (except for NFS). Contrary to standard usage,# filesystems are NOT unmounted in single user mode./bin/mount -a -t nonfs/bin/mkdir -p /ram/bin/mount -t tmpfs tmpfs /ram/sbin/diskman --to-ext3# Clean out /etc./bin/rm -f /etc/mtab~ /fastboot /etc/nologin/bin/rm -f /var/log/* /var/run/*/bin/rm -f /var/lock/*: >/var/run/utmp#make device nodes that get modified/bin/mknod /ram/ptmx c 5 2# Cleanup tmp files/bin/rm -rf /tmp/*# Cleanup core files/bin/rm -rf /core# Remove unneeded stuffrm -f /bin/sh# Set the system clock./sbin/hwclock --hctosys --localtime --noadjfile >/dev/null/bin/date >/dev/null# Turn on routingecho "1" >/proc/sys/net/ipv4/ip_forward# Set maximum opened file limitecho "32768" >/proc/sys/fs/file-maxif [ ! -f /nova/etc/logo ]; then        cp /nova/etc/logo.org /nova/etc/logofi/nova/bin/mkissue /etc/issueif [ ! -f /nova/etc/url ]; then        cp /nova/etc/url.org /nova/etc/urlfiif [ ! -f /home/web/index2.html ]; then        cp /home/web/index2.html.org /home/web/index2.htmlfiif [ ! -f /nova/lib/console/logo.txt ]; then        cp /nova/lib/console/logo.txt.org /nova/lib/console/logo.txtfiif [ ! -f /etc/issue ]; then        /nova/bin/mkissue /etc/issuefi# set hostnameif [ ! -f /etc/ident ]; then        echo -n $(cat /nova/etc/logo) >>/etc/identfihostname "$(cat /etc/ident)"# fix some permschmod a+x /varchmod a+x /var/pdbchmod a+x /var/pdb/systemexit 0
rc.start

CODE
#!/bin/bashecho "Starting..."/etc/rc.d/rc.sysinit || exit 1# disable core filesulimit -c 0# set maximum opened files per processulimit -H -n 32768 >/dev/nullulimit -n 32768# start syslog deamonfor i in /etc/rc.d/run.d/S*; do    if [ -f $i ]; then        $i    fidoneexit 0
S06modules

CODE
#!/bin/bash# load netfilter modules/sbin/modprobe ip_tables/sbin/modprobe iptable_filter/sbin/modprobe iptable_nat/sbin/modprobe iptable_mangle/sbin/modprobe iptable_raw/sbin/modprobe ip_conntrack/sbin/modprobe ipt_LOG2/sbin/modprobe ipt_PASSTHR/sbin/modprobe ipt_MASQUERADE/sbin/modprobe ipt_REJECT/sbin/modprobe ipt_TCPMSS/sbin/modprobe ipt_REDIRECT/sbin/modprobe ipt_MARK/sbin/modprobe ipt_NOTRACK/sbin/modprobe ipt_limit/sbin/modprobe ipt_mac/sbin/modprobe ipt_mark/sbin/modprobe ipt_state/sbin/modprobe ipt_CONNMARK/sbin/modprobe ipt_connmark/sbin/modprobe ipt_string/sbin/modprobe ipt_FTOS/sbin/modprobe ipt_tos/sbin/modprobe ipt_connlimit# load point-to-point protocol matcher/sbin/modprobe ipt_p2p/sbin/modprobe logfw/sbin/modprobe ipip/sbin/modprobe ebtables/sbin/modprobe ebtable_filter/sbin/modprobe ebt_ip/sbin/modprobe gre/sbin/modprobe eogre# load packing scheduler/sbin/modprobe sch_agr# load per-connection queue/sbin/modprobe sch_pcq# load queue clasifiers/sbin/modprobe cls_linear# load pci modules/nova/bin/pcipnp >/dev/log241 2>&1/sbin/modprobe imq# load per-interface qeueue (only after imq is present)/sbin/modprobe sch_rate/sbin/modprobe ticker
分析routeros对硬件的自动检测是通过/nova/bin/pcipnp这个程序进行的.

心想事成 发表于 2004-12-31 15:41:43

我想通过更改它的shell,使其可以执行标准的linux命令.

wavecb 发表于 2004-12-31 20:09:40

好,感觉没有什么必要

zhanghui 发表于 2004-12-31 21:42:47

支持楼主的想法!近期很忙,没时间研究了。

Horseman 发表于 2004-12-31 22:25:22

支持楼主,这样的话ROS的功能就更强大了!前两天我还想改它的默认WEB页面呢,可是本人水平有限,找不到,找到了用起来也不方便,要是楼主成功的话,那改默认的WEB和FTP就是小事一桩了,先谢谢楼主了!期待中。。。。。。

jack_i5 发表于 2004-12-31 23:41:46

就算可以改,稳定性呢?是否有保证?以前有人说过想把CS集成到ROS里,我想假如楼主成功,那这个愿望应该就可以实现!期待中,,,,,,

猫王 发表于 2005-1-1 11:06:47

我不认为修改ROS的shell是明智的想法,虽然我也这么想过,如果要修改的话,还不如直接搞linux

dajun 发表于 2005-1-1 23:37:25

支持,这样能扩展RouteOS在其他方面的应用。

lzbnet 发表于 2005-1-2 13:03:20

顶,支持!

Horseman 发表于 2005-1-2 13:11:23

ROS功能强大,操作简单,但开放性不好,无法扩展功能;IPCOP和SW功能强大,开放性好,但操作复杂;真的想找一个操作简单,开放性又好的路由软件,要是楼主成功的话,对于象我这样的高不成低不就的菜鸟来说,真是一大福音,严重支持楼主,希望能助一臂之力,虽然我很菜,哈哈!

txwwy 发表于 2005-1-2 13:46:53

up

soft_route 发表于 2005-10-10 07:54:59

先作个记号。

rainmo 发表于 2005-10-10 09:34:47

关注

hyh0826 发表于 2005-10-11 01:05:16

严重支持

严重支持这样的学术研究,可我真的帮不上忙~!

dell0721 发表于 2005-10-29 13:44:26

严重瞅瞅

如果这样可以实现的话,岂不是可以自己编译CHINA OS了嘛?
呵呵。不管怎么样,支持。。。
页: [1] 2
查看完整版本: 怎样更改routeros的shell?