List available drivers with mhwd

This commit is contained in:
Chrysostomus 2017-02-13 14:20:20 +08:00
parent 6bad85c481
commit 20f36ad312

View File

@ -1900,10 +1900,6 @@ setup_graphics_card() {
# Save repetition
install_intel(){
#basestrap ${MOUNTPOINT} xf86-video-intel libva-intel-driver intel-ucode 2>/tmp/.errlog
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
check_for_error
sed -i 's/MODULES=""/MODULES="i915"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
# Intel microcode (Grub, Syslinux and systemd-boot).
@ -1928,137 +1924,30 @@ install_intel(){
# Save repetition
install_ati(){
# basestrap ${MOUNTPOINT} xf86-video-ati 2>/tmp/.errlog
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
check_for_error
sed -i 's/MODULES=""/MODULES="radeon"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
}
# Main menu. Correct option for graphics card should be automatically highlighted.
NVIDIA=""
VB_MOD=""
GRAPHIC_CARD=""
INTEGRATED_GC="N/A"
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " Choose video-driver to be installed " --radiolist "$_InstDEBody $_UseSpaceBar" 0 0 12 \
$(mhwd -l | awk 'FNR>4 {print $1}' | awk 'NF' |awk '$0=$0" - off"') 2> /tmp/.driver
arch_chroot "mhwd -i pci $(cat /tmp/.driver)" 2>/tmp/.errlog
GRAPHIC_CARD=$(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//')
# Highlight menu entry depending on GC detected. Extra work is needed for NVIDIA
if [[ $(echo $GRAPHIC_CARD | grep -i "nvidia") != "" ]]; then
# If NVIDIA, first need to know the integrated GC
[[ $(lscpu | grep -i "intel\|lenovo") != "" ]] && INTEGRATED_GC="Intel" || INTEGRATED_GC="ATI"
# Second, identity the NVIDIA card and driver / menu entry
if [[ $(dmesg | grep -i 'chipset' | grep -i 'nvc\|nvd\|nve') != "" ]]; then HIGHLIGHT_SUB_GC=4
elif [[ $(dmesg | grep -i 'chipset' | grep -i 'nva\|nv5\|nv8\|nv9') != "" ]]; then HIGHLIGHT_SUB_GC=5
elif [[ $(dmesg | grep -i 'chipset' | grep -i 'nv4\|nv6') != "" ]]; then HIGHLIGHT_SUB_GC=6
else HIGHLIGHT_SUB_GC=3
fi
# All non-NVIDIA cards / virtualisation
elif [[ $(echo $GRAPHIC_CARD | grep -i 'intel\|lenovo') != "" ]]; then HIGHLIGHT_SUB_GC=2
elif [[ $(echo $GRAPHIC_CARD | grep -i 'ati') != "" ]]; then HIGHLIGHT_SUB_GC=1
elif [[ $(echo $GRAPHIC_CARD | grep -i 'via') != "" ]]; then HIGHLIGHT_SUB_GC=7
elif [[ $(echo $GRAPHIC_CARD | grep -i 'virtualbox') != "" ]]; then HIGHLIGHT_SUB_GC=8
elif [[ $(echo $GRAPHIC_CARD | grep -i 'vmware') != "" ]]; then HIGHLIGHT_SUB_GC=9
else HIGHLIGHT_SUB_GC=9
if [[ $(echo $GRAPHIC_CARD | grep -i 'intel\|lenovo') != "" ]]; then install_intel
elif [[ $(echo $GRAPHIC_CARD | grep -i 'ati') != "" ]]; then install_ati
elif [[ $(cat /tmp/.driver) == "video-nouveau" ]]; then sed -i 's/MODULES=""/MODULES="nouveau"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
fi
dialog --default-item ${HIGHLIGHT_SUB_GC} --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_GCtitle " \
--menu "$GRAPHIC_CARD\n" 0 0 10 \
"1" $"xf86-video-ati" \
"2" $"xf86-video-intel" \
"3" $"xf86-video-nouveau (+ $INTEGRATED_GC)" \
"4" $"Nvidia (+ $INTEGRATED_GC)" \
"5" $"Nvidia-340xx (+ $INTEGRATED_GC)" \
"6" $"Nvidia-304xx (+ $INTEGRATED_GC)" \
"7" $"xf86-video-openchrome" \
"8" $"virtualbox-guest-dkms" \
"9" $"xf86-video-vmware" \
"10" "$_GCUnknOpt / xf86-video-fbdev" 2>${ANSWER}
case $(cat ${ANSWER}) in
"1") # ATI/AMD
install_ati
;;
"2") # Intel
install_intel
;;
"3") # Nouveau / NVIDIA
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
sed -i 's/MODULES=""/MODULES="nouveau"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
;;
"4") # NVIDIA-GF
arch_chroot "mhwd -a pci nonfree 0300" 2>/tmp/.errlog
NVIDIA_INST=1
;;
"5") # NVIDIA-340
arch_chroot "mhwd -a pci nonfree 0300" 2>/tmp/.errlog
NVIDIA_INST=1
;;
"6") # NVIDIA-304
arch_chroot "mhwd -a pci nonfree 0300" 2>/tmp/.errlog
NVIDIA_INST=1
;;
"7") # Via
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
#basestrap ${MOUNTPOINT} xf86-video-openchrome 2>/tmp/.errlog
;;
"8") # VirtualBox
arch_chroot "mhwd -i pci video-virtualbox" 2>/tmp/.errlog
# Set VB headers to install depending on installed kernel(s)
#[[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && VB_MOD="linux-headers"
#[[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && VB_MOD="$VB_MOD linux-grsec-headers"
#[[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && VB_MOD="$VB_MOD linux-zen-headers"
#[[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && VB_MOD="$VB_MOD linux-lts-headers"
# dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title "$_VBoxInstTitle" --msgbox "$_VBoxInstBody" 0 0
# clear
# basestrap ${MOUNTPOINT} virtualbox-guest-utils virtualbox-guest-dkms $VB_MOD 2>/tmp/.errlog
# umount -l /mnt/dev
# # Load modules and enable vboxservice.
# arch_chroot "modprobe -a vboxguest vboxsf vboxvideo"
# # add openrc support. If openrcbase was installed, the file /tmp/.openrc should exist.
# arch_chroot "systemctl enable vboxservice"
# echo -e "vboxguest\nvboxsf\nvboxvideo" > ${MOUNTPOINT}/etc/modules-load.d/virtualbox.conf
;;
"9") # VMWare
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
#basestrap ${MOUNTPOINT} xf86-video-vmware xf86-input-vmmouse 2>/tmp/.errlog
;;
"10") # Generic / Unknown
#basestrap ${MOUNTPOINT} xf86-video-fbdev 2>/tmp/.errlog
arch_chroot "mhwd -a pci free 0300" 2>/tmp/.errlog
;;
*) install_graphics_menu
;;
esac
check_for_error
# Create a basic xorg configuration file for NVIDIA proprietary drivers where installed
# if that file does not already exist.
if [[ $NVIDIA_INST == 1 ]] && [[ ! -e ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf ]]; then
echo "Section "\"Device"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " Identifier "\"Nvidia Card"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " Driver "\"nvidia"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " VendorName "\"NVIDIA Corporation"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " Option "\"NoLogo"\" "\"true"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " #Option "\"UseEDID"\" "\"false"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " #Option "\"ConnectedMonitor"\" "\"DFP"\"" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo " # ..." >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
echo "EndSection" >> ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
fi
# Where NVIDIA has been installed allow user to check and amend the file
if [[ $NVIDIA_INST == 1 ]]; then
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --title " $_NvidiaConfTitle " --msgbox "$_NvidiaConfBody" 0 0
nano ${MOUNTPOINT}/etc/X11/xorg.conf.d/20-nvidia.conf
fi
install_graphics_menu
}
install_de_wm() {
# Only show this information box once