前提:
· R3P路由器已开启ssh(办法可见)
确认路由器架构信息
root@XiaoQiang:~# cat /etc/openwrt_release DISTRIB_ID="OpenWrt"DISTRIB_RELEASE="Attitude Adjustment"DISTRIB_REVISION="unknown"DISTRIB_CODENAME="attitude_adjustment"DISTRIB_TARGET="ramips/mt7621" #此处显示路由器的架构信息DISTRIB_DESCRIPTION="OpenWrt Attitude Adjustment 12.09.1"
装置opkg
· 应用/opt门路(原脚本指定)装置
留神:会挂载笼罩原有/opt门路下的内容
ssh 192.168.31.1mkdir -p /userdisk/opkg/optmount -o bind /userdisk/opkg/opt /opt #会笼罩/opt原有内容,按需应用cd /userdisk/opkgwget http://pkg.entware.net/binaries/mipsel/installer/installer.shchmod +x installer.sh./installer.sh echo "export PATH=${dir}sbin:${dir}bin:"'$PATH' >> /etc/profilesource /etc/profile#不应用时卸载门路(重启也可)ummount /opt
· 自定义门路装置(未测试)
root@XiaoQiang:~# ls /opt/filetunnel plugin_sandbox
因为不晓得/opt目录中已存在的上边两个目录是做什么的,
为了不影响原有文件构造,有了这个思路,
其实就是替换了/opt/的门路。
未经测试,请自行测试
未经测试,请自行测试
未经测试,请自行测试
ssh 192.168.31.1dir='/userdisk/opkg/'mkdir -p $dircd $dirwget http://pkg.entware.net/binaries/mipsel/installer/installer.shchmod +x installer.shsed -i "s%/opt/%${dir}%g" installer.shsed -i "/installation/i dir=${dir}" installer.shsed -i '/installation/i for f in `grep -rl "/opt/" $dir`; do sed -i "s%/opt/%${dir}%g" $f; done' installer.sh./installer.shecho "export PATH=${dir}sbin:${dir}bin:"'$PATH' >> /etc/profilesource /etc/profileopkg updata