Skip to content

Commit

Permalink
[Mod] Changes to execution order and debug script tool 'launch.sh'
Browse files Browse the repository at this point in the history
 Changes to be committed:
	new file:   src/static/static/home/yi-hack-v5/script/launch.sh
	modified:   src/static/static/home/yi-hack-v5/script/system.sh
  • Loading branch information
alienatedsec committed Jun 30, 2023
1 parent 00f7678 commit 2df5c4d
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 14 deletions.
100 changes: 100 additions & 0 deletions src/static/static/home/yi-hack-v5/script/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# This file is part of yi-hack-v5 (https://github.com/alienatedsec/yi-hack-v5).
# Copyright (c) 2021-2023 alienatedsec - v5 specific
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Launch - version 0.3.8
#
#!/bin/sh

kill_all() {
# Kills all running instances of app1 and app2
killall wd_rtsp.sh
killall rRTSPServer
killall h264grabber
}

launch_apps() {
# Launches app1 and app2 with different commands
if [ "$execute_audio" = true ]; then
h264grabber -r audio -m "$model" -f &
fi

if [ "$settings" = "high" ]; then
debug_flag=""
if [ "$debug_mode" = true ]; then
debug_flag="-d 7"
fi
h264grabber -r high -m "$model" -f &
rRTSPServer -r high -a "$enable_audio" -p 554 -u -w $debug_flag &
fi

if [ "$settings" = "low" ]; then
debug_flag=""
if [ "$debug_mode" = true ]; then
debug_flag="-d 7"
fi
h264grabber -r low -m "$model" -f &
rRTSPServer -r low -a "$enable_audio" -p 554 -u -w $debug_flag &
fi

if [ "$settings" = "both" ]; then
debug_flag=""
if [ "$debug_mode" = true ]; then
debug_flag="-d 7"
fi
h264grabber -r low -m "$model" -f &
h264grabber -r high -m "$model" -f &
rRTSPServer -r both -a "$enable_audio" -p 554 -u -w $debug_flag &
fi

}


# Read model name from file
model=$(cat /home/app/.camver)
version_cam=$(cat /home/yi-hack-v5/version)
version_sd=$(cat /tmp/sd/yi-hack-v5/version)
echo "Using model: $model"
echo "Version on cam: $version_cam"
echo "Version on sd: $version_sd"

read -p "Specify the operation (k for kill, l for launch): " operation

if [ "$operation" = "k" ] || [ "$operation" = "K" ]; then
kill_all
elif [ "$operation" = "l" ] || [ "$operation" = "L" ]; then
read -p "Specify the settings (high, low, or both): " settings
read -p "Enable audio? (y/n): " audio_choice

if [ "$audio_choice" = "y" ] || [ "$audio_choice" = "Y" ]; then
execute_audio=true
enable_audio="yes"
else
execute_audio=false
enable_audio="no"
fi

read -p "Execute in debug mode? (y/n): " debug_choice

if [ "$debug_choice" = "y" ] || [ "$debug_choice" = "Y" ]; then
debug_mode=true
else
debug_mode=false
fi

launch_apps
else
echo "Invalid operation."
fi
14 changes: 0 additions & 14 deletions src/static/static/home/yi-hack-v5/script/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,26 +169,12 @@ if [[ $(get_config DISABLE_CLOUD) == "yes" ]] ; then
sleep 2
LD_LIBRARY_PATH="/home/yi-hack-v5/lib:/lib:/home/lib:/home/app/locallib:/home/hisiko/hisilib" ./rmm &
sleep 4
./mp4record &
./cloud &
#./p2p_tnp & <<< is this needed? It feels like those 5 seconds previews
if [[ $(cat /home/app/.camver) != "yi_dome" ]] ; then
./oss & #not sure what is oss
fi
#./watch_process & <<< this makes sure all other services that we removed are working so not needed
)
elif [[ $(get_config REC_WITHOUT_CLOUD) == "yes" ]] ; then
(
cd /home/app
killall dispatch
LD_PRELOAD=/home/yi-hack-v5/lib/ipc_multiplex.so ./dispatch &
sleep 2
LD_LIBRARY_PATH="/home/yi-hack-v5/lib:/lib:/home/lib:/home/app/locallib:/home/hisiko/hisilib" ./rmm &
sleep 4
./mp4record &
./cloud &
sleep 5
killall -1 cloud
)
fi

Expand Down

0 comments on commit 2df5c4d

Please sign in to comment.