You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
5.9 KiB
133 lines
5.9 KiB
#!/usr/bin/env bash
|
|
|
|
ENABLED=yes
|
|
[ "$ENABLED" != "yes" ] && exit 0
|
|
DEBUGMODE=no
|
|
|
|
. /usr/lib/ublinux/functions
|
|
. /usr/lib/ublinux/os-config
|
|
debug_mode "$0" "$@"
|
|
|
|
#. $HARDCONF
|
|
#echo "$XDRIVER" | grep -q "nvidia" || rmmod nvidia
|
|
#STEAMNODPMS=yes
|
|
|
|
SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
|
|
SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
|
|
SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
|
|
SOURCE=${SYSCONF}/keyboard; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
|
|
|
|
[[ ${DISPLAYMANAGER} == "none" ]] && exit
|
|
|
|
# Auto VGA driver loader
|
|
if [[ -n ${VGADRV_AUTO} ]]; then
|
|
while read LSPCI_DEVICE; do
|
|
while read KERNEL_MODULE; do
|
|
[[ ${KERNEL_MODULE} != "nouveau" ]] && modprobe ${KERNEL_MODULE} 2>/dev/null && break
|
|
done < <(lspci -ks ${LSPCI_DEVICE%% *} | grep 'Kernel modules:' | cut -d: -f2 | tr ',' '\n' | tac)
|
|
done < <(lspci | egrep -i 'vga|3d')
|
|
if lsmod | grep nvidia &>/dev/null; then
|
|
#[[ -f /usr/bin/nvidia-xconfig ]] && nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=/etc/X11/xorg.conf
|
|
[[ -e /etc/X11/xorg.conf.d/20-nvidia-ubconfig.conf ]] || ln -sf /usr/lib/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf /etc/X11/xorg.conf.d/
|
|
#[[ -e /etc/udev/rules.d/70-nvidia-ubconfig.rules ]] || ln -sf /usr/lib/ublinux/udev/70-nvidia-ubconfig.rules /etc/udev/rules.d/
|
|
/usr/bin/nvidia-modprobe -c0 -umsl
|
|
modprobe nvidia_drm
|
|
modprobe nvidia_uvm
|
|
modprobe nvidia_modeset
|
|
#modprobe drm_kms_helper
|
|
#modprobe drm
|
|
#echo -e nvidia_drm\\nvidia_uvm\\nnvidia_modeset > usr/lib/modules-load.d/nvidia-dkms.conf
|
|
fi
|
|
else
|
|
rm -f /etc/X11/xorg.conf.d/20-nvidia-ubconfig.conf
|
|
rm -f /etc/udev/rules.d/70-nvidia-ubconfig.rules
|
|
fi
|
|
|
|
|
|
#[ ! -z "$VGAID" ] && grep -q $VGAID /usr/share/ublinux/hwdata/deleteconf && rm -f /etc/X11/xorg.conf
|
|
[[ -n "${DELETE_XORG_CONF}" ]] && rm -f /etc/X11/xorg.conf
|
|
|
|
|
|
## Parametrs:
|
|
## cvt | gtf | reduced|r | dpms | nodpms | enable | disable | ignore | primary |
|
|
## lo|LeftOf:{name} | ro|RightOf:{name} | ab|Above:{name} | be|Below:{name} |
|
|
## rotate:normal | rotate:left | rotate:right | rotate:invert
|
|
grep -q xres= /proc/cmdline && XORG_MONITOR=$(cat /proc/cmdline | awk -F xres= '{print $2}' | awk '{print $1}')
|
|
if [[ "${SETXORGRES}" != "no" ]] && [[ -n "${XORG_MONITOR[@]}" ]]; then
|
|
XORG_FILE_MONITOR="/etc/X11/xorg.conf.d/10-monitor.conf"
|
|
for VIDEO_PORT in "${!XORG_MONITOR[@]}"; do
|
|
SOFT_MODELINE="gtf"
|
|
SOFT_MODELINE_R=
|
|
PREFERRED_MODE=
|
|
XORG_STR_MONITOR=
|
|
while read VIDEO_PORT_PARAM; do
|
|
if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
if [[ -n ${SOFT_MODELINE_R} ]]; then
|
|
XORG_STR_MONITOR+="$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }))\n"
|
|
SOFT_MODELINE_R=
|
|
elif [[ ${SOFT_MODELINE} == "cvt" ]]; then
|
|
XORG_STR_MONITOR+="$(cvt ${VIDEO_PORT_PARAM//x/ })\n"
|
|
else
|
|
if egrep -iq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+="$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | grep -v '^\s*$')\n"
|
|
else
|
|
XORG_STR_MONITOR+="$(gtf ${VIDEO_PORT_PARAM//x/ } | grep -v '^\s*$')\n"
|
|
fi
|
|
fi
|
|
elif egrep -iq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
SOFT_MODELINE="cvt"
|
|
elif egrep -iq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
SOFT_MODELINE="gtf"
|
|
elif egrep -iq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
SOFT_MODELINE_R="reduced"
|
|
elif egrep -iq "^nodpms$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "DPMS" "false"\n'
|
|
elif egrep -iq "^dpms$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "DPMS" "true"\n'
|
|
elif egrep -iq "^enable$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "Enable" "true"\n'
|
|
elif egrep -iq "^disable$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "Enable" "false"\n'
|
|
elif egrep -iq "^ignore$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "Ignore" "true"\n'
|
|
elif egrep -iq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=' Option "Primary" "true"\n'
|
|
elif egrep -iq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=" Option \"LeftOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n"
|
|
elif egrep -iq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=" Option \"RightOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n"
|
|
elif egrep -iq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=" Option \"Above\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n"
|
|
elif egrep -iq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=" Option \"Below\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n"
|
|
elif egrep -iq "^rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then
|
|
XORG_STR_MONITOR+=" Option \"Rotate\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n"
|
|
fi
|
|
[[ -z ${PREFERRED_MODE} ]] && PREFERRED_MODE=$(grep Modeline <<< "${XORG_STR_MONITOR}" | cut -d'"' -f2)
|
|
done < <(tr ',' '\n' <<< "${XORG_MONITOR[${VIDEO_PORT}]}")
|
|
if [[ -n ${XORG_STR_MONITOR} && ${VIDEO_PORT} != 0 ]]; then
|
|
XORG_STR+='Section "Monitor"\n'
|
|
XORG_STR+=" Identifier \"${VIDEO_PORT^^}\"\n"
|
|
XORG_STR+="${XORG_STR_MONITOR}"
|
|
[[ -n ${PREFERRED_MODE} ]] && XORG_STR+=" Option \"PreferredMode\" \"${PREFERRED_MODE}\"\n"
|
|
XORG_STR+='EndSection\n\n'
|
|
fi
|
|
done
|
|
[[ -n ${XORG_STR} ]] && echo -e "${XORG_STR}" > "${XORG_FILE_MONITOR}"
|
|
fi
|
|
|
|
if [ "$MKKBDFXORG" != "no" ] ;then
|
|
if ! grep -sqi XkbOptions /etc/X11/xorg.conf; then
|
|
cat > /etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
|
|
Section "InputClass"
|
|
Identifier "system-keyboard"
|
|
MatchIsKeyboard "on"
|
|
Option "XkbLayout" "$XkbLayout"
|
|
Option "XkbModel" "$XkbModel"
|
|
Option "XkbVariant" "$KEYBOARD"
|
|
Option "XkbOptions" "$XkbOptions"
|
|
EndSection
|
|
EOF
|
|
fi
|
|
fi
|