Jump to content

zdroyer

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    zdroyer got a reaction from djjerdog in Where to report a bug ? /etc/init.d/armhwinfo corrupts /boot/armbianEnv.txt when followed by powerfailure   
    I can confirm the bug.
    Using 20+ OrangePi Zero Plus with the extension board usb ports I noticed the same strange content of /boot/armbianEnv.txt as Magnet  described.
    The file system seems to be fine, except this file. 
    Since my systems use the USB from the extension board, once the port is not present, my device doesn't work.
    My workaround is based on DoubleHP. I added a simple service that checks the content of the armbianEnv.txt file and react accordingly to the result. Her are the three files.
    It works well on my systems, but please feel free to criticise it an point out any possible errors I made.
     
    /root/bootenv_check/bootenv_check.service
    [Unit] Description=Checking the validity of /boot/armbianEnv.txt file. After=sysinit.target [Service] Type=oneshot User=root ExecStart=/bin/bash /root/bootenv_check/bootenv_check.sh RemainAfterExit=yes [Install] WantedBy=basic.target  
    /root/bootenv_check/bootenv_check.sh
    #!/bin/bash file=/boot/armbianEnv.txt overlays="overlays=usbhost0 usbhost1 usbhost2 usbhost3" content="verbosity=1 console=serial overlay_prefix=sun50i-h5 "$overlays" rootdev=UUID=d59ef23a-f2e0-418c-85e9-e21611283218 rootfstype=ext4 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u" cat "$file" | grep -x -F "$overlays" >/dev/null && { #file is good. echo "$file seems to be valid (includes '$overlays')" } || { # File is bad echo -e "$file content is invalid: \n----" cat "$file" echo -e "----" # Fallback on the predefined content ... echo -e "$content" > "$file" echo "$file overwritten with default content" echo "REBOOT NOW" reboot }  
     
    /root/bootenv_check/install_service.sh
     
    #!/bin/bash #echo "The script you are running has basename `basename "$0"`, dirname `dirname "$0"`" echo "Installing bootenv_check.service in the system..." file="bootenv_check.service" target=`dirname "$(readlink -f "$0")"`"/"$file echo "Service file: $target" ln -s -T -v "$target" /etc/systemd/system/"$file" systemctl enable $file echo "... done"  
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines