1
0
mirror of https://github.com/fritz-smh/yi-hack synced 2025-06-08 00:16:17 +00:00

Fix missing stuff and add debug logs (activated from config file)

This commit is contained in:
fritz-smh 2016-03-21 21:42:08 +01:00
parent c464d1efc0
commit bb78ea65ec
2 changed files with 39 additions and 9 deletions

View File

@ -45,7 +45,8 @@ led() {
} }
LOG_FILE=/home/hd1/test/log.txt LOG_DIR=/home/hd1/test/
LOG_FILE=${LOG_DIR}/log.txt
log_init() { log_init() {
# clean the previous log file and add a starting line # clean the previous log file and add a starting line
@ -68,14 +69,19 @@ get_config() {
### first we assume that this script is started from /home/init.sh and will replace it from the below lines (which are not commented in init.sh : ### first we assume that this script is started from /home/init.sh and will replace it from the below lines (which are not commented in init.sh :
#if [ -f "/home/hd1/test/equip_test.sh" ]; then #if [ -f "/home/hd1/test/equip_test.sh" ]; then
# /home/hd1/test/equip_test.sh # /home/hd1/test/equip_test.sh
# exit # exit
#fi #fi
###################################################### ######################################################
# start of our custom script !!!!!! # start of our custom script !!!!!!
###################################################### ######################################################
### Launch Telnet server
log "Start telnet server..."
telnetd &
### Get FIRMWARE version ### Get FIRMWARE version
FIRMWARE_VERSION=$(sed -n 's/version=1.8.5.1\(.\)_.*/\1/p' /home/version) FIRMWARE_VERSION=$(sed -n 's/version=1.8.5.1\(.\)_.*/\1/p' /home/version)
@ -87,7 +93,6 @@ echo "GMT-1" > /etc/TZ
### first, let's do as the orignal script does.... ### first, let's do as the orignal script does....
export LD_LIBRARY_PATH=/home/libusr:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/home/libusr:$LD_LIBRARY_PATH
@ -166,7 +171,7 @@ cd /home
./dispatch & ./dispatch &
./exnet & ./exnet &
#./mysystem & #./mysystem &
count=5 count=5
while [ $count -gt 0 ] while [ $count -gt 0 ]
@ -191,6 +196,7 @@ cp /home/hd1/test/wpa_supplicant.conf /home/wpa_supplicant.conf
log_init log_init
log "The blue led is currently blinking" log "The blue led is currently blinking"
log "Firmware version letter = $FIRMWARE_VERSION" log "Firmware version letter = $FIRMWARE_VERSION"
log "Debug mode = $(get_config DEBUG)"
# first, configure wifi # first, configure wifi
@ -231,7 +237,7 @@ root_pwd=$(get_config ROOT_PASSWORD)
log "Start blue led on" log "Start blue led on"
led -yoff -bon led -yoff -bon
### Rename the timeout sound file to avoid being spammed with chinese audio stuff... ### Rename the timeout sound file to avoid being spammed with chinese audio stuff...
[ -f /home/timeout.g726 ] && mv /home/timeout.g726 /home/timeout.g726.OFF [ -f /home/timeout.g726 ] && mv /home/timeout.g726 /home/timeout.g726.OFF
@ -244,6 +250,15 @@ cd /home
sync sync
### Launch FTP server
log "Start ftp server..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
tcpsvd -vE 0.0.0.0 21 ftpd -w / > /${LOG_DIR}/log_ftp.txt 2>&1 &
else
tcpsvd -vE 0.0.0.0 21 ftpd -w / &
fi
### Launch web server ### Launch web server
cd /home/hd1/test/http/ cd /home/hd1/test/http/
@ -251,7 +266,11 @@ mkdir /home/hd1/test/http/record/
mount -o bind /home/hd1/record/ /home/hd1/test/http/record/ mount -o bind /home/hd1/record/ /home/hd1/test/http/record/
touch /home/hd1/test/http/motion touch /home/hd1/test/http/motion
log "Start http server..." log "Start http server..."
./server 80 & if [[ $(get_config DEBUG) == "yes" ]] ; then
./server 80 > /${LOG_DIR}/log_http.txt 2>&1 &
else
./server 80 &
fi
log "Done" log "Done"
sync sync
@ -268,7 +287,11 @@ cd /home
### Rtsp server ### Rtsp server
cd /home/hd1/test/ cd /home/hd1/test/
./rtspsvrM & if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvrM > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else:
./rtspsvrM &
fi
sleep 5 sleep 5
@ -298,6 +321,8 @@ rm /home/hd1/FSCK*
### Final led color ### Final led color
led $(get_config LED_WHEN_READY) led $(get_config LED_WHEN_READY)
### List the processes after startup
log "Processes after startup :" log "Processes after startup :"
ps >> ${LOG_FILE} ps >> ${LOG_FILE}
@ -307,4 +332,3 @@ sync

View File

@ -22,3 +22,9 @@ GATEWAY=192.168.1.254
# -boff -yon : yellow on # -boff -yon : yellow on
# -boff -yoff : yellow off # -boff -yoff : yellow off
LED_WHEN_READY=-boff -bon LED_WHEN_READY=-boff -bon
### Debug
# Debug mode, keep it to 'no' unless you known what you do
# Values : yes|no
DEBUG=no