#!/bin/sh echo "------run rc.modules file-----" #export boot_partition=$(fw_printenv -n boot_partition 2>/dev/null) # if [ x${boot_partition} == xboot ];then # /sbin/insmod /lib/modules/5.4.61/usb-storage.ko # /sbin/insmod /lib/modules/5.4.61/sunxi_gpadc.ko /sbin/insmod /lib/modules/5.4.61/gt9xxnew_ts.ko echo 0x07090160 0x083F10F7 > /sys/class/sunxi_dump/write # /sbin/insmod /lib/modules/5.4.61/8723ds.ko # /sbin/insmod /lib/modules/5.4.61/8189fs.ko # /sbin/insmod /lib/modules/5.4.61/r8188eu.ko # /sbin/insmod /lib/modules/5.4.61/8821cu.ko # sleep 1 # wpa_supplicant -D wext -c /etc/wpa_supplicant.conf -i wlan0 & # udhcpc -i wlan0 # wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wifi/wpa_supplicant.conf -B amixer -D hw:audiocodec cset name='Headphone Switch' 1 && \ amixer -D hw:audiocodec cset name='Headphone volume' 25 #ifconfig eth0 192.168.1.132 up # 读取interfaces文件 INTERFACES_FILE="/etc/network/interfaces" # 检查文件是否存在 if [ ! -f "$INTERFACES_FILE" ]; then echo "Error: $INTERFACES_FILE not found." `ifconfig eth0 192.168.1.132 up` fi # else # ifconfig eth0 up # sleep 2 # /sbin/udhcpc -n # if [ $? -eq 1 ]; then # sleep 1 # interface="eth0" # ip_address="" # netmask="" # gateway="" # while IFS= read -r line; do # # 检查行是否以 iface 开始,并包含指定的接口名 # if [[ "$line" == "iface $interface inet static" ]]; then # # 读取下一行,它应该是 address # while read -r next_line; do # # 检查下一行是否以 address 开始 # if echo "$next_line" | grep -q "address" ; then # # 提取IP地址(从"address "之后开始) # ip_address=`echo ${next_line} | awk -F ' ' '{print $2}'` # #echo $ip_address # #break # 找到IP后退出循环 # elif echo "$next_line" | grep -q "netmask" ;then # netmask=`echo ${next_line} | awk -F ' ' '{print $2}'` # elif echo "$next_line" | grep -q "gateway" ;then # gateway=`echo ${next_line} | awk -F ' ' '{print $2}'` # else # break # #echo "asdas" # fi # done # fi # done < $INTERFACES_FILE # echo "$interface" "$ip_address" "$gateway" "$netmask" # if [[ "$ip_address" == "" ]]; then # `ifconfig eth0 192.168.1.132 up` # else # `ifconfig "$interface" "$ip_address" netmask "$netmask" up` # `route del default` # `route add default gw "$gateway"` # fi # else # echo "hello udhcp!!!" # fi # fi interface="eth0" ip_address="" netmask="" gateway="" auto_flag="" ip_flag="" while IFS= read -r line; do if [[ "$line" == "iface $interface inet static" ]]; then ip_flag="1" auto_flag="1" elif [[ "$line" == "iface $interface inet dhcp" ]];then ip_flag="2" auto_flag="2" fi if [[ "$ip_flag" == "1" ]]; then if echo "$line" | grep -q "address" ; then # 提取IP地址(从"address "之后开始) ip_address=`echo ${line} | awk -F ' ' '{print $2}'` #echo $ip_address #break # 找到IP后退出循环 elif echo "$line" | grep -q "netmask" ;then netmask=`echo ${line} | awk -F ' ' '{print $2}'` elif echo "$line" | grep -q "gateway" ;then gateway=`echo ${line} | awk -F ' ' '{print $2}'` fi if [[ "$ip_address" != "" && "$netmask" != "" && "$gateway" != "" ]]; then ip_flag="" fi fi done < $INTERFACES_FILE echo $ip_address $netmask $gateway $auto_flag $ip_flag if [[ "$auto_flag" == "1" && "$ip_address" != "" && "$netmask" != "" && "$gateway" != "" ]];then `ifconfig "$interface" "$ip_address" netmask "$netmask" up` `route del default` `route add default gw "$gateway"` echo "Static" elif [[ "$auto_flag" == "2" ]];then echo "get is DHCPC" /sbin/udhcpc -n else echo "Other FAILED" `ifconfig eth0 192.168.1.132 up` fi ./opt/led_flash & ssh-keygen -A /etc/init.d/sshd start export QT_BOOT=/usr/lib/arm-qt export QTDIR=/usr/lib/arm-qt export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/arm-qt/lib export LD_LIBRARY_PATH=$QTDIR/lib:$QTDIR/plugins/platforms:$LD_LIBRARY_PATH export QT_PLUGIN_PATH=$QTDIR/plugins export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE export QT_QPA_FONTDIR=$QTDIR/lib/fonts export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb1 RUNDIR=/mnt/UDISK APPDIR=$RUNDIR/app WEBDIR=$RUNDIR/web SNMPDIR=$APPDIR/snmp # source /etc/qtenv.sh export MIBDIRS=$SNMPDIR/mibs export LD_LIBRARY_PATH=$APPDIR/lib:${LD_LIBRARY_PATH} start_snmpd() { $SNMPDIR/bin/snmpd -Cc $SNMPDIR/conf/snmpd.conf -Lo & chmod 777 /var/agentx/master } start_pdu() { #run smartPDU $APPDIR/smartPDU & } led_on() { #light led echo 160 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio160/direction echo 161 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio161/direction echo 162 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio162/direction echo 131 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio131/direction echo 136 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio136/direction echo 1 > /sys/class/gpio/gpio136/value } start_lcd() { # light lcd led_on # fbinit $APPDIR/Qt_Test -platform linuxfb:fb=/dev/fb1 & } app_start() { case "$1" in smartPDU) start_pdu ;; snmpd) start_snmpd ;; Qt_Test) start_lcd ;; all) start_snmpd start_pdu start_lcd ;; *) exit 1 esac } app_stop() { case "$1" in smartPDU) killall $1 ;; snmpd) killall $1 ;; Qt_Test) killall $1 ;; all) killall snmpd smartPDU Qt_Test ;; *) exit 1 esac } #app_start all start_snmpd sleep 4 start_pdu sleep 5 start_lcd sh /mnt/UDISK/app/smartMonitor.sh & # sleep 20 # led_on # fi