From 0b86dd070252a4f28a9388b7d9c7030eb747b933 Mon Sep 17 00:00:00 2001 From: BreizhHardware Date: Thu, 28 Jul 2022 16:22:24 +0200 Subject: [PATCH] init --- README.md | 1 + hwcheck.sh | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ nobara_post.sh | 35 ++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 README.md create mode 100755 hwcheck.sh create mode 100755 nobara_post.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..5465234 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# post_install diff --git a/hwcheck.sh b/hwcheck.sh new file mode 100755 index 0000000..626c4e0 --- /dev/null +++ b/hwcheck.sh @@ -0,0 +1,146 @@ +#!/usr/bin/sh + +REBOOT_REQUIRED="no" +### NVIDIA DRIVER CHECK #### + +nvgpu=$(lspci | grep -iE 'VGA|3D' | grep -i nvidia | cut -d ":" -f 3) +nvkernmod=$(lspci -k | grep -iEA3 'VGA|3D' | grep -iA3 nvidia | grep -i 'kernel driver' | grep -iE 'vfio-pci|nvidia') + +if [[ ! -z $nvgpu ]]; then + if [[ -z $nvkernmod ]]; then + # Check for internet connection + wget -q --spider http://google.com + if [ $? -eq 0 ]; then + + zenity --question \ + --title="Nvidia GPU Hardware Detected" \ + --width=600 \ + --text="`printf "The following Nvidia hardware has been found on your system:\n\n + $nvgpu\n\n +This hardware requires 3rd party Nvidia drivers to be installed in order to function correctly.\n\n +By pressing 'Yes', you will be prompted for your password in order to install these drivers.\n\n"`" + +case $? in + 0) + PASSWD="$(zenity --password)\n" + ( + echo "# Installing Nvidia drivers" + echo "10"; sleep 1 + echo "# Installing Nvidia drivers" + echo "50"; sleep 1 + echo "# Updating to latest kernel (required for Nvidia drivers)" + echo -e $PASSWD | sudo -S dnf install -y kernel kernel-headers + echo "# Purging any previous lingering nvidia drivers/packages" + sudo -S dnf remove -y akmod-nvidia xorg-x11-drv-nvidia-cuda + sudo -S dnf remove -y nvidia-settings xorg-x11-drv-nvidia* kmod-nvidia + echo "# Installing Nvidia drivers" + sudo -S dnf install -y akmod-nvidia xorg-x11-drv-nvidia-cuda + echo "75"; sleep 1 + echo "# Nvidia driver installation complete!" + echo "100"; sleep 1 + ) | zenity --title "Nvidia GPU Hardware Detected" --progress --no-cancel --width=600 --percentage=0 + # reset kscsreen settings + rm -Rf /home/$USER/.local/share/kscreen + # remove any previous declined answer + rm /home/$USER/.config/nvcheck-declined + REBOOT_REQUIRED="yes" + ;; + *) + # User declined to install nvidia drivers + zenity --info\ + --title="Nvidia GPU Hardware Detected" \ + --width=600 \ + --text="`printf "We will not ask you this again until your next login.\n\n"`" + echo 1 > /home/$USER/.config/nvcheck-declined + exit 0 + ;; +esac + else + # No internet connection found + zenity --info\ + --title="No Internet connection." \ + --width=600 \ + --text="`printf "An internet connection is required to install Nvidia drivers. Once your system is connected to the internet, run 'hwcheck.sh' from the terminal to restart the installer.\n\n"`" + echo 1 > /home/$USER/.config/nvcheck-declined + exit 0 + fi + fi +fi + +### END NVIDIA DRIVER CHECK #### + +### XBOX CONTROLLER FIRMWARE CHECK #### + +lpf=$(rpm -qa | grep 'lpf-xone-firmware') +xbfirmware=$(rpm -qa | grep 'xone-firmware'| wc -l) + +if [[ ! -z $lpf ]]; then + if [ "$xbfirmware" != "2" ]; then + # Check for internet connection + wget -q --spider http://google.com + if [ $? -eq 0 ]; then + + zenity --question\ + --title="Xbox Controller firmware installer" \ + --width=600 \ + --text="`printf "A firmware update is required for Xbox Wireless controllers to work. Would you like to perform this now?\n\n"`" + +case $? in + 0) + PASSWD="$(zenity --password)\n" + ( + echo -e $PASSWD | sudo -S usermod -aG pkg-build $USER + echo -e $PASSWD | sudo -S dnf install -y lpf-xone-firmware xone + echo -e $PASSWD | sudo -S dnf remove -y xone-firmware + echo -e $PASSWD | sudo -S exec su - $USER + echo -e $PASSWD | sudo -S -u $USER lpf reset xone-firmware + echo -e $PASSWD | sudo -S -u $USER lpf approve xone-firmware + echo -e $PASSWD | sudo -S -u $USER lpf build xone-firmware + echo -e $PASSWD | sudo -S -u $USER lpf install xone-firmware + echo "75"; sleep 1 + echo "# Xbox Controller firmware installation complete!" + echo "100"; sleep 1 + ) | zenity --title="Xbox Controller firmware installer" --progress --no-cancel --width=600 --percentage=0 + # remove any previous declined answer + rm /home/$USER/.config/xbcheck-declined + REBOOT_REQUIRED="yes" + ;; + *) + # User declined to install firmware + zenity --info\ + --title="Xbox Controller firmware installer" \ + --width=600 \ + --text="`printf "We will not ask you this again until your next login.\n\n"`" + echo 1 > /home/$USER/.config/xbcheck-declined + exit 0 + ;; +esac + else + # No internet connection found + zenity --info\ + --title="No Internet connection." \ + --width=600 \ + --text="`printf "An internet connection is required to install the Xbox Controller firmware. Once your system is connected to the internet, run 'hwcheck.sh' from the terminal to restart the installer.\n\n"`" + echo 1 > /home/$USER/.config/xbcheck-declined + exit 0 + fi + fi +fi +### END XBOX CONTROLLER FIRMWARE CHECK #### + +if [ "$REBOOT_REQUIRED" == "yes" ]; then + + zenity --question \ + --title="Reboot Required." \ + --width=600 \ + --text="`printf "The system requires a reboot before newly installed drivers and firmware can take effect. Would you like to reboot now?\n\n"`" + + if [ $? = 0 ]; then + reboot + else + exit 0 + fi +fi + + +exit 0 diff --git a/nobara_post.sh b/nobara_post.sh new file mode 100755 index 0000000..625a748 --- /dev/null +++ b/nobara_post.sh @@ -0,0 +1,35 @@ +if [[ $EUID -ne 0 ]] +then + sudo chmod +x $(dirname $0)/$0 + sudo $(dirname $0)/$0 + exit; +fi +isvbox=$(LANG=C hostnamectl | grep -i virtualization | grep -c oracle) +isfm=$(grep -c fastestmirror /etc/dnf/dnf.conf) +if [[ "$isfm" -eq "0" ]] +then + echo "fastestmirror=1" >> /etc/dnf/dnf.conf +fi + +dnf -y --nogpgcheck --refresh upgrade +dnf install -y gnome-shell-extension-dash-to-dock htop nmon inxi figlet +dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel +dnf install -y lame\* --exclude=lame-devel +dnf group upgrade -y --with-optional Multimedia +git clone https://github.com/bikass/kora.git +cd kora/ +cp -R kora /usr/share/icons/ +cd .. +rm -rf kora +dnf -y autoremove blender kdenlive libreoffice-* lutris protonup-qt winehq-staging wine-staging-common wine-staging64 winetricks yumex-dnf inkscape hplip-common hplip-libs hplip-gui +dnf -y autoremove baobab cheese epiphany gnome-{calendar,characters,clocks,contacts,dictionary,disk-utility,font-viewer,logs,maps,photos,user-docs,,weather} gucharmap sushi +echo "[vscode]" > /etc/yum.repos.d/vscode.repo +echo "name=Visual Studio Code" >> /etc/yum.repos.d/vscode.repo +echo "baseurl=https://packages.microsoft.com/yumrepos/vscode" >> /etc/yum.repos.d/vscode.repo +echo "enabled=1" >> /etc/yum.repos.d/vscode.repo +echo "gpgcheck=1" >> /etc/yum.repos.d/vscode.repo +echo "gpgkey=https://packages.microsoft.com/keys/microsoft.asc" >> /etc/yum.repos.d/vscode.repo +rpm --import https://packages.microsoft.com/keys/microsoft.asc +dnf update +dnf install -y code +echo "Préparation terminée, il est recommandé de redémarrer ! Pour appliquer les icons ouvrez ajustement et appliquez kora." \ No newline at end of file