dgiese / dustcloud

Xiaomi Smart Home Device Reverse Engineering and Hacking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unknown format for valetudo path

magix2 opened this issue · comments

Hello there,

when executing imagebuilder.sh, I would like to provide a path to valetudo. However, I do not know where to get appropriate valetudo binaries, because the script requires a specific structure:

I am executing the following command:

sudo ./imagebuilder.sh -f ../firmware_download/v11_003468.fullos.pkg -k ../ssh_keys/ssh_key_roborock.pub -t Europe/Berlin --valetudo-path ../binary_try

And in binary_try, I have valetudo downloaded from: https://github.com/Hypfer/Valetudo/releases/tag/0.6.1,

I get the following errors:

install: cannot stat '../binary_try/deployment/valetudo.conf': No such file or directory
cat: ../binary_try/deployment/etc/hosts: No such file or directory
cat: ../binary_try/deployment/etc/rc.local: No such file or directory

starting from line 579 in imagebuilder.sh, the problems occur.

if [ $ENABLE_VALETUDO -eq 1 ]; then
    echo "Installing valetudo"

    install -m 0755 $VALETUDO_PATH/valetudo $IMG_DIR/usr/local/bin/valetudo
    install -m 0644 $VALETUDO_PATH/deployment/valetudo.conf $IMG_DIR/etc/init/valetudo.conf

    cat $VALETUDO_PATH/deployment/etc/hosts >> $IMG_DIR/etc/hosts

    sed -i 's/exit 0//' $IMG_DIR/etc/rc.local
    cat $VALETUDO_PATH/deployment/etc/rc.local >> $IMG_DIR/etc/rc.local
    echo >> $IMG_DIR/etc/rc.local
    echo "exit 0" >> $IMG_DIR/etc/rc.local

    # UPLOAD_METHOD=2
    sed -i -E 's/(UPLOAD_METHOD=)([0-9]+)/\12/' $IMG_DIR/opt/rockrobo/rrlog/rrlog.conf
    sed -i -E 's/(UPLOAD_METHOD=)([0-9]+)/\12/' $IMG_DIR/opt/rockrobo/rrlog/rrlogmt.conf

    # Set LOG_LEVEL=3
    sed -i -E 's/(LOG_LEVEL=)([0-9]+)/\13/' $IMG_DIR/opt/rockrobo/rrlog/rrlog.conf
    sed -i -E 's/(LOG_LEVEL=)([0-9]+)/\13/' $IMG_DIR/opt/rockrobo/rrlog/rrlogmt.conf

    # Reduce logging of miio_client
    sed -i 's/-l 2/-l 0/' $IMG_DIR/opt/rockrobo/watchdog/ProcessList.conf

    # Let the script cleanup logs
    sed -i 's/nice.*//' $IMG_DIR/opt/rockrobo/rrlog/tar_extra_file.sh

    # Disable collecting device info to /dev/shm/misc.log
    sed -i '/^\#!\/bin\/bash$/a exit 0' $IMG_DIR/opt/rockrobo/rrlog/misc.sh

    # Disable logging of 'top'
    sed -i '/^\#!\/bin\/bash$/a exit 0' $IMG_DIR/opt/rockrobo/rrlog/toprotation.sh
    sed -i '/^\#!\/bin\/bash$/a exit 0' $IMG_DIR/opt/rockrobo/rrlog/topstop.sh
    
    # Disable cores
    echo "* hard core 0" >> $IMG_DIR/etc/security/limits.conf
    echo "* soft core 0" >> $IMG_DIR/etc/security/limits.conf
    sed -i -E 's/ulimit -c unlimited/ulimit -c 0/' $IMG_DIR/opt/rockrobo/watchdog/rrwatchdoge.conf
fi