Skip to content

Commit

Permalink
Minor fixes/improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Sep 11, 2022
1 parent 19df95d commit 2aeb872
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
31 changes: 23 additions & 8 deletions src/static/static/home/yi-hack/script/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

CONF_FILE="etc/system.conf"

YI_HACK_PREFIX="/home/yi-hack"
YI_PREFIX="/home/app"
YI_HACK_PREFIX="/home/yi-hack"

YI_HACK_VER=$(cat /home/yi-hack/version)
MODEL_SUFFIX=$(cat /home/yi-hack/model_suffix)
Expand Down Expand Up @@ -91,11 +91,11 @@ fi
if [[ x$(get_config SSH_PASSWORD) != "x" ]] ; then
SSH_PASSWORD=$(get_config SSH_PASSWORD)
PASSWORD_MD5="$(echo "${SSH_PASSWORD}" | mkpasswd --method=MD5 --stdin)"
sed -i 's|^root::|root:'${PASSWORD_MD5}':|g' "/etc/passwd"
sed -i 's|/root|/home/yi-hack|g' "/etc/passwd"
sed -i 's|^root::|root:'${PASSWORD_MD5}':|g' "/etc/shadow"
sed -i 's|^root::|root:*:|g' /etc/passwd
sed -i 's|:/root:|:/home/yi-hack:|g' /etc/passwd
sed -i 's|^root::|root:'${PASSWORD_MD5}':|g' /etc/shadow
else
sed -i 's|/root|/home/yi-hack|g' "/etc/passwd"
sed -i 's|:/root:|:/home/yi-hack:|g' /etc/passwd
fi

case $(get_config RTSP_PORT) in
Expand All @@ -112,9 +112,9 @@ case $(get_config HTTPD_PORT) in
esac

if [ ! -f $YI_PREFIX/cloudAPI_real ]; then
mv $YI_PREFIX/cloudAPI $YI_PREFIX/cloudAPI_real
cp $YI_HACK_PREFIX/script/cloudAPI $YI_PREFIX/
cp $YI_PREFIX/cloudAPI $YI_PREFIX/cloudAPI_real
fi
mount --bind $YI_HACK_PREFIX/script/cloudAPI $YI_PREFIX/cloudAPI

if [[ $(get_config DISABLE_CLOUD) == "no" ]] ; then
(
Expand Down Expand Up @@ -163,6 +163,13 @@ else
if [[ $(get_config REC_WITHOUT_CLOUD) == "yes" ]] ; then
./mp4record &
fi

echo "127.0.0.1 api.eu.xiaoyi.com" >> /etc/hosts
echo "127.0.0.1 api.us.xiaoyi.com" >> /etc/hosts
echo "127.0.0.1 api.xiaoyi.com.tw" >> /etc/hosts
echo "127.0.0.1 log.eu.xiaoyi.com" >> /etc/hosts
echo "127.0.0.1 log.us.xiaoyi.com" >> /etc/hosts
echo "127.0.0.1 log.xiaoyi.com.tw" >> /etc/hosts
)
fi

Expand All @@ -189,7 +196,7 @@ if [[ $(get_config SSHD) == "yes" ]] ; then
if [ ! -f /home/base/scp ]; then
ln -s /home/yi-hack/bin/scp /home/base/scp
fi
dropbear -R -B
dropbear -R -B -p 0.0.0.0:22
fi

if [[ $(get_config NTPD) == "yes" ]] ; then
Expand Down Expand Up @@ -359,6 +366,14 @@ if [ -f "$YI_HACK_PREFIX/script/mqtt_advertise/startup.sh" ]; then
$YI_HACK_PREFIX/script/mqtt_advertise/startup.sh
fi

# Add library path for linker
echo "/lib:/usr/lib:/tmp/sd/yi-hack/lib" > /etc/ld-musl-armhf.path

# Add custom binaries to PATH
echo "" >> /etc/profile
echo "# Custom yi-hack binaries" >> /etc/profile
echo "PATH=\$PATH:/home/yi-hack/bin:/home/yi-hack/sbin:/home/yi-hack/usr/bin:/home/yi-hack/usr/sbin:/tmp/sd/yi-hack/bin:/tmp/sd/yi-hack/sbin" >> /etc/profile

# Remove log files written to SD on boot containing the WiFi password
rm -f "/tmp/sd/log/log_first_login.tar.gz"
rm -f "/tmp/sd/log/log_login.tar.gz"
Expand Down
4 changes: 1 addition & 3 deletions src/static/static/home/yi-hack/script/thumb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ serviceMain ()
chmod -R 0755 "${FOLDER_TO_WATCH}"
fi
#
# if [[ $(get_config FTP_UPLOAD) == "yes" ]] ; then
checkFiles
# fi
checkFiles
#
if [ "${1}" = "--one-shot" ]; then
break
Expand Down
2 changes: 0 additions & 2 deletions src/www/httpd/cgi-bin/privacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ if [ "$CONF" == "value" ] ; then
VALUE="$VAL"
fi

init_config

if [ "$VALUE" == "on" ] ; then
touch /tmp/privacy
touch /tmp/snapshot.disabled
Expand Down
1 change: 0 additions & 1 deletion src/www/httpd/cgi-bin/set_configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ for ROW in $ROWS; do
VALUE=$(echo $VALUE | sed 's/;/\\n/g')
cat $CONF_FILE.template > $CONF_FILE
echo -e $VALUE >> $CONF_FILE

else
VALUE=$(echo "$VALUE" | sedencode)
sed -i "s/^\(${KEY}\s*=\s*\).*$/\1${VALUE}/" $CONF_FILE
Expand Down
4 changes: 2 additions & 2 deletions src/www/httpd/cgi-bin/speaker_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Play a file stored in FILE_PATH by name

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/home/base/tools:/home/app/localbin:/home/base:/tmp/sd/yi-hack/bin:/tmp/sd/yi-hack/sbin:/tmp/sd/yi-hack/usr/bin:/tmp/sd/yi-hack/usr/sbin
export LD_LIBRARY_PATH=/lib:/usr/lib:/home/lib:/home/qigan/lib:/home/app/locallib:/tmp/sd:/tmp/sd/gdb:/tmp/sd/yi-hack/lib
export PATH=$PATH:/home/base/tools:/home/yi-hack/bin:/home/yi-hack/sbin:/home/yi-hack/usr/bin:/home/yi-hack/usr/sbin:/tmp/sd/yi-hack/bin:/tmp/sd/yi-hack/sbin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lib:/home/yi-hack/lib:/tmp/sd/yi-hack/lib

YI_HACK_PREFIX="/home/yi-hack"
FILE_PATH="/tmp/sd/audio/"
Expand Down

0 comments on commit 2aeb872

Please sign in to comment.