
install_64bit_plugins() {
	echo "\n\n----- install 64bit plugins -----\n"
	sdb push ./64bit/connectivity/wlandrv-plugin-tizen*.rpm /tmp/patchtmp
}

install_32bit_plugins() {
	echo "\n\n----- install 32bit plugins -----\n"
	sdb push ./32bit/connectivity/wlandrv-plugin-tizen*.rpm /tmp/patchtmp
}


############ Start Here
#set -x

sdb root on

#create repository for patch files
sdb shell mkdir -p /tmp/patchtmp
sdb shell mount -o remount,rw /
sleep 1
sdb shell mount -o remount,rw /hal

arch_ver=`sdb shell "uname -m"`
arch_ver="$(echo "${arch_ver}" | sed -e 's/[[:space:]]*$//')"
echo "arch : ${arch_ver}"

sdb shell rpm -e --nodeps wlandrv-plugin-tizen

echo "\n\n---- Install drvier (sdb push) ----"

sdb push ./noarch/connectivity/wifi-mesh/* /usr/lib/firmware/

if [ "$arch_ver" = "aarch64" ]; then
	install_64bit_plugins
elif [ "$arch_ver" = "armv7l" ]; then
	install_32bit_plugins
else
	echo "Unknown Arch : $arch_ver"
	echo "Failed to install plugins \n\n"
	exit 1
fi

sdb shell rpm -Uvh --force --nodeps /tmp/patchtmp/wlandrv-plugin-tizen*.rpm
sdb shell rm -rf /tmp/patchtmp

echo "\n\n----- Sync & Reboot -----\n"
sdb shell sync
sdb shell reboot
