Advertisement
xhark

test/equip_test.sh

Oct 21st, 2015
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.18 KB | None | 0 0
  1. # Information : http://blogmotion.fr/feedback/avis-camera-xiaoyi-ants-13728
  2. # by @xhark
  3.  
  4. echo "#################################################################"
  5. echo "#      ^_^ ^_^ ^_^  This is equip_test.sh  ^_^ ^_^ ^_^          #"
  6. echo "#                                                               #"
  7. echo "#      Specially for http://4pda.ru/ by chex01 <chex01@mail.ru> #"
  8. echo "#                                    Recent changes: 28.09.2015 #"
  9. echo "#                                    traduction par @xhark      #"
  10. echo "#################################################################"
  11.  
  12. #Modifiez le réglage de votre choix  (!!! SANS ESPACE !!!)
  13. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  14.  
  15. my_version=1.8.5.1K_201508311131    # le nom de la dernière version du firmware
  16. my_gmt=GMT+6                        # Pour moscou [GMT+5] ou [EDT+5]
  17.  
  18. # Paramètre: on | off | default
  19. led=default                 # led
  20. motion_detection=default    # détecteur de mouvement
  21.  
  22. # Paramètre: on | off
  23. rtsp_server=on      # serveur RTSP
  24. http_server=on      # serveur WEB
  25.  
  26. telnet=on           # serveur Telnet
  27. ftp_server=on       # serveur FTP
  28.  
  29. image_flip=off      # Tourner l'image de 180 deg
  30. image_mirror=off    # Image en mode mirroir
  31.  
  32. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  33.  
  34. # ---------- Можно удалить этот блок после первого запуска ----------- #
  35. if [ -f "/etc/init.d/S88telnet" ]; then                                #
  36. rm -f /etc/init.d/S88telnet                                            #
  37. fi                                                                     #
  38. # -------------------------------------------------------------------- #
  39.  
  40. # Démarrage auto de FTP et Telnet
  41. #if [ ! -f "/etc/init.d/S88telnet" ]; then  
  42. #echo "#!/bin/sh" > /etc/init.d/S88telnet
  43. #echo "telnetd &" >> /etc/init.d/S88telnet
  44. #echo "tcpsvd -vE 0.0.0.0 21 ftpd -w / &" >> /etc/init.d/S88telnet
  45. #chmod 755 /etc/init.d/S88telnet && reboot
  46. #fi
  47.  
  48. # Lancement deamon telnet
  49. if [ "$telnet" == "on" ]; then  
  50. telnetd &
  51. fi
  52.  
  53. # Lancement deamon FTP
  54. if [ "$ftp_server" == "on" ]; then  
  55. tcpsvd -vE 0.0.0.0 21 ftpd -w / &
  56. fi
  57.  
  58. # Spoofer la version de l'application (pour éviter de toujours répondre "non")
  59. now_version=`cat /home/version |grep version |head -n1 |cut -d= -f2`
  60. if [ "$my_version" != "$now_version" ]; then  
  61. sed "s/$now_version/$my_version/" /home/version > /home/version_temp && mv /home/version_temp /home/version
  62. fi
  63.  
  64. # Controle des LEDs
  65. if [ "$led" != "default" ]; then  
  66. led_str=`cat /etc/ui.conf |grep ddnsSIndex |head -n1 |cut -d= -f2`
  67. if [ "$led" == "on" ]; then
  68. sed "s/ddnsSIndex=$led_str/ddnsSIndex=0/" /etc/ui.conf > /etc/ui.conf_temp && mv /etc/ui.conf_temp /etc/ui.conf
  69. fi
  70. if [ "$led" == "off" ]; then
  71. sed "s/ddnsSIndex=$led_str/ddnsSIndex=1/" /etc/ui.conf > /etc/ui.conf_temp && mv /etc/ui.conf_temp /etc/ui.conf
  72. fi
  73. fi
  74.  
  75. # Gestion de la détection de mouvement
  76. if [ "$motion_detection" != "default" ]; then  
  77. mot_str=`cat /etc/ui.conf |grep ddnsWmode |head -n1 |cut -d= -f2`
  78. if [ "$motion_detection" == "on" ]; then
  79. sed "s/ddnsWmode=$mot_str/ddnsWmode=0/" /etc/ui.conf > /etc/ui.conf_temp && mv /etc/ui.conf_temp /etc/ui.conf
  80. fi
  81. if [ "$motion_detection" == "off" ]; then
  82. sed "s/ddnsWmode=$mot_str/ddnsWmode=1/" /etc/ui.conf > /etc/ui.conf_temp && mv /etc/ui.conf_temp /etc/ui.conf
  83. fi
  84. fi
  85.  
  86. # Réglage fuseau horaire
  87. echo "$my_gmt" > /etc/TZ
  88.  
  89. # -------------------------------------------------------------------- #
  90.  
  91. if [ ! -f "/etc/localtime_old" ]; then  
  92. mv /etc/localtime /etc/localtime_old
  93. cd / && tar xvzf /home/hd1/test/update/localtime.tar.gz
  94. fi
  95.  
  96. # Restore le server
  97. if [ ! -f "/home/web/server_old" ]; then  
  98. mv /home/web/server /home/web/server_old
  99. cd / && tar xvzf /home/hd1/test/update/server.tar.gz
  100. chmod +x /home/web/server
  101. fi
  102.  
  103. # Restore rtspsvr
  104. if [ ! -f "/home/rtspsvr_old" ]; then  
  105. mv /home/rtspsvr /home/rtspsvr_old
  106. cd / && tar xvzf /home/hd1/test/update/rtspsvr.tar.gz
  107. chmod +x /home/rtspsvr
  108. fi
  109.  
  110. ########################################################################
  111. #                   СОДЕРЖИМОЕ ОРИГИНАЛЬНОГО init.sh                   #        
  112. ########################################################################
  113.  
  114. #killall telnetd
  115. #ifconfig eth0 down
  116. #
  117. #if [ -f "/home/do_format" ]; then
  118. #   /home/format
  119. #fi
  120. #
  121. #mkdir -p /tmp
  122. #mount tmpfs /tmp -t tmpfs -o size=32m
  123. #
  124. #if [ -f "/home/RT2870STA.dat" ]; then
  125. #   cp /home/RT2870STA.dat /etc/Wireless/RT2870STA/
  126. #   sync
  127. #fi
  128. #
  129. #rm /home/hd1 -r
  130. #rm /home/hd2 -r
  131. #mkdir -p /tmp/hd1/record
  132. #mkdir -p /tmp/hd1/record_sub
  133. #mkdir -p /tmp/hd2/record
  134. #mkdir -p /tmp/hd2/record_sub
  135. #ln -s /tmp/hd1 /home/hd1
  136. #ln -s /tmp/hd2 /home/hd2
  137. #
  138. #mount -t vfat /dev/hd1 /home/hd1
  139. #rm /home/mmap_tmpfs/mmap.info
  140. #
  141. #if [ -f "/home/hd1/test/equip_test.sh" ]; then
  142. #   /home/hd1/test/equip_test.sh
  143. #   exit
  144. #fi
  145.  
  146. if [ -f "/home/hd1/wpa_supplicant.conf1" ]; then
  147.     cp /home/ui.conf_bak /etc/ui.conf
  148. fi
  149.  
  150. export LD_LIBRARY_PATH=/home/libusr:$LD_LIBRARY_PATH
  151. mv /home/default.script /usr/share/udhcpc -f
  152.  
  153. rm /etc/resolv.conf
  154. ln -s /tmp/resolv.conf /etc/resolv.conf
  155.  
  156. /home/log_server &
  157.  
  158. cp /etc/wpa_supplicant.conf /home
  159. mv /home/hd1/wpa_supplicant.conf /home
  160. /home/crypt_file -d /home/hd1/crypt.bin /home/wpa_supplicant.conf
  161. rm /home/hd1/crypt.bin
  162. cp /home/hd1/wpa_supplicant.conf1 /home/wpa_supplicant.conf
  163.  
  164. cd /home
  165. mount |grep "/tmp"
  166. /home/productioninfoget.sh
  167. insmod cpld_periph.ko
  168.  
  169. cd /home/3518
  170. ./load3518_audio -i
  171.  
  172. if [ -f "/home/notfirst" ]; then
  173. if [ -f "/home/wpa_supplicant.conf" ]; then  
  174. echo " "
  175. else
  176. himm 0x20050074 0x06802424
  177. /home/rmm "/home/welcome.snd"
  178. /home/rmm "/home/start_wait.snd"    
  179. fi
  180. /home/checkdisk
  181. rm /home/do_format
  182. else
  183. if [ -f "/home/wpa_supplicant.conf" ]; then  
  184. himm 0x20050074 0x06802424
  185. /home/rmm "/home/welcome.snd"
  186. /home/rmm "/home/start_wait.snd"    
  187. fi
  188. fi
  189.  
  190. /home/led_ctl -boff -yon &
  191. insmod /home/mtprealloc7601Usta.ko
  192. insmod /home/mt7601Usta.ko
  193.  
  194. ifconfig ra0 up
  195.  
  196. #if [ -f "/home/need_update" ]; then
  197. #   /home/script/wificonn.sh 1
  198. #   if [ -f "/tmp/gw1" ]; then
  199. #   /home/need_update
  200. #   fi
  201. #fi
  202.  
  203. sysctl -w fs.mqueue.msg_max=256
  204. mkdir /dev/mqueue
  205. mount -t mqueue none /dev/mqueue
  206.  
  207. #insmod /home/cpld_wdg.ko
  208. #insmod /home/cpld_periph.ko
  209. #insmod /home/iap_auth.ko
  210. /home/gethwplatform
  211.  
  212. #now begin app
  213.    sysctl -w net.ipv4.tcp_mem='3072    4096    2000000'
  214.    sysctl -w net.core.wmem_max='2000000'
  215.    sysctl -w net.ipv4.tcp_keepalive_time=300 net.ipv4.tcp_keepalive_intvl=6 net.ipv4.tcp_keepalive_probes=3
  216.          
  217.    insmod /home/as-iosched.ko
  218.    echo "anticipatory" > /sys/block/mmcblk0/queue/scheduler
  219.    echo "1024" > /sys/block/mmcblk0/queue/read_ahead_kb  
  220.    
  221.    umount /home/hd1
  222.    umount /home/hd2
  223.    
  224.    mount -t vfat /dev/hd1 /home/hd1
  225.    mkdir /home/hd1/record
  226.    mkdir /home/hd1/record_sub
  227.    mount -t vfat /dev/hd2 /home/hd2
  228.    mkdir /home/hd2/record_sub
  229.    rm /home/web/sd/* -rf
  230.    #mount -t vfat /dev/hd1 /home/web/sd
  231.    
  232. cd /home/3518
  233. ./load3518_left -i
  234. /home/detect_ver
  235. himm 0x20050074 0x06802424
  236.    
  237. cd /home                  
  238.     ./peripheral &  
  239.     ./dispatch &
  240.     ./exnet &
  241.     #./mysystem &
  242.    
  243. if [ -f "/home/notfirst" ]; then        
  244. if [ -f "/home/wpa_supplicant.conf" ]; then        
  245. echo "wifi connectting"
  246. /home/monitor_wifi &
  247. cd /home
  248. else                              
  249. echo "1" > /tmp/waitdump
  250. echo "1" > /tmp/announce_success  
  251. /home/monitor_dump && rm /tmp/waitdump && /home/monitor_wifi &                
  252. cd /home
  253. fi
  254. else
  255. echo "first start"
  256. fi
  257.  
  258.     cd /home  
  259.     ./rmm &
  260.  
  261. while [ 1 -eq 1 ]
  262. do
  263. if [ -f "/tmp/waitdump" ]; then        
  264.                 echo "do waiting dump"                                
  265.         sleep 1
  266. else
  267.                 break
  268. fi
  269. done
  270.    
  271.     #cp update /tmp
  272.     #/tmp/update &
  273.     cp update.sh flash_eraseall crcCheck /home/tmpfs
  274.    
  275.     cd /home/web    
  276. #   ./server 80 &
  277.  
  278.     cd /home
  279.     ./record_event &
  280.     ./mp4record 60 &
  281. #   ./p2pserver &
  282. #   ./rtspsvr &
  283.     ./cloud &
  284.     /home/watch_process &
  285.  
  286. # -------------------------------------------------------------------- #
  287.  
  288. if [ "$http_server" == "on" ]; then
  289. cd /home/web && ./server 80 &
  290. fi
  291. if [ "$rtsp_server" == "on" ]; then
  292. cd /home && ./rtspsvr &
  293. fi
  294.  
  295. # -------------------------------------------------------------------- #
  296.  
  297. if [ -f "/home/notfirst" ]; then        
  298. echo "start ok!"   
  299. else                              
  300. echo "1" > /home/notfirst
  301. echo "first start, auto reboot!"
  302. reboot
  303. reboot
  304. fi  
  305.      
  306. sleep 5
  307.  
  308. himm 0x20050068 0x327c2c
  309. #himm 0x20050068 0x0032562c
  310. himm 0x20050074 0x06802424
  311. himm 0x20050078 0x18ffc001
  312. #himm 0x20050078 0x1effc001
  313. himm 0x20110168 0x10601
  314. himm 0x20110188 0x10601
  315. himm 0x20110184 0x03ff2
  316. himm 0x20030034 0x43
  317. himm 0x200300d0 0x1
  318. himm 0x2003007c 0x1
  319. himm 0x20030040 0x102
  320. himm 0x20030040 0x202
  321. himm 0x20030040 0x302
  322. himm 0x20030048 0x102
  323. himm 0x20030048 0x202
  324. himm 0x20030048 0x302
  325.  
  326.  
  327. rm /home/hd1/FSCK*
  328.  
  329. # -------------------------------------------------------------------- #
  330.  
  331. if [ "$image_flip" == "on" ]; then
  332. cd /tmp/hd1/test/update/ && ./img_func -flip on
  333. fi
  334. if [ "$image_mirror" == "on" ]; then
  335. cd /tmp/hd1/test/update/ && ./img_func -mirror on
  336. fi
  337.  
  338. # -------------------------------------------------------------------- #
  339.  #end for network test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement