From 2aeb872b93b4cd8768538fdde0429d639c4d2dd8 Mon Sep 17 00:00:00 2001 From: roleo Date: Sun, 11 Sep 2022 13:05:39 +0200 Subject: [PATCH] Minor fixes/improvements --- .../static/home/yi-hack/script/system.sh | 31 ++++++++++++++----- .../static/home/yi-hack/script/thumb.sh | 4 +-- src/www/httpd/cgi-bin/privacy.sh | 2 -- src/www/httpd/cgi-bin/set_configs.sh | 1 - src/www/httpd/cgi-bin/speaker_file.sh | 4 +-- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/static/static/home/yi-hack/script/system.sh b/src/static/static/home/yi-hack/script/system.sh index 8b865f5..be74d86 100755 --- a/src/static/static/home/yi-hack/script/system.sh +++ b/src/static/static/home/yi-hack/script/system.sh @@ -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) @@ -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 @@ -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 ( @@ -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 @@ -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 @@ -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" diff --git a/src/static/static/home/yi-hack/script/thumb.sh b/src/static/static/home/yi-hack/script/thumb.sh index 911f55d..c2e7fd0 100755 --- a/src/static/static/home/yi-hack/script/thumb.sh +++ b/src/static/static/home/yi-hack/script/thumb.sh @@ -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 diff --git a/src/www/httpd/cgi-bin/privacy.sh b/src/www/httpd/cgi-bin/privacy.sh index 6dbb2b4..cfe86a9 100755 --- a/src/www/httpd/cgi-bin/privacy.sh +++ b/src/www/httpd/cgi-bin/privacy.sh @@ -53,8 +53,6 @@ if [ "$CONF" == "value" ] ; then VALUE="$VAL" fi -init_config - if [ "$VALUE" == "on" ] ; then touch /tmp/privacy touch /tmp/snapshot.disabled diff --git a/src/www/httpd/cgi-bin/set_configs.sh b/src/www/httpd/cgi-bin/set_configs.sh index 217da82..757d0e3 100755 --- a/src/www/httpd/cgi-bin/set_configs.sh +++ b/src/www/httpd/cgi-bin/set_configs.sh @@ -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 diff --git a/src/www/httpd/cgi-bin/speaker_file.sh b/src/www/httpd/cgi-bin/speaker_file.sh index 0e60b35..6f0b1e9 100755 --- a/src/www/httpd/cgi-bin/speaker_file.sh +++ b/src/www/httpd/cgi-bin/speaker_file.sh @@ -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/"