Update main.sh

This commit is contained in:
Ward Nakchbandi (Cosmic Fusion) 2024-01-28 21:43:16 +03:00 committed by GitHub
parent b33de10c16
commit fd531d0360
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

23
main.sh
View File

@ -1,17 +1,16 @@
#! /bin/bash #! /bin/bash
DRIVER=545 DRIVER=545
apt show nvidia-driver-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | tr -d ' ' > ./linux-nvidia-modules/pika_nvidia.txt
rm -rfv /etc/apt/preferences.d/* rm -rfv /etc/apt/preferences.d/*
echo 'Package: *' > /etc/apt/preferences.d/0-a echo 'Pin: release c=external' > /etc/apt/preferences.d/0-a
echo 'Pin: release c=main' >> /etc/apt/preferences.d/0-a echo 'Pin-Priority: 1000' >> /etc/apt/preferences.d/0-a
echo 'Pin-Priority: 390' >> /etc/apt/preferences.d/0-a
echo 'Package: *' >> /etc/apt/preferences.d/0-a
echo 'Pin: release c=external' >> /etc/apt/preferences.d/0-a
echo 'Pin-Priority: 390' >> /etc/apt/preferences.d/0-a
echo 'Package: *' >> /etc/apt/preferences.d/0-a echo 'Package: *' >> /etc/apt/preferences.d/0-a
echo 'Pin: release c=ubuntu' >> /etc/apt/preferences.d/0-a echo 'Pin: release c=ubuntu' >> /etc/apt/preferences.d/0-a
echo 'Pin-Priority: 390' >> /etc/apt/preferences.d/0-a echo 'Pin-Priority: 1000' >> /etc/apt/preferences.d/0-a
apt update -y apt update -y
apt show nvidia-driver-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | cut -f1,2,3 -d"." | cut -f1 -d"-" | tr -d ' ' > ./linux-nvidia-modules/new_nvidia.txt
echo "$(apt show nvidia-driver-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | cut -f1,2,3 -d"." | cut -f1 -d"-" | tr -d ' ')" > ./linux-nvidia-modules/DRIVER echo "$(apt show nvidia-driver-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | cut -f1,2,3 -d"." | cut -f1 -d"-" | tr -d ' ')" > ./linux-nvidia-modules/DRIVER
echo "$(apt show kernel-pika 2>&1 | grep -v "does not have a stable" | grep Depends: | head -n1 | cut -f2 -d":" | cut -f1 -d"," | cut -f3,4 -d"-" | tr -d ' ')" > ./linux-nvidia-modules/KERNEL echo "$(apt show kernel-pika 2>&1 | grep -v "does not have a stable" | grep Depends: | head -n1 | cut -f2 -d":" | cut -f1 -d"," | cut -f3,4 -d"-" | tr -d ' ')" > ./linux-nvidia-modules/KERNEL
echo "$(apt show nvidia-kernel-source-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | tr -d ' ')" > ./linux-nvidia-modules/DRIVER_VERSION echo "$(apt show nvidia-kernel-source-$DRIVER 2>&1 | grep -v "does not have a stable" | grep Version: | head -n1 | cut -f2 -d":" | tr -d ' ')" > ./linux-nvidia-modules/DRIVER_VERSION
@ -23,9 +22,15 @@ VERSION="$(cat ./DRIVER)-$(cat ./KERNEL)-100pika5"
echo -e "linux-nvidia-modules ("$VERSION") pikauwu; urgency=medium\n\n * New Release\n\n -- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200" > debian/changelog echo -e "linux-nvidia-modules ("$VERSION") pikauwu; urgency=medium\n\n * New Release\n\n -- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200" > debian/changelog
if echo $VERSION | grep $(cat ./DRIVER_PIKA) if echo $VERSION | grep -v "$(cat ./pika_nvidia.txt)"
then then
echo "Driver up to date" echo "driver already built"
exit 0
fi
if cat ./pika_nvidia.txt | grep "$(cat ./new_nvidia.txt)"
echo "driver up to date"
exit 0 exit 0
fi fi