#!/bin/bash
mkdir temp
cd temp
wget https://downloads.caninosloucos.org/resources/Labrador-32/kernel/labrador-kernel6-armhf-v01.tar.gz
tar -xzvf labrador-kernel6-armhf-v01.tar.gz
boot_dir=$(lsblk | grep /media/caninos | awk '{print substr($NF,16,24)}')
sudo rm -r /lib/modules
sudo cp -r output/lib/modules /lib/modules
sudo rm /media/caninos/$boot_dir/uImage
cp output/uImage /media/caninos/$boot_dir/
rm /media/caninos/$boot_dir/kernel.dtb
cp output/kernel.dtb /media/caninos/$boot_dir/
cd ..
rm -r temp
