
install_64bit_plugins() {
	echo -e "\n\n----- install 64bit plugins -----\n"
	rpm -Uvh --force --nodeps ./64bit/connectivity/wlandrv-plugin-tizen*.rpm
}

install_32bit_plugins() {
	echo -e "\n\n----- install 32bit plugins -----\n"
	rpm -Uvh --force --nodeps ./32bit/connectivity/wlandrv-plugin-tizen*.rpm
}

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

mount -o remount,rw /
sleep 1
mount -o remount,rw /hal

cp -p ./noarch/connectivity/wifi-mesh/* /usr/lib/firmware/
chsmack -a "_" /usr/lib/firmware/*

arch_ver=`uname -m`
echo "arch : $arch_ver"

rpm -e --nodeps wlandrv-plugin-tizen

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

echo -e "\n\n----- Sync & Reboot -----\n"
sync
reboot
