|
|
|
|
@ -19,40 +19,58 @@ SOURCE=${SYSCONF}/keyboard; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
|
|
|
|
|
|
|
|
|
|
[[ ${DISPLAYMANAGER} == "none" ]] && exit
|
|
|
|
|
|
|
|
|
|
[[ -n ${VGADRV_AUTO} || -n ${XORG_EXT} || -n ${XORG_MONITOR[@]} ]] && mkdir -p /etc/X11/xorg.conf.d
|
|
|
|
|
rm -f /etc/X11/xorg.conf.d/*-*-ubconfig.conf
|
|
|
|
|
#[ ! -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
|
|
|
|
|
|
|
|
|
|
exec_vgadrv_auto(){
|
|
|
|
|
# Auto VGA driver loader
|
|
|
|
|
FILE_LIGHTDM_CONF="/etc/lightdm/lightdm.conf.d/01-vgadrv-auto-ubconfig.conf"
|
|
|
|
|
FILE_SRC_NVIDIA_CONF="/usr/lib/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf"
|
|
|
|
|
FILE_TARG_NVIDIA_CONF="/etc/X11/xorg.conf.d/20-vgadrv-auto-ubconfig.conf"
|
|
|
|
|
|
|
|
|
|
FILE_SRC_NVIDIA_RULES="/usr/lib/ublinux/udev/70-nvidia-ubconfig.rules"
|
|
|
|
|
FILE_TARG_NVIDIA_RULES="/etc/udev/rules.d/70-vgadrv-auto-ubconfig.rules"
|
|
|
|
|
if [[ -n ${VGADRV_AUTO} ]]; then
|
|
|
|
|
[[ -d /etc/X11/xorg.conf.d ]] || install -Dm755 /etc/X11/xorg.conf.d
|
|
|
|
|
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 | grep -Ei '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/
|
|
|
|
|
#[[ -f /usr/bin/nvidia-xconfig ]] && nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=${FILE_TARG_NVIDIA_CONF}
|
|
|
|
|
[[ -e ${FILE_TARG_NVIDIA_CONF} ]] || ln -sf "${FILE_SRC_NVIDIA_CONF}" "${FILE_TARG_NVIDIA_CONF}"
|
|
|
|
|
#[[ -e ${FILE_TARG_NVIDIA_RULES} ]] || ln -sf "${FILE_SRC_NVIDIA_RULES}" "${FILE_TARG_NVIDIA_RULES}"
|
|
|
|
|
/usr/bin/nvidia-modprobe -c0 -umsl
|
|
|
|
|
modprobe nvidia_drm
|
|
|
|
|
modprobe nvidia_uvm
|
|
|
|
|
modprobe nvidia_modeset
|
|
|
|
|
#modprobe drm_kms_helper
|
|
|
|
|
#modprobe drm
|
|
|
|
|
modprobe -q --show nvidia_drm && modprobe nvidia_drm
|
|
|
|
|
modprobe -q --show nvidia_uvm && modprobe nvidia_uvm
|
|
|
|
|
modprobe -q --show nvidia_modeset && modprobe nvidia_modeset
|
|
|
|
|
#modprobe -q --show drm_kms_helper && modprobe drm_kms_helper
|
|
|
|
|
#modprobe -q --show modprobe drm && modprobe drm
|
|
|
|
|
#echo -e nvidia_drm\\nvidia_uvm\\nnvidia_modeset > usr/lib/modules-load.d/nvidia-dkms.conf
|
|
|
|
|
fi
|
|
|
|
|
# else
|
|
|
|
|
#rm -f /etc/udev/rules.d/70-nvidia-ubconfig.rules
|
|
|
|
|
if [[ -d /etc/lightdm ]]; then
|
|
|
|
|
install -Dm644 /dev/stdin ${FILE_LIGHTDM_CONF} <<-EOF
|
|
|
|
|
[LightDM]
|
|
|
|
|
logind-check-graphical=false
|
|
|
|
|
EOF
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
#rm -f "${FILE_TARG_NVIDIA_RULES}"
|
|
|
|
|
rm -f "${FILE_TARG_NVIDIA_CONF}"
|
|
|
|
|
rm -f "${FILE_LIGHTDM_CONF}"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exec_xorg_ext(){
|
|
|
|
|
#[ ! -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
|
|
|
|
|
|
|
|
|
|
rm -f /etc/X11/xorg.conf.d/110-xorg-ext-*-ubconfig.conf
|
|
|
|
|
## Управление дополнительными возможностями XORG
|
|
|
|
|
if [[ -n ${XORG_EXT} ]]; then
|
|
|
|
|
[[ -d /etc/X11/xorg.conf.d ]] || install -Dm755 /etc/X11/xorg.conf.d
|
|
|
|
|
while read I_EXT; do
|
|
|
|
|
XORG_FILE_EXT="/etc/X11/xorg.conf.d/110-${I_EXT}-ubconfig.conf"
|
|
|
|
|
XORG_FILE_EXT="/etc/X11/xorg.conf.d/110-xorg-ext-${I_EXT}-ubconfig.conf"
|
|
|
|
|
if grep -Eiq "^nodpms$" <<< "${I_EXT}"; then
|
|
|
|
|
cat > ${XORG_FILE_EXT} <<EOF
|
|
|
|
|
Section "Extensions"
|
|
|
|
|
@ -75,14 +93,18 @@ EOF
|
|
|
|
|
fi
|
|
|
|
|
done < <(tr ',' '\n' <<< "${XORG_EXT}")
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exec_xorg_monitor(){
|
|
|
|
|
## 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
|
|
|
|
|
XORG_FILE_MONITOR="/etc/X11/xorg.conf.d/120-xorg-monitor-ubconfig.conf"
|
|
|
|
|
rm -f "${XORG_FILE_MONITOR}"
|
|
|
|
|
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/120-monitor-ubconfig.conf"
|
|
|
|
|
[[ -d /etc/X11/xorg.conf.d ]] || install -Dm755 /etc/X11/xorg.conf.d
|
|
|
|
|
for VIDEO_PORT in "${!XORG_MONITOR[@]}"; do
|
|
|
|
|
SOFT_MODELINE="gtf"
|
|
|
|
|
SOFT_MODELINE_R=
|
|
|
|
|
@ -143,10 +165,13 @@ EOF
|
|
|
|
|
done
|
|
|
|
|
[[ -n ${XORG_STR} ]] && echo -e "${XORG_STR}" > "${XORG_FILE_MONITOR}"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exec_mkkbdfxorg(){
|
|
|
|
|
XORG_FILE_KEYBOARD="/etc/X11/xorg.conf.d/130-mkkbdfxorg-ubconfig.conf"
|
|
|
|
|
rm -f "${XORG_FILE_KEYBOARD}"
|
|
|
|
|
if [[ ${MKKBDFXORG} != "no" ]] ;then
|
|
|
|
|
XORG_FILE_KEYBOARD="/etc/X11/xorg.conf.d/130-keyboard-ubconfig.conf"
|
|
|
|
|
[[ -d /etc/X11/xorg.conf.d ]] || install -Dm755 /etc/X11/xorg.conf.d
|
|
|
|
|
if ! grep -sqi XkbOptions /etc/X11/xorg.conf; then
|
|
|
|
|
cat > ${XORG_FILE_KEYBOARD} <<EOF
|
|
|
|
|
Section "InputClass"
|
|
|
|
|
@ -160,3 +185,26 @@ EndSection
|
|
|
|
|
EOF
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
################
|
|
|
|
|
##### MAIN #####
|
|
|
|
|
################
|
|
|
|
|
|
|
|
|
|
# Если файл подключен как ресурс с функциями, то выйти
|
|
|
|
|
return 0 2>/dev/null && return 0
|
|
|
|
|
if [[ -z $@ ]]; then
|
|
|
|
|
while read -r FUNCTION; do
|
|
|
|
|
$"${FUNCTION##* }"
|
|
|
|
|
done < <(declare -F | grep "declare -f exec_")
|
|
|
|
|
else
|
|
|
|
|
FUNCTION=
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
|
#[[ -z ${1} ]] || { declare -f "${1}" &>/dev/null && FUNCTION+="; ${1}" || FUNCTION+=" '${1}'"; }
|
|
|
|
|
# Что-бы передавать пустые параметры как аргументы, нужно для соблюдения очередности и кол-ва, отключил [[ -z ${1} ]] ||
|
|
|
|
|
declare -f "${1}" &>/dev/null && FUNCTION+="; ${1}" || FUNCTION+=" '${1}'"
|
|
|
|
|
shift
|
|
|
|
|
done
|
|
|
|
|
eval ${FUNCTION#*; }
|
|
|
|
|
fi
|
|
|
|
|
true
|
|
|
|
|
|