HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/DistUpgrade/__pycache__/xorg_fix_proprietary.cpython-38.pyc
U

]�_��	@s�ddlZddlZddlZddlZddlZdZefdd�Zefdd�Zedk�r�e�	�dksle
d�e�d	�d
ejd<ej
ejddd
�e�dejd�ej�e�s�e�d�e�d�ej�e�dkr�e�d�e�e�e�d�ede�d�Ze�de�e�ee�dZzdd�ed�D�ZWn*ek
�rZe�d�e�d�YnXeD]Zedk�r`dZ�q|�q`e�s�ee��*Zde��k�r�e�de�ed�W5QRXdS)�Nz/etc/X11/xorg.confc
Cstj�|�st�d|�dSg}t|��t}|D]h}|�d�d��}|���	d�r�|�
d|�r�t�d|���d|}t�d	|���|�
|�q0W5QRXt|��b}|��|k�r
t�d
|||f�t|dd��}|�d
�|��W5QRXt�|d|�W5QRXdS)zf
    this removes old_driver driver from the xorg.conf and substitutes it with
    the new_driver
    �file %s not foundN�#r�driver�"%s"�line '%s' foundz
	Driver	"%s"
�replacing with '%s'zsaving new %s (%s -> %s)�	.xorg_fix�w���os�path�exists�loggingZwarning�open�split�strip�lower�
startswith�endswith�debug�rstrip�append�	readlines�info�write�join�rename)�
old_driverZ
new_driver�xorg�content�	xorg_file�line�s�
xorg_fix_file�r%�B/usr/lib/python3/dist-packages/DistUpgrade/xorg_fix_proprietary.py�replace_driver_from_xorgs,
�
�r'c
Cstj�|�st�d|�dSg}t|��t}|D]h}|�d�d��}|���	d�r�|�
d|�r�t�d|���d|}t�d	|���|�
|�q0W5QRXt|��`}|��|k�rt�d
||f�t|dd��}|�d
�|��W5QRXt�|d|�W5QRXdS)z3
    this comments out a driver from xorg.conf
    rNrrrrrz#%srzsaving new %s (commenting %s)rr	r
r)rrr r!r"r#r$r%r%r&�comment_out_driver_from_xorg.s,
�
�r(�__main__zNeed to run as root�z/usr/bin/do-release-upgradez$/var/log/dist-upgrade/xorg_fixup.logr	)�level�filename�filemodez
%s runningzNo xorg.conf, exitingz xorg.conf is zero size, removingz.dist-upgrade-z
%Y%m%d%H%Mzcreating backup '%s'FcCsg|]}|��d�qS)r)r)�.0r"r%r%r&�
<listcomp>lsr/z
/proc/moduleszCan't read /proc/modules�nvidiaTzRemoving nvidia from %s)�sysrr�timeZshutilZ	XORG_CONFr'r(�__name__�getuid�print�exit�argvZbasicConfig�DEBUGrr
r�getsize�remove�strftimeZbackupr�copyr0rZmods�IOError�mZxorg_conf_file�readr%r%r%r&�<module>sT


�