i=1
for lines in `cat ./boot/mark`
do
  case ${i} in
  1) var1=${lines};;
  esac
  i=`expr ${i} + 1`
done
echo "--------------$var1----------------"

if test "$var1" = "1";then

sudo chmod 777 ./*
sudo chmod 777 ./boot/mark
sudo echo "2" > ./boot/mark


#sudo apt-get install -y raspberrypi-kernel-headers
sudo chmod 777 st7789_module/*
cd st7789_module/
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo cp /lib/modules/$(uname -r)/kernel/drivers/staging/fbtft/fb_st7789v.ko /lib/modules/$(uname -r)/kernel/drivers/staging/fbtft/fb_st7789v.BACK
sudo cp  fb_st7789v.ko /lib/modules/$(uname -r)/kernel/drivers/staging/fbtft/fb_st7789v.ko

sudo reboot
echo "-------------driver installed successfully ----------------"

fi

