小米路由r3d安装entware实现opkg

官方:

https://entware.net/

开源:

https://github.com/Entware/Entware

此版本修复了自启动问题

将下面代码保存为xiaomi_r3d_router_entware.sh

#!/bin/sh

unset LD_LIBRARY_PATH
unset LD_PRELOAD

# For  miwifi HD R3D

echo "Info: https://www.freebaic.cn/"
echo "Info: For miwifi HD R3D"
echo "Info: Checking for prerequisites and creating folders..."

if [ -d /userdisk/data/opt ]
then
    echo "Warning: Folder /userdisk/data/opt exists!"
else
    mkdir -p /userdisk/data/opt
    mount -o bind /userdisk/data/opt  /opt
fi
# no need to create many folders. entware-opt package creates most
for folder in bin etc lib/opkg tmp var/lock
do
  if [ -d "/opt/$folder" ]
  then
    echo "Warning: Folder /opt/$folder exists!"
    echo "Warning: If something goes wrong please clean /opt folder and try again."
  else
    mkdir -p /opt/$folder
  fi
done

echo "Info: Opkg package manager deployment..."
DLOADER="ld-linux.so.3"
URL=http://bin.entware.net/armv7sf-k3.2/installer
wget $URL/opkg -O /opt/bin/opkg
chmod 755 /opt/bin/opkg
wget $URL/opkg.conf -O /opt/etc/opkg.conf
wget $URL/ld-2.27.so -O /opt/lib/ld-2.27.so
wget $URL/libc-2.27.so -O /opt/lib/libc-2.27.so
wget $URL/libgcc_s.so.1 -O /opt/lib/libgcc_s.so.1
wget $URL/libpthread-2.27.so -O /opt/lib/libpthread-2.27.so
cd /opt/lib
chmod 755 ld-2.27.so
ln -s ld-2.27.so $DLOADER
ln -s libc-2.27.so libc.so.6
ln -s libpthread-2.27.so libpthread.so.0

echo "Info: Basic packages installation..."
/opt/bin/opkg update
/opt/bin/opkg install entware-opt

# Fix for multiuser environment
chmod 777 /opt/tmp

# now try create symlinks - it is a std installation
if [ -f /etc/passwd ]
then
    ln -sf /etc/passwd /opt/etc/passwd
else
    cp /opt/etc/passwd.1 /opt/etc/passwd
fi

if [ -f /etc/group ]
then
    ln -sf /etc/group /opt/etc/group
else
    cp /opt/etc/group.1 /opt/etc/group
fi

if [ -f /etc/shells ]
then
    ln -sf /etc/shells /opt/etc/shells
else
    cp /opt/etc/shells.1 /opt/etc/shells
fi

if [ -f /etc/shadow ]
then
    ln -sf /etc/shadow /opt/etc/shadow
fi

if [ -f /etc/gshadow ]
then
    ln -sf /etc/gshadow /opt/etc/gshadow
fi

if [ -f /etc/localtime ]
then
    ln -sf /etc/localtime /opt/etc/localtime
fi

echo '#!/bin/sh /etc/rc.common

START=91
STOP=90

start() {        
	# commands to launch application
	mount -o bind /userdisk/data/opt  /opt
	mount -o bind /userdisk/data/opt/root /root
	# add auto start
	/opt/etc/init.d/rc.unslung start
}                 

stop() {          
	# commands to kill application
	umount /opt
}' > /etc/init.d/entwarer3d

chmod 777 /etc/init.d/entwarer3d
/etc/init.d/entwarer3d enable

echo '. /opt/etc/profile' >> /etc/profile

echo "Info: Congratulations!"
echo "Info: If there are no errors above then Entware was successfully initialized."
echo "Info: Found a bug? Please report at https://entware.net/"

for i in `seq -w 60 -1 1`
        do
          echo -ne "安装完毕!路由器将在$i秒后重启\r";
          sleep 1;
      done
reboot

然后,放文件上传到/root

然后执行 bash xiaomi_r3d_router_entware.sh

自动安装完成即可。

然后你就可以使用opkg install nginx方式安装需要的软件

具体软件包,请查看官方

http://bin.entware.net/armv7sf-k3.2/

附加:

ipkg update(下载并更新最新的软件包列表)
ipkg upgrade(更新所有已安装软件)
ipkg list(列出可安装包)
ipkg install packagename(安装包)
ipkg remove packagename(移除包)

你也可以自行配置其它armv7的linux软件

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注