I am not too much experienced with bash, so it may look a little awkward, but anyway here is the script.
#!/bin/bash
GPIO=`fdtget -t x /flash/dtb.img /gpioleds/sys_led gpios`
GPIO_ACTIVE_FLAG=`echo $GPIO| awk 'END {print $NF}'`
if [[ "$GPIO_ACTIVE_FLAG" == "0" ]]; then
echo "SYSTEM LED GPIO IS CORRECT"
exit 0
else
echo "Changing System Led GPIO_ACTIVE flag"
GP=`echo $GPIO | sed '$s/\w*$//'`
GPIO=$GP"0"
mount -o remount,rw /flash
fdtput -t x /flash/dtb.img /gpioleds/sys_led gpios $GPIO
sync
mount -o remount,ro /flash
fi