#!/bin/bash


user=`whoami`
UPGRADE_PATH=$1

echo "Start to delete desktop config file" 

CONFIG_PATH=$HOME/.config/xfce4/xfconf/xfce-perchannel-xml
for dir in `ls /home`;do
        CONFIG_PATH=/home/$dir/.config/xfce4/xfconf/xfce-perchannel-xml
        rm -vf $CONFIG_PATH/xfce4-panel.xml
        rm -vf $CONFIG_PATH/xfwm4.xml
        rm -vf $CONFIG_PATH/xfce4-desktop.xml
        rm -vf $CONFIG_PATH/xsettings.xml
done

echo "Start upgrade MCU firmware"
cd $UPGRADE_PATH
unzip mcu_update.zip
if [ -f hc32fx_mcu_iap ];then
	chmod +x hc32fx_mcu_iap
        ./hc32fx_mcu_iap -m TVE1432V_app_V10_241219.bin  -y
else
        echo "upgrade-other script error ! no file hc32fx_mcu_iap"
fi

