%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/DistUpgrade/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/DistUpgrade/__pycache__/DistUpgradeController.cpython-312.pyc

�

9_f������ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZddlm Z ddl!m"Z"dd	l#m$Z$dd
l%m&Z&ddl'm(Z(ddl)m)Z)dd
l*m+Z+ddl*m,Z,e+jZe,_-ddl.m/Z/m0Z0m1Z1	ddl.m2Z2dZ3ddl5m6Z6m7Z7ddl8m9Z:ddl8m;Z;ddl9Z9ddl%m<Z<m=Z=m>Z>ddl?m@Z@dZAd�ZBd�ZCd�ZDGd�deE�ZFGd�deG�ZHeId k(rSdd!lJmJZJej�ej��"�eJ�ZMeHeM�ZNeNj��eNj��yy#e4$rdZ3Y��wxYw)#�N)�
NoOptionError)�ConfigParser�)�get)	�country_mirror�url_downloadable�check_and_fix_xbit�get_arch�iptables_active�
inside_chroot�)get_string_with_no_auth_from_source_entry�is_child_of_process_name�
inhibit_sleep)�Template)�urlsplit)�Step)�MyCache)�DistUpgradeConfig)�DistUpgradeQuirks)�distinfo)�sourceslist)�SourcesList�SourceEntry�	is_mirror)�Deb822SourceEntryTF)�
get_distro�NoDistroTemplateException)�gettext)�ngettext)�CacheExceptionDpkgInterrupted�CacheExceptionLockingFailed�NotEnoughFreeSpaceError)�
run_apportz/var/run/reboot-requiredc�h�gd�}	|j|�S#t$rt|�dzcYSwxYw)zB key() function for sorted to ensure "correct" component ordering ��main�
restricted�universe�
multiverser)�index�
ValueError�len)�a�orderings  �C/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py�component_ordering_keyr0Xs:��?�H���~�~�a� � �����8�}�Q����s��1�1c��gd�}|jd�d}	|j|�S#t$rt|�dzcYSwxYw)z> key() function for sorted to ensure "correct" suite ordering )��updates�security�	backports�proposed�-�r)�	partitionr*r+r,)r-r.�pockets   r/�suite_ordering_keyr;bsK��C�H�
�[�[��
�a�
 �F���~�~�f�%�%�����8�}�Q����s�+�A�Ac�z�g}|jd�|jd�t|d�5}tj|j	��}ddd�|tdt
�d�D�cgc]}|||dzjd���c}z
}|jd�|S#1swY�XxYwcc}w)Nz$-----BEGIN PGP PUBLIC KEY BLOCK-----r2�rbr�@zus-asciiz"-----END PGP PUBLIC KEY BLOCK-----)�append�open�base64�	b64encode�read�ranger,�decode)�keyring_path�out�f�data�is     r/�gpg_keyring_to_asciirKls���
�C��J�J�5�6��J�J�r�N�	
�l�D�	!�*�Q��������)��*��U�1�c�$�i��5L�M��D��1�R�4�L���
�+�M�M�C��J�J�3�4��J�
*�*��Ns�$B,�6B8�,B5c��eZdZy)�NoBackportsFoundExceptionN)�__name__�
__module__�__qualname__��r/rMrM{s��rRrMc�h�eZdZdZd:d�Zd;d�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d<d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd<d�Zd�Zd�Zd�Zd�Zd=d�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d>d0�Z1d>d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:y)?�DistUpgradeControllerz3 this is the controller that does most of the work Nc�>�d}|dk(s|dk(r4tj�}tjj|d�}||_||_t
jd|�t
jd�tjd|jjz�||_
|jjtd��d|_d|_|j
r|j
j$dk(rd|_n|j
j$|_t)|�|_d|j*j-dd	�z|_|j*j1d
�|j*j3d
dt5|j&��|j*j3d
dd
�|j
r3|j
j6r|j*j3d
dd�|j*j-dd�|_|j*j-dd�|_|j*j-dd�|_t?�|_ tjjtBj*jEd�d�|_#|j@dvr&djItK��|_&d|_'nd|_&d|_'dtjPvr5tjd�tBj*j3dd�d|_)tU||j*�|_+tY�|_-dtjPd<dtjPd <tj�d!z�d"tjPd#��tjPd#<t]d$�|j*j_d%d&�}tBj*j3d't5|��tBj*j3d(t5d)��tBj*j3d*t5d+��tBj*j3d,d-�tBj*j3d.d-�tBj*j3d/d0�tBj*j3d1d2�|j*jad3d4�|_1|j*jedd5�|_3g|_4|j*jkd6�r1|j*jmd6�D�cgc]}|d7��	c}|_4d8|_7d|_8ycc}w)9Nz/usr/share/locale/�.�mo�ubuntu-release-upgraderzUsing '%s' viewz
Reading cacheT�Files�	BackupExt�Options�withNetwork�
devRelease�False�True�Sources�From�To�ValidOrigin�Dir::Etc::sourceparts�ubuntu.sources��amd64�i386z"http://{}archive.ubuntu.com/ubuntu�!http://security.ubuntu.com/ubuntuz$http://ports.ubuntu.com/ubuntu-ports�"RELEASE_UPGRADE_NO_FORCE_OVERWRITEzenable dpkg --force-overwritezDPkg::Options::z--force-overwriteF�1�RELEASE_UPGRADE_IN_PROGRESS�PYCENTRAL_FORCE_OVERWRITEz	/imported�:�PATHz./imported/invoke-rc.d�Network�
MaxRetrieszAcquire::Retriesz
Dpkg::MaxArgsizDpkg::MaxArgBytesizAcquire::http::Timeout�20zAcquire::ftp::TimeoutzApt::Get::List-Cleanup�falsez'APT::Get::Always-Include-Phased-Updates�yes�Distro�ForcedObsoletes�ValidMirrors�ThirdPartyMirrorsri�)9�os�getcwd�path�join�datadir�optionsr�bindtextdomain�
textdomain�logging�debug�	__class__rN�_view�updateStatus�_�cache�fetcherr\�
useNetworkr�configr�sources_backup_ext�add_section�set�str�
devel_release�fromDist�toDist�originr
�arch�apt_pkg�find_dir�default_sources_filepath�formatr�default_source_uri�security_source_uri�environ�_partialUpgrader�quirksr�inhibitor_fdr	�getint�getlist�forced_obsoletes�getListFromFile�
valid_mirrors�valid_3p_mirrors�has_section�items�_aptCronJobPerms�_session_bus)�self�distUpgradeViewr~r}�	localedir�
maxRetries�pairs       r/�__init__zDistUpgradeController.__init__�s/��(�	��d�?�g��n��i�i�k�G������W�T�2�I�������	���8��C����4�5�	�
�
�'�/�*C�*C�*L�*L�L�M�$��
��
�
����/� 2�3���
�����|�|�t�|�|�7�7�4�?�"�D�O�"�l�l�6�6�D�O�(��0���"%�d�k�k�o�o�g�k�&J�"J���	
�����	�*������	�-��T�_�_�1E�F������	�,��8��<�<��|�|�)�)������	�,��?������	�&�9��
��k�k�o�o�i��5����k�k�o�o�i�
�>����J��	�)+������N�N�#�#�$;�<��)
��%�
�9�9�)�)�&J�&Q�&Q�R`�Rb�&c�D�#�'J�D�$�&L�D�#�'M�D�$�0�r�z�z�A��M�M�9�:��N�N���0�1D�E� %���(��d�k�k�:���*�O���58��
�
�0�1�25��
�
�.�/�(*�	�	��K�(?�(*�
�
�6�(:�<��
�
�6���3�4��[�[�'�'�	�,�?�
������-�s�:��?�	�����?�C��L�9������.��H�
�>�	�����3�D�9������2�4�8�	�����3�W�=�	�����D�e�L�!%��� 3� 3�H�=N� O���!�[�[�8�8��>�R��� "����;�;�"�"�#6�7�%)�[�[�%6�%6�7J�%K�%M��T�!�W�%M�D�!�!&��� ����%Ms�7Vc��tjd�|j�|jj	d�n4|jj�|jj
�d}d}		|j|�S#t$r�}|dz
}|jj�tjd�tjd|z�||kDrntjd|z�|jjtd	�td
��|r|j�nt!j"d�Yd}~nd}~wwxYw��)NzopenCache()�PreCacheOpen�rr皙�����?z'failed to lock the cache, retrying (%i)zCache can not be locked (%s)zUnable to get exclusive lockz�This usually means that another package management application (like apt-get or aptitude) already running. Please close that application first.)r�r�r�r��run�release_lock�unlock_lists_dir�
_openCacher!r��
processEvents�time�sleep�errorr��abort�sys�exit)r��lock�restore_sources_list_on_fail�MAX_LOCK_RETRIES�
lock_retry�es      r/�	openCachezDistUpgradeController.openCache�s���
�
�m�$��:�:���K�K�O�O�N�+��J�J�#�#�%��J�J�'�'�)����
��
$����t�,�,��.�
$��a��
��
�
�(�(�*��
�
�3���
�
�=�
�J�L�� 0�0��M�M�"@�1�"D�E��J�J�$�$�Q�'E�%F�%&�(<�&=�>�4��
�
���������'
$��	s�8B	�		E�B?E�Ec���	t|j|j|j|jj	�|�|_|j
|_|j |j
_tj$dt'|j
�z�y#t$r�tjd�gd�}tjjd�dk(r|jd�|jj�j|�t|j|j|j|jj	��|_Y��wxYw)Nz-dpkg interrupted, calling dpkg --configure -a��
/usr/bin/dpkgz--configurez-a�DEBIAN_FRONTEND�noninteractive�--force-confoldz/openCache(), new cache size %i)rr�r�r��getOpCacheProgressr��	apt_cacher r��warningryr�rr?�getTerminal�callr��partialUpgrader�r,)r�r��cmds   r/r�z DistUpgradeController._openCaches��	B� ����!%���!%���!%���!>�!>�!@�!%�	'�D�J�"�Z�Z�D�N�%)�$8�$8��
�
�!��
�
�7�#�d�j�j�/�I�J��-�		B��O�O�K�L�6�C��z�z�~�~�/�0�4D�D��
�
�,�-��J�J�"�"�$�)�)�#�.� ����!%���!%���!%���!>�!>�!@�B�D�J�
		B�s�AB$�$CE/�.E/c��|jjdd�}|jjj|vryy)z�
      Returns True if this view support upgrades over ssh.
      In theory all views should support it, but for savety
      we do only allow text ssh upgrades (see LP: #322482)
      �View�
SupportSSHTF)r�r�r�r�rN)r��	supporteds  r/�_viewSupportsSSHz&DistUpgradeController._viewSupportsSSH/s8���+�+�%�%�f�\�:�i�	
���	�	�	&�	&�)�	3��
rRc	�F�tjjd�}tjj|��sbtjj	d��rBtd��r6|j
�sYtjd�|jjtd�td��tjd�yd	}|jjtd
�td�|z�}|dk(rtjd�tjdd
d|zdt!|�g�}|dk(rUtd�}td�|z}t#�rd|z}|td�|zz
}|jj%||�y)z� this will check for server mode and if we run over ssh.
            if this is the case, we will ask and spawn a additional
            daemon (to be sure we have a spare one around in case
            of trouble)
        z"/var/run/release-upgrader-sshd.pidz/proc�sshdzupgrade over ssh not allowedz.Upgrading over remote connection not supportedz�You are running the upgrade over a remote ssh connection with a frontend that does not support this. Please try a text mode upgrade with 'do-release-upgrade'.

The upgrade will abort now. Please try without ssh.rFi�zContinue running under SSH?aThis session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover.

If you continue, an additional ssh daemon will be started at port '%s'.
Do you want to continue?z/usr/sbin/sshdz-oz
PidFile=%sz-przStarting additional sshdz�To make recovery in case of failure easier, an additional sshd will be started on port '%s'. If anything goes wrong with the running ssh you can still connect to the additional one.
z-iptables -I INPUT -p tcp --dport %s -j ACCEPTz�If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.:
'%s'T)ryr{r|�exists�isdirrr�r�r�r�r�r�r��askYesNoQuestion�
subprocessr�r�r�information)r��pidfile�port�res�summary�descrr�s       r/�	_sshMagiczDistUpgradeController._sshMagic:s����'�'�,�,�C�D�������w�'��G�G�M�M�'�"�$�V�,��(�(�*��
�
�<�=��
�
� � ��#S�!T�!"�$H�"I�	#��������D��*�*�-�-��/�0��-�.�15�
5�6�C��e�|�������/�/�#3�#'���)?�#'��D�	�#3�4�C��a�x��6�7���L�� $�	$��
#�$�I�D�P�C��Q�A�B�EH�	H�H�E�
�
�
�&�&�w��6�rRc�r�ddlm}ddlm}d}|jdk(s-|jdk(s|jdk(s|jdk(rd	}|d|�
�}|jj�|jjd�s6|jj�|jjd�s�6|j�tjd
�y|jj�}||j||j|j��}|j�y)z� this is a helper that is run if we are started from a CD
            and we have network - we will then try to fetch a update
            of ourself
        r)�MetaReleaseCore)�DistUpgradeFetcherSelfF�dapper�hardy�lucid�preciseT)�useDevelopmentRelease�forceLTSr�NzNo new dist found)�new_dist�progressr~�view)�MetaReleaser�r��releaser�r��
downloaded�waitr�r�r��getAcquireProgressr~r�)r�r�r�r��mr�r�s       r/�_tryUpdateSelfz$DistUpgradeController._tryUpdateSelfus���
	1�B����L�L�H�$��L�L�G�#��L�L�G�#��L�L�I�%��H��%�%-�
/��	
�
�
� � �"��,�,�#�#�C�(��J�J�$�$�&��,�,�#�#�C�(��:�:���M�M�-�.���:�:�0�0�2��(�!�*�*�2:�15���.2�j�j�:��	���
rRc
���tjd�dg}|D]�\}}d|z}tjj	|�s�+t�}t
|�5}|j|�ddd�	|jdd�}	tjjd|z�}||tjjd
|�fvs��tj|�d|�d|�dtjjd
|��d	��y
y#1swY��xYw#t$r tjd|�d|�d	��Yy
wxYw#t$r#}	tjd|	z�Yd}	~	y
d}	~	wwxYw)z� check that /usr/bin/python3 points to the default python version.
            Users tend to modify this symlink, which breaks stuff in obscure
            ways (Ubuntu #75557).
        z_pythonSymlinkCheck run)�python3r�z/usr/share/%s/debian_defaultsN�DEFAULTzdefault-versionzno default version for z found in '�'Fz/usr/bin/%szos.path.realpath failed (%s)z/usr/binz symlink points to: 'z', but expected is 'z' or 'T)r�r�ryr{r��SafeConfigParserr@�	read_filerr�realpath�OSErrorr�r|)
r��binaries_and_dirnames�binary�dirname�debian_defaultsr�rH�expected_default�fs_default_versionr�s
          r/�_pythonSymlinkCheckz)DistUpgradeController._pythonSymlinkCheck�s]��
	�
�
�/�0�!7� 8��4�	!�O�F�G�=��G�O��w�w�~�~�o�.�)�+���/�*�(�a��$�$�Q�'�(�!�'-�z�z�)�=N�'O�$�
!�)+���)9�)9�-�&�:P�)Q�&�*�.>������Z�Yi�@j�-k�k��M�M�#)�+=�?O�QS�QX�QX�Q]�Q]�^h�jz�Q{�#}�~� �)	!�*�#(�(��%�!��M�M�#)�6�#3�4� �!���!��M�M�"@�1�"D�E� ��!�s6�D�6D�	"E�D	�%E�E�	E7�E2�2E7c
���tjgd�tjd��j�dj	�x|_}t
jd|z�||jk(s�||jk(szt
jd|�d|j�d��|jjtd	�td
|�d|j�d���tjd
�|j�r^|jj �rGt#j$�dz}t
j&d|z�t
jdt)j(|dz�z�t"j*j-|dz�r#t.j0j3d|dz�t"j*j-|dz�r#t.j0j3d|dz�|dz}t"j*j-|�r<t
jd|z�t/j4t.j0|�|j7�|j9�sXt
jd�|jjtd	�td��tjd
�	|j;�|j>jA|j�sy|j>jC�|_"|jDrdt"jFd<ndt"jFd<|jI�st
jd �yd
d!l%m&}|D]�}t"j*j-|�s�#t#jN|t"jP�r�Ht
jd"|z�|jjtd#�|ztd$�|z�|jS���y#t<$r"}t
jd|z�Yd}~yd}~wwxYw)%z= initial cache opening, coherence checking, network checking )�lsb_releasez-cz-sT)�stdout�universal_newlinesrzlsb-release: '%s'zBad upgrade: 'z' != 'z' zCan not upgradezAn upgrade from 'z' to 'z"' is not supported with this tool.rz
/backportszusing backports in '%s' zhave: %sz/*.udebr�zDir::Bin::dpkgz/usr/lib/apt/methodszDir::Bin::methodsz/etc/apt/apt.conf.d/01ubuntuzadding config '%s'z%pythonSymlinkCheck() failed, abortingzMYour python3 install is corrupted. Please fix the '/usr/bin/python3' symlink.zopenCache() failed: '%s'NF�server�RELEASE_UPGRADE_MODE�desktopzcheckViewDepends() failed)�SYSTEM_DIRSz%s not writablezCan not write to '%s'z�Its not possible to write to the system directory '%s' on your system. The upgrade can not continue.
Please make sure that the system directory is writable.)*r��Popen�PIPE�communicate�stripr�r�r�r�r�r�r�r�r�r�r~�havePrerequistsryrz�info�globr{r�r�r�r��read_config_filer�rr��SystemErrorr��coherence_check�need_server_mode�
serverModer��checkViewDepends�DistUpgradeMainr�access�W_OKr�)r�r��backportsdir�confr�r�	systemdirs       r/�preparezDistUpgradeController.prepare�sH��",�!1�!1�2K�*4�/�/�6:�"<�<G�K�M�!�"M�MR�U�W�	U���w�	�
�
�)�G�3�4��4�=�=�(�G�t�{�{�,B��M�M�'�4�=�=�Q�R��J�J���Q�0�1��>E�t�{�{� T�U�
V�
�H�H�Q�K��<�<�D�L�L�8�8��9�9�;�|�3�L��L�L�3�l�B�C��M�M�*�t�y�y��i�1G�'H�H�I��w�w�~�~�l�?�:�;����"�"�#3�L��4P�Q��w�w�~�~�l�+A�A�B����"�"�#6�|�DZ�7Z�[�� >�>�D��w�w�~�~�d�#��
�
�2�T�9�:��(�(�����>�	
�����'�'�)��M�M�A�B��J�J���Q�0�1�� L�M�
N�
�H�H�Q�K�	��N�N���z�z�)�)�$�*�*�5���*�*�5�5�7����?�?�19�B�J�J�-�.�1:�B�J�J�-�.��$�$�&��M�M�5�6��0�$�
	�I��w�w�~�~�i�(����9�b�g�g�1N��
�
�/�)�;�<��
�
� � ��-�.��:��"�#�&/�	/�0��
�
��
	���?�	��M�M�4�q�8�9���	�s�#Q�	Q+�	Q&�&Q+c�T�tjd|z�|jstjd�dgfSg}d}|jD]U}|jD]D}dj||�}t
|tj�rd}�2|j||f��F�W||fS)aI
        Check if deb822 source points to downloadable archive(s).
        Returns a tuple (bool, list).

        The bool is True if any combination of URI and suite was downloadable,
        or False if no combination was.

        The list contains tuples of URI and suite that were not downloadable
        together.
        �verifySourcesListEntry: %s�(skipping downloadable check (no network)TFz{}/dists/{}/Release)r�r�r��uris�suitesr�rr?)r��entry�failed�downloadable�uri�suite�release_files       r/�_deb822SourceEntryDownloadablez4DistUpgradeController._deb822SourceEntryDownloadable�s���	�
�
�2�U�:�;�����M�M�D�E��"�:�������:�:�	/�C����
/��4�;�;�C��G��#�L�'�-�-�@�#'�L��M�M�3�u�+�.�
/�	/��f�%�%rRc���tjd|z�|jstjd�y|j�d|j�d�}t|tj�S)ze
        helper that checks if a sources.list entry points to
        something downloadable
        r!r"Tz/dists/z/Release)r�r�r�r(�distr)r�r%r(s   r/�_sourcesListEntryDownloadablez3DistUpgradeController._sourcesListEntryDownloadablesR��
	�
�
�2�U�:�;�����M�M�D�E��(-�y�y�%�*�*�=����W�]�]�3�3rRc���|rtjd�ntjd�|jjdd�}|jj	ddd�sdt
jvrtjd�d}d}|d	k(�r�|j�r�tj|jjd
d��|jjd
d�D�]U}tjd|z�||jvs�|j|jr�t|j|jj�d
k(s~|j|js��t|j|jj�dk(s��|j|jjd
jdk(s��tjd|z�	t�}|j|j �|j#d�d	}tjd�n|jjdd�}
|j,g|
D�cgc]}|j,�d|����c}z}|j*g|
D�cgc]}|j*�d|����c}z}
d|_g}|j j0ddD�]}d|j2vr�|j4j7d�r�/|j4j7d �r�Kd!|j4vsl|j4j7d"�sQ|j4j7d#�s6|j4j7d$�s|j4j7d%�r��|j8|j,�d�k(rd&|j2vr|j:|_|j=|���||j _d}i|_i}|j j0ddD�	]}|j2|vrd'||j2<|j@s|jBr�:|j2j7d(�r9|j8|j,k(r tjd)|z�d	|_!��|j2j7d(�r�tDjjGd*�}t
jHjK|�d+tEjL|j2��d,�d-|j8�d-d.���stjd/|z�d	|_!��<d0|j,z}|jBs]|j2j7d1�rB|j8|k(r3|j*|_d2g|_'tjd3|z����|jBsF|j2j7d4|j,z�rtjd5�d	|_!��|jBs�|jPr�|jPjRd	k(rxd6|j,z|j8vr]tjd7�d6|j*z|_|xjTtWd8�|j*zz
c_*d	|_!���|jBs�d9|j2vr�tjd:�d;tY�zdfD]~}	t[jZ|�}|	|_|j*|_|j]|�s�Btj^d<|	z�|	|_|j2|vrd=||j2<ntjd>ta|�z�|jc|j2�}|xs|je|j2�}|s|�r
d	}|jBsa|jfd?k(sRd@|j2vsDdA|j,z|j8vs)dB|j,z|j8vsd!|j2vrd}|j8|
vr(tjdCta|�z�||z}�nI|j8|vr�||j2d'k(r[||z}t[jZ|�}|j*|_|j]|�sdD||j2<nd=||j2<||j2dDk(r0d	|_!d	|_tjdEta|�z�n�||z}|
|ji|j8�|_tjdFta|�z�nB|jfd?k(r���|r/d	|_!d	|_tjdGta|�z�|jfdk(rSdH|j2vsdI|j2vr7|jjdJvr)tjdK|jjz�dL|_dM|j*zdN|j*zdA|j*zfD]�}|j>jm|to��|jBr�4|j8|k(s�D|jfdk(s�T|jND]%}||vr�|j>|j)|��'�����|j8|j,k(r|j*|_dOtWdP�|j*zz}tq|jTtr�r%|xjT|judQ�z
c_*n|xjT|z
c_*d	|_!d	|_tjdRta|�z�|s���|j8|vr#|
|ji|j8�|_|j8|
vr���dM|j*zdN|j*zdA|j*zfD]z}|j>jm|to��|j8|k(s�7|jfdk(s�G|jND]%}||vr�|j>|j)|��'�|tjdS|jf�dO|j8�dO|jN���d}	d}|j j)|jf|	|j8|jN|��	�|j j0ddD�]1}|j@sO|jBsC|jfd?k(s4|j2j7d(�s|j8|j*k(r�`|j8|j>vs�y|j>|j*|j>|j8z
}|s��tj^dTta|�z�|jNjwty|tz�U��tj^dVta|�z�|j>|j8=��4|S#t$$r�}tj&d|z�tjd�d}gd�}d}	|j j)d|	|j*||�|j j)d|	|j*dz||�|j j)dd|j*dz||�Yd}~�
�	d}~wwxYwcc}wcc}w)WNz&rewriteSourcesList() with mirror_checkzrewriteSourcesList()r`�
Components�AllowThirdPartyF�"RELEASE_UPGRADER_ALLOW_THIRD_PARTY�,mirror check skipped, *overriden* via configTru�BaseMetaPkgs�Checking pkg: %srr�now�)BaseMetaPkg '%s' has no candidate.originsr&z/get_distro().enable_component("main") succeededz$NoDistroTemplateException raised: %sz]get_distro().enable_component("main") failed, overwriting sources.list instead as last resortz* auto generated by ubuntu-release-upgraderr%� http://archive.ubuntu.com/ubuntu�deb�-updatesri�	-security�Pocketsr7z/extras.ubuntu.comzE## This software is not part of Ubuntu, but is offered by third-partyz5## developers who want to ship their latest software.z/archive.canonical.comzE## Uncomment the following two lines to add software from Canonical'sz## 'partner' repository.zK## This software is not part of Ubuntu, but is offered by Canonical and thez2## respective vendors as a service to Ubuntu userszarchive.ubuntu.com/ubuntu�unknownzcdrom:z,disabled '%s' cdrom entry (dist == fromDist)zDir::State::lists�/�distsr��Releasez:disabling cdrom source '%s' because it has no Release filez
%s-commercialzhttp://archive.canonical.com�partnerz transitioned commercial to '%s' z*http://landscape.canonical.com/packages/%sz&commenting landscape.canonical.com outz%s-proposed�2upgrade to development release, disabling proposedz5Not for humans during development stage of release %s�old-releases.ubuntu.com/z-upgrade from old-releases.ubuntu.com detectedz"http://%sarchive.ubuntu.com/ubuntuz%transition from old-release.u.c to %s�passed�examining: '%s'�deb-src�/security.ubuntu.comz%s-securityz%s-backportsz%entry '%s' is already set to new distr&�)entry '%s' was disabled (no Release file)zentry '%s' updated to new dist�&entry '%s' was disabled (unknown dist)zarchive.ubuntu.comzsecurity.ubuntu.comrfz-moving %s source entry to 'ports.ubuntu.com' z%http://ports.ubuntu.com/ubuntu-ports/�%s�
%s-updates� zdisabled on upgrade to %szUTF-8�(entry '%s' was disabled (unknown mirror)zAdding entry: z)fixing components inconsistency from '%s'��keyzto new entry '%s')>r�r�r�r��getWithDefaultryr�r�r�r��	candidater,�origins�archiver�get_sources�sources�enable_componentr�	exception�addr�r��sources_disabled�listr(�line�
startswithr-r�r?�found_components�invalid�disabledr�r�r{r��uri_to_filename�compsr~r��commentr�r�copyr.rr
�isMirror�isThirdPartyMirror�typer*r��
setdefaultr��
isinstance�bytes�encode�extend�sortedr0)r��mirror_check�sync_components�main_was_missing�pkgname�distror�rbrar(�pockets�x�	fromDists�toDists�new_listr%�foundToDist�entry_uri_test_results�listdir�cdist�
test_entry�validMirror�thirdPartyMirror�validTo�d�comp�disable_comment�component_diffs                            r/�rewriteSourcesListz(DistUpgradeController.rewriteSourcesList)s�����M�M�B�C��M�M�0�1��+�+�-�-�i��E��
�K�K�&�&�y�1B�5�I�0�B�J�J�>��O�O�J�K��L�!���4��D�O�O�

�M�M�$�+�+�-�-�h��G�H��;�;�.�.�x��H�"
���
�
�0�7�:�;� �D�J�J�.����G�,�6�6�����G�,�6�6�>�>�?�1�D��Z�Z��(�2�2�����G�,�6�6�>�>�?�1�D��Z�Z��(�2�2�:�:�1�=�E�E��N��M�M�"M�PW�"W�X�2�!+����*�*�4�<�<�8��/�/��7�+/�(��
�
�&W�X�$�E"
�N�+�+�%�%�i�	�:���]�]�O�07�'9�+,�37�-�-��'C�'9�9�	��;�;�-�,3�#5�'(�/3�k�k�!�#<�#5�5�� %������\�\�&�&�q�)�	#�E�#�u�y�y�0���z�z�$�$�[�]���z�z�$�$�K�M��(�E�J�J�6��
�
�%�%�[�]��
�
�%�%�.�0��
�
�%�%�a�c��
�
�%�%�H�J���
�
�����y�9�9�+�u�y�y�8� �4�4��	��O�O�E�"�=	#�>%�������!#���!#���\�\�&�&�q�)�{	X�E��y�y� 6�6�4=�&�u�y�y�1��}�}������y�y�#�#�H�-�%�*�*��
�
�2M��
�
�L�u�T�U�!%�������%�%�h�/�!�.�.�1�1�2E�F���w�w�~�~�'.�'.�'>�'>�u�y�y�'I�'.�',�z�z�'0�'2�3��O�O�$`�ch�$h�i�%)�E�N��$�d�m�m�3�E��N�N��	�	�$�$�%C�D��
�
�e�#�!�[�[��
�(�k����
�
�@�5�H�I��
�N�N��	�	�$�$�%Q�TX�Ta�Ta�%a�b��
�
�F�G�!%�����N�N�t�|�|��L�L�.�.�$�6���
�
�-����;��
�
�R�S�*�T�[�[�8��
��
�
��#Z�![�^b�^i�^i�!i�i�
�!%�����N�N�*�e�i�i�7��
�
�M�N�@�>�CS�S�>�@�
�C�!%���5�!1�J�%(�J�N�&*�k�k�J�O��9�9�*�E����%L�s�%R�S�$'��	� �9�9�,B�B�@H�2�5�9�9�=��
�
�M�M�+�/X�Y^�/_�_�`��-�-��	�	�2�K�#/�/�U�4�3J�3J�5�9�9�3U���.�
���N�N��J�J�)�+�*�e�i�i�7�!�D�M�M�1�U�Z�Z�?�"�T�]�]�2�e�j�j�@�,��	�	�9�#�G��:�:��(��M�M�"I�Lu�v{�L|�"|�}��7�*�K��Z�Z�9�,�-�e�i�i�8�I�E�#�w�.��%)�Y�Y�u�%5�
�*.�+�+�
��#�A�A�*�M�@H�2�5�9�9�=�@H�2�5�9�9�=�-�e�i�i�8�H�D�)-���04��-��
�
�&Q�T}�D�UE�'E�F�#�w�.��%,�Y�_�_�U�Z�Z�-H�%I��
��
�
�&F�Ir�sx�Iy�&y�z��Z�Z�9�,�� �&*�E�N�,0�D�)��M�M�"J�Mv�w|�M}�"}�~�
�J�J�%�'�)�U�Y�Y�6�*�e�i�i�7��Y�Y�&7�7��M�M�"Q�TX�T]�T]�"]�^� G�E�I�����,�&����4�'�$�+�+�5�7�?�A�
�)�)�4�4�Q���>�!�N�N�u�z�z�Q���
�
�e�+�$)�K�K�?�D�#'�?�#:� (� �1�1�!�4�8�8��>�	?�?�"�:�:����.�!%���E�J�"%��*E�(F����(T�"T���e�m�m�U�3��M�M�_�%;�%;�G�%D�D�M��M�M�_�4�M�!%���(,��%��
�
�H�Kt�uz�K{�{�|�$��z�z�Y�.�%,�Y�_�_�U�Z�Z�-H�%I��
��z�z��0� �"�T�[�[�0�*�T�[�[�8�+�d�k�k�9�;�
C���-�-�8�8��C�E�B� �:�:��?�u�z�z�U�/B�(-���C��'+��'>�$,� $� 5� 5�a� 8� <� <�T� B�	C�
C��M�M�e�j�j�%�*�*�V[�Va�Va�"b�c�<�C�J�G��L�L�$�$�U�Z�Z��e�j�j�%�+�+�w�W�w{	X�~�\�\�&�&�q�)�	:�E��
�
����5�:�:��3J��	�	�$�$�X�.�%�*�*����2K���z�z�T�2�2�2�!%�!6�!6�t�{�{�!C�D�DY�DY�Z_�Zd�Zd�De�!e��!��L�L�!L�Ox�y~�O�!�A��K�K�&�&��~�3I�J�L��L�L�!4�7`�af�7g�!g�h��-�-�e�j�j�9�	:����i5�2��)�)�*P�ST�*T�U� �
�
�'F�G�"N�� P��@�����(�(���T�[�[�%�)0�2����(�(���T�[�[��5K�).��9����(�(��)L�)-���[�)@�%�)0�2�2��2��.'9��#5s&�9A
z
�5}�"}�
	}�B6}�}c��tsyt|jd��}|D�cgc]}t|t�s�|��}}|D�cgc]}t|t�r�|��}}t
jjtjjd�tjjd��}|D�cgc]}|j|k(r|js|��!}}|r|sy|r|ryycc}wcc}wcc}w)a
        Return an integer indicating if sources are migrated to deb822.
        Possible return values are:

            -1: not migrated to deb822 sources
             0: partially migrated to deb822 sources
             1: fully migrated to deb822 sources
        ���T��matcherPath�deb822�Dir::Etc�Dir::Etc::sourcelistrr)�have_deb822_source_entryrr}rhrryr{r|r�r�r��find�filer^)r�rU�sr��	nondeb822�sourcelist_files      r/�migratedToDeb822z&DistUpgradeController.migratedToDeb822gs���(���$�,�,�t�D��$�I��
�1�6G�(H�!�I��I� '�P�1�z�!�=N�/O�Q�P�	�P��'�'�,�,��N�N�#�#�J�/��N�N��� 6�7�
��!*�G�1��V�V��6�1�9�9��G�	�G��)��
�	����)J��P��Gs�C.�C.�C3�C3�=$C8c	�v�tjd�tjj	t
jjd�t
jjd��}t
jjd�}t
jjd�}t|j��|_|jj|j�i}|jD�]L}t|t�r|j r�!|j"dk(r
|j$r�=|j&|k(r]|j)|j*�r!tjj	|d�}nPtjj	|d	�}n/tjj-|j&�d
dz}||j$|j"|j*|j.f}	||}t1t3|d|j4z��|d<|dj7t8�
���O|j=�D�	cgc]}	|	d��	c}	D]y}
|j=�D�	cgc]
}	|	d|
k7s�|	��c}	D]M}		|g|	dd�|
��}|d||	dk(r/|dxx||	dz
cc<|dj7t>�
�||	=�O�{|jA�D�	�cgc]\}	}|	ddk(s�|	|f��c}}	D]�\}}|jA�D�	�cgc]\}	}|	ddk(s�|	|f��c}}	D]Z\}
}d}||d|dk(z}||d|dk(z}||d|dk(z}||d|dk(z}||d|dk(z}|s�Qddg|d<||=�\��|jC�D�]�}|d}|tjj	|d�k(rd|d<�2tjjEtjj-|�d
�}tjj	||dz�}tjjG|�swtjjEtjj-|�d
�}|jIdd�d
dz}tjj	||�}tjjG|�s��K|jKd�r��^tM|�}|D�cgc]}d|jO�r|ndz��}}ddj	|�z|d<���t3|jC�D�cgc]}|d��	c}�D�]C}g}|jC�D�cgc]
}|d|k(s�|��c}D]�}d }|dr|d!z
}|d"jQdj	|d��z
}|d#jQdj	|d��z
}|d$jQdj	|d��z
}|d%jQdj	|d��z
}|jKd�r|d&jQ|d�z
}|jS|���tU|d'�5}|jWdj	|��ddd���F|jD�cgc]}t|t�s�|��c}D]e}tjjG|j&�rtjX|j&�|jjY|��g|jj[�tU|d'�5}|jWd(jQtjj	|d���ddd�y#t:$r�i}||d<|j$|d<|j"g|d<|j*g|d<|j.g|d<t1t3|j4��|d<|dj7t8�
�|||<Y��hwxYwcc}	wcc}	w#t:$rY���wxYwcc}}	wcc}}	wcc}wcc}wcc}w#1swY��xYwcc}w#1swYyxYw))zF
        Migrate .list files to corresponding .sources files.
        zmigrateToDeb822Sources()r�r�rdzDir::Etc::trustedparts�r�rFrezthird-party.sourcesrz.sourcesrarN�filepathr_�typesr#r$r�Nr8r9Tz/ /usr/share/keyrings/ubuntu-archive-keyring.gpgz	signed-byz.gpgr7rrLrV�
r2zEnabled: no
z
Types: {}
z	URIs: {}
zSuites: {}
zComponents: {}
z
Signed-By:{}
�wz"# Ubuntu sources have moved to {}
).r�r�ryr{r|r�r�r�r�rr}rU�backupr�rhrr^rfr_r�rdr(�splitextr-rZr�ra�sortr0�KeyError�keysr;r��values�basenamer��rsplitrrKrr�r?r@�write�remove�save)r�r��sourceparts_dir�trustedparts_dirr*r%�new_filepathrOr��kr)�ks�se�kb�be�can_combiner��keyring�lines�lr{�stanzas�stanzarHs                        r/�migrateToDeb822Sourcesz,DistUpgradeController.migrateToDeb822Sources�s���	�
�
�0�1��'�'�,�,��N�N�#�#�J�/��N�N��� 6�7�
��"�.�.�1�1�2I�J��"�>�>�2�2�3K�L��"�t�|�|�<��������D�3�3�4����\�\�&	�E��e�[�1�U�]�]��
�z�z�Y�&�5�>�>���z�z�_�,��=�=����+�#%�7�7�<�<��AQ�#R�L�$&�7�7�<�<��AV�#W�L� "�w�w�/�/��
�
�;�A�>��K�� �������U�Y�Y��
�
�S�C�

��#�J��!�#�a��j�5�;�;�&>�"?�@��'�
��'�
���$:��;�9&	�P&+�Z�Z�\�2��a��e�2�	�E�!&����@�A��2��%��a�@�

��	��.��#�2��.��.�/�A���z�U�1�X�g�%6�6��(��u�Q�x��'9�9���(��(�(�-?�(�@�!�!�H��

�	�-2�K�K�M�O�5�A�a�Q�q�T�Y�=N�!�A��O�	"�H�R��05���
�O�u��!��1����a��U�O�

"���R�"���r�*�~��J��?�?���r�*�~��J��?�?���r�&�z�R��Z�7�7���r�(�|�r�(�|�;�;���r�'�{�b��k�9�9���#(�)�"4�B�w�K��b�	�

"�	"��\�\�^�	A�E��Z�(�H��2�7�7�<�<��9I�J�J�%V��k�"��'�'�*�*�2�7�7�+;�+;�H�+E�a�+H�I���'�'�,�,�'7��6�9I�J���w�w�~�~�g�.�!�g�g�.�.�r�w�w�/?�/?��/I�!�/L�M�G�%�n�n�S�!�4�Q�7�&�@�G� �g�g�l�l�+;�W�E�G��7�7�>�>�'�*�5�9�9�[�3I�0��9�E�FK�L��S�����A��<�L�E�L�)-��	�	�%�0@�)@�E�+�&�+	A�4�����?�1��:��?�@�	,�D��G�!&����I�A�1�Z�=�D�3H�a�I�

'�����Z�=��o�-�F��-�.�.�s�x�x��'�
�/C�D�D���,�-�-�c�h�h�q��y�.A�B�B���.�/�/�����8��0E�F�F���,�3�3�C�H�H�Q�w�Z�4H�I�I���5�5��%��.�5�5�a��n�E�E�F����v�&�

'��d�C��
,�A�����	�	�'�*�+�
,�
,�%	,�,"&���L�A��A�{�1K�a�L�	'�E��w�w�~�~�e�j�j�)��	�	�%�*�*�%��L�L����&�		'�	
�������/�3�
'�	N�1�
�G�G�9��V�B�G�G�L�L��:J�K�L�
N�	N�	N��A�	
��� ,��*�
� %����*�
�#�j�j�\��'�
�"�Y�Y�K��&�	�$�z�z�l��(��!�#�e�k�k�"2�3��'�
��'�
���$:��;���c�
�	
��3��@�� �����P��O��@M��@��J�
,�
,��M�	N�	N�s��A_�a(�
a-�a-�A
a2�<b�
b�0b�b�'b�8b�#
b�1b�&!b� b*�6b*�?b/�Ba%�$a%�2	a?�>a?�b'	�/b8c��|jj|jd|j|jgd���}t|j|jdzgt��|_d|jd<y)Nr9r%�r�rfr(r-�
orig_compsr:rN�./usr/share/keyrings/ubuntu-archive-keyring.gpg�	Signed-By)	rUrXr�r�r�rlr;r$�section�r�r�s  r/�_addDefaultSourcesz(DistUpgradeController._addDefaultSourcessm���L�L����.�.���'�'����G�
�
���4�;�;����j�(@�A�0�2���!Q��	�	�+�rRc��|jj|jd|j|jdzgd���}d|j
d<y)Nr9r;r%r�r�r�)rUrXr�r�r�r�r�s  r/�_addSecuritySourcesz)DistUpgradeController._addSecuritySources(sP���L�L����.�.���(�(����{�*�G�
�
��"R��	�	�+�rRc�r�t|jjddd�dtjvf�S)Nr`r1Fr2)�anyr�rPryr��r�s r/�_allowThirdPartyz&DistUpgradeController._allowThirdParty2s7����K�K�&�&�y�1B�5�I�0�B�J�J�>�
��	rRc��|j�rtjd�y|j�rVtj|j
j
dd��|j
j
dd�D�]}tjd|z�||jvs�|j|jr�t|j|jj�dk(s~|j|js��t|j|jj�dk(s��|j|jjdjdk(s��tjd	|z�y
y)Nr3Trur4r5rrr6r7F)r�r�r�r�r�r�r�r�rQr,rRrS)r�rps  r/�_mirrorCheckz"DistUpgradeController._mirrorCheck8s1��� � �"��O�O�J�K���?�?�

�M�M�$�+�+�-�-�h��G�H��;�;�.�.�x��H�
!���
�
�0�7�:�;� �D�J�J�.����G�,�6�6�����G�,�6�6�>�>�?�1�D��Z�Z��(�2�2�����G�,�6�6�>�>�?�1�D��Z�Z��(�2�2�:�:�1�=�E�E��N��M�M�"M�PW�"W�X� �
!�rRc�p
�d}tjd|rdndz�|r |j�s|j�|j|j
i}|jjdd�D]?}dj|j|�}dj|j
|�}|||<�Ad|_	i|_
|jD�cgc]5}t|j|jt|t �f�s|��7}}|D�]�}	|j"rk|j"j$rUtjd�t'|	j(�t'|jd	zg�z
}
|
sd
|	_�t|
|	_t'|	j,D�cgc]}d|vr|��
c}�|	_|	j,sQ|	j(D�cgc]}|j/d�s�|��c}r|j0g|	_n|j2g|	_tjd
t5t7j8|	��z�|	j,D�cgc]@}t|j;|�|j=|�||j?�f�r|��B}
}|
sDd
|	_d
|_	tjdt5t7j8|	��z����g}|	j(D]}	|jA||��|sDd
|	_d
|_	tjdt5t7j8|	��z���AtGtIt'|��tJ��|	_|	j,D�cgc]}d|vr|��
}}|	j(D�cgc]}|jMdd�ddvr|��}}d|	jNvxr|xr|}|s���|jQ|	�\}}|sDd
|	_d
|_)tjdt5t7j8|	��z���*|r6tjdt5t7j8|	��z���bd
}|	j(D]-}	|j|xxt'|	jT�zcc<�/���|Scc}wcc}wcc}wcc}w#tB$r'||jE�vr|jA|�Y��wxYwcc}wcc}w#tB$r%t'|	jT�|j|<Y��wxYw)z�
        deb822-aware version of rewriteSourcesList()

        Return True if we found a valid dist to ugprade to, and return False
        otherwise.
        FzrewriteDeb822Sources()z with mirror_checkr2r`r<z{}-{}rBz	-proposedTrCr;rErMrIrNrGr7rr�)r5r4r9rHz0some Release files were not downloadable for '%s)+r�r�r�r�r�r�r�r�r�rYr]rUr�r^r_rhrr~r�r�r$�sutesr#�endswithr�r�r
rc�deepcopyrdrer�r?r�r�rlrZr;r�r�r+�source_disabledra)r�rm�
found_to_dist�
suite_mappingr:rH�tr�rUr%�no_proposed�ur��
known_mirrors�
new_suites�
valid_uris�valid_suites�valid_tor'r&r)s                     r/�rewriteDeb822Sourcesz*DistUpgradeController.rewriteDeb822SourcesUs���
��
�
�.�/;�+��E�	F��� 1� 1� 3��#�#�%�������4�
��k�k�)�)�)�Y�?�	!�F����t�}�}�f�5�A����t�{�{�F�3�A� �M�!��	!�!&��� "����|�|�
����	�	��
�
��q�"3�4�4���
�
��
��]	H�E��|�|���� :� :��
�
�R�S�!�%�,�,�/�#�t�}�}�{�7R�6S�2T�T��"�&*�E�N��#.�E�K�����F�A�!;�1�!D� �F�G�E�J��:�:�$�|�|�G�!�q�z�z�+�/F�A�G�"&�":�":�!;�E�J�"&�"9�"9�!:�E�J��M�M�+�C�D�M�M�RW�DX�Y�Z�
[�
!�:�:�����M�M�!�$��+�+�A�.�$�$��)�)�+�	����M��!�!%���(,��%��
�
�H� I�$�-�-�X]�J^� _�`�a���J��\�\�
-��-��%�%�m�A�&6�7�
-��!%���(,��%��
�
�F� I�$�-�-�X]�J^� _�`�a��%�d�3�z�?�&;�AS�T���&+�Z�Z�>��3�1�<��>�J�>�',�|�|�V�!� �x�x��Q�/��3�;T�T��V�L�V�����+�K�
�K�|�H���&*�%H�%H��%O�"�\�6��!%���'+��$��
�
�I� I�$�-�-�X]�J^� _�`�a����
�
�P� I�$�-�-�X]�J^� _�`�a�!%�
�"�\�\�H�E�H��-�-�e�4��E�K�K�8H�H�4�H�s]	H�~���Q
��0F��H����, �-��M�0�0�2�2�"�)�)�!�,��-��">��V��0$�H�7:�5�;�;�7G��-�-�e�4�H�sO�:R6�
R;
�S�)S�AS�6S
�
S=�% T�*T�
,S:�9S:�+T5�4T5c�&��tjd�t�jd���_�jj�j��jD�cgc]}|jr�|��}}t�fd�|D��sM�jjtd�td��jz�}|s�j��jd���s$tjd��jjtd�td	��j�j fz�}|r�t�jd���_�jd
��s��j"r�td�}td��j�j fz}�jj||�s�j��j%��j'�n�j��jj)��j*r.�jj-td
�td��t/�j1�j*�ycc}w)z=
        deb822-aware version of updateSourcesList()
        zupdateDeb822Sources()Tr�c3�n�K�|],}d|jvxr�j|jv���.y�w�r9N)r�r�r$��.0r�r�s  �r/�	<genexpr>z<DistUpgradeController.updateDeb822Sources.<locals>.<genexpr>�s/�����S�a�5�A�G�G�#�A��
�
����(A�A�S�s�25zNo valid source entry found��While scanning your repository information no entry about %s could be found.

An upgrade might not succeed.

Do you want to continue anyway?�rm�No valid mirror found�WWhile scanning your repository information no mirror entry for the upgrade was found. This can happen if you run an internal mirror or if the mirror information is out of date.

Do you want to rewrite your 'sources.list' file anyway? If you choose 'Yes' here it will update all '%s' to '%s' entries.
If you select 'No' the upgrade will cancel.F�Generate default sources?z�After scanning your 'ubuntu.sources' no valid entry for '%s' was found.

Should default entries for '%s' be added? If you select 'No', the upgrade will cancel.�Third party sources disabled��Some third party entries in your sources.list were disabled. You can re-enable them after the upgrade with the 'software-properties' tool or your package manager.)r�r�rr}rUr�r�r^r�r�r�r�r�r�r�r�r�r�r�r�r�rYr��
get_telemetry�set_using_third_party_sources)r�r�rUr��prim�secons`     r/�updateDeb822Sourcesz)DistUpgradeController.updateDeb822Sources�s���	�
�
�-�.�"�t�|�|�D�I��������D�3�3�4�"�l�l�<��!�)�)�1�<��<��S�7�S�S��*�*�-�-�a�0M�.N�� A�B�EI�M�M�	R�S�C���
�
���(�(�d�(�;��M�M�1�2��*�*�-�-�a�0G�.H��
 M�!�%)�M�M�4�;�;�#?�@�A�C��*�t�|�|�D�Q����1�1�u�1�E�����8�9�D��-�.�26������0L�	M�E�
 �:�:�6�6�t�U�C��
�
���+�+�-��,�,�.��
�
��	
������� � ��J�J�"�"�1�%C�#D�� 7�!�
"�	��5�5�d�6K�6K�L���}=s�&J�8Jc���tjd�t�j���_�jj�j�t�fd��jD��sM�jjtd�td��jz�}|s�j��jd���s�tjd��jjtd�td	��j�jfz�}|�r0t�j���_�jd
���s�j �rtd�}td��j�jfz}�jj||�s�j�tj"d
�d}gd�}�jj%d|�j|��jj%d|�jdz|��jj%dd�jdz|�n�j��jj'�	t)j*�}|j,��j:r.�jj=td�td��t?�jA�j:�y#t.$r�tjd�t0j2j5d�rG�jjtd�td��t7j8ddg�Yy
�jjtd�td��tjd�Yy
wxYw)NzupdateSourcesList()r�c3�r�K�|].}|jdk(xr|j�jk(���0y�wr�)rfr-r�r�s  �r/r�z:DistUpgradeController.updateSourcesList.<locals>.<genexpr>'s.�����U�1�1�6�6�U�?�>�q�v�v����'>�>�U�s�47z!No valid sources.list entry foundr�Tr�r�r�Fr�z�After scanning your 'sources.list' no valid entry for '%s' was found.

Should default entries for '%s' be added? If you select 'No', the upgrade will cancel.z"Generated new default sources.listr8r%r9r:z"http://security.ubuntu.com/ubuntu/r;z<Repository information invalid after updating (we broke it!)�/usr/bin/apport-bugzRepository information invalidzlUpgrading the repository information resulted in a invalid file so a bug reporting process is being started.�
apport-bug�ubuntu-release-upgrader-corez�Upgrading the repository information resulted in a invalid file. To report a bug install apport and then execute 'apport-bug ubuntu-release-upgrader'.�.Missing apport-bug, bug report not autocreatedr�r�)!r�r�rr}rUr�r�r�r�r�r�r�r�r�r�r�r�rrXr�r��
SourceList�read_main_listrryr{r�r�rrYr�r�r�)r�r�r�r�r(rars`      r/�updateSourcesListz'DistUpgradeController.updateSourcesList!s3����
�
�+�,�"�t�|�|�<��������D�3�3�4��U����U�U��*�*�-�-�a�0S�.T�� A�B�EI�M�M�	R�S�C���
�
���&�&�D�&�9��M�M�1�2��*�*�-�-�a�0G�.H��
 M�!�%)�M�M�4�;�;�#?�@�A�C��*�t�|�|�D����/�/�U�/�C�����8�9�D��-�.�26������0L�	M�E�
 �:�:�6�6�t�U�C��
�
���L�L�!E�F�<�C�L�E��L�L�$�$�U�C����e�D��L�L�$�$�U�C����Z�1G��O��L�L�$�$�U�%I�%)�[�[��%<�e�E��
�
��	
������	�!�,�,�.�K�&�K�&�&�(�&� � ��J�J�"�"�1�%C�#D�� 7�!�
"�	��5�5�d�6K�6K�L���7�	��M�M�X�Y��w�w�~�~�3�4��
�
� � ��#C�!D�!"�$I�"J�K�� � �,�0N�!O�P���
�
� � ��#C�!D�!"�$K�"L�M�
�
�
�,�-��!	�s�%L�BO�AO�Oc��tjd�g}g}g}g}g}|jD]�}|jr|j	|j
��+|jr|j	|j
��S|jr|j	|j
��{|jr(|jr|j	|j
���|js��|js��|j	|j
���tjddj|�z�tjddj|�z�tjddj|�z�tjddj|�z�tjddj|�z�y)Nz$About to apply the following changeszKeep at same version: %srLzUpgradable, but held- back: %sz
Remove: %szInstall: %szUpgrade: %s)r�r�r��marked_installr?�name�marked_upgrade�
marked_delete�is_installed�
is_upgradable�marked_keepr|)r��inst�up�rm�held�keep�pkgs       r/�_logChangesz!DistUpgradeController._logChanges�sD���
�
�<�=���
��
�������:�:�	M�C��!�!�4�;�;�s�x�x�#8��#�#�R�Y�Y�s�x�x�%8��"�"�B�I�I�c�h�h�$7��"�"�s�'8�'8�4�;�;�s�x�x�;P��!�!�c�o�o�t�{�{�3�8�8�7L�	M�	�
�
�0�3�8�8�D�>�A�B��
�
�6����$��G�H��
�
�l�S�X�X�b�\�1�2��
�
�m�c�h�h�t�n�4�5��
�
�m�c�h�h�r�l�2�3rRc���tjd�|jjd�|jsyt|jj�dkDrJtjd�|jj|j�|j�t|jj�dkDrq|jj}tddt|��}tdd	t|��d
j|�z}|jj||�yg}|jjdd�D]<}||jvs�|j|j s�,|j#|��>tjd
djt%|��z�|jj'�|_|jj+|j,|j.|j0�|_t|j2�dkDr|jj5ddd�n|jj5ddd�tjddjt%|j2��z�tjddjt%|j(��z�y)N�doPostInitialUpdate�PostInitialUpdateFrz-packages in reqReinstall state, trying to fixzPackage in inconsistent statezPackages in inconsistent statez�The package '%s' is in an inconsistent state and needs to be reinstalled, but no archive can be found for it. Please reinstall the package manually or remove it from the system.z�The packages '%s' are in an inconsistent state and need to be reinstalled, but no archive can be found for them. Please reinstall the packages manually or remove them from the system.z, ru�MetaPkgszMetaPkgs: %srLr[�foreignPkgsr_r^�Foreign: %s�Obsolete: %sT)r�r�r�r�r�r,�req_reinstall_pkgsr��fix_req_reinstr�r�rr|r�r�r�r�r?rl�_getObsoletesPkgs�
obsolete_pkgs�_getForeignPkgsr�r�r��foreign_pkgsr�)r��	reqreinst�headerr��	meta_pkgsr�s      r/r�z)DistUpgradeController.doPostInitialUpdate�s5��	�
�
�+�,������+�,��z�z���t�z�z�,�,�-��1��O�O�K�L��J�J�%�%�d�j�j�1��N�N���t�z�z�,�,�-��1��
�
�5�5�I��=�>�!�)�n�.�F�� ?�
 A�
 #�9�~�
/�26���9�1E�
F�G�
�J�J���V�W�-���	��;�;�&�&�x�
�;�	&�C��d�j�j� �T�Z�Z��_�%A�%A�� � ��%�	&�	�
�
�n�s�x�x��y�0A�'B�B�C�"�Z�Z�9�9�;��� �J�J�6�6�t�{�{�D�M�M�SW�S^�S^�_����t� � �!�A�%��K�K�O�O�I�m�V�<��K�K�O�O�I�m�W�=��
�
�m�c�h�h�v�d�6G�6G�/H�&I�I�J��
�
�n�s�x�x��t�7I�7I�0J�'K�K�L�rRc��tjd|z�|jstjd�y|jjj�|jj�}d}|�|}n|jjdd�}d}||kr	|jj|�ytjd�|r2|jjtd
�td�d|z�y#ttf$r6}t|�}tjd|�d	|�d
��|dz
}Yd}~��d}~wwxYw)Nz"running doUpdate() (showErrors=%s)zBdoUpdate() will not use the network because self.useNetwork==falseTrrprqr2z(IOError/SystemError in cache.update(): 'z'. Retrying (currentRetry: �)rzdoUpdate() failed completelyzError during updatez�A problem occurred during the update. This is usually some sort of network problem, please check your network connection and retry.rJF)r�r�r�r��_listr�r�r�r�r��updater�IOErrorr�r�r�)r��
showErrors�forceRetriesr��currentRetryr��	error_msgr�s        r/�doUpdatezDistUpgradeController.doUpdate�s)���
�
�:�Z�G�H�����M�M�^�_���
�
���'�'�)��:�:�0�0�2�����#�#�J����+�+�I�l�C�J��	��Z�'�
��
�
�!�!�(�+���
�
�4�5���J�J���Q�4�5�� 7�8�:>�	�9I�	
K�
�� ��)�
���F�	��
�
�lm�nz�{�|���!����	
�s�$D
�
E�,E
�
Ec
���tjjd�stjd�ygd�}t�fd�|D��stjd�yd}t
d�5}|D]e}|j�}	|j�\}}}}}	}
|d
k7r�1d}d|jd�vs�Gtjd|�ddd�y	ddd�|s/�jjtd�td��y�jjtd�td��y#t$r&}tjd	|�d
|�d��Yd}~��d}~wwxYw#1swY��xYw)z= check that /boot/efi is a mounted partition on an EFI systemz/sys/firmware/efizNot an UEFI systemT)zshim-signedzgrub-efi-amd64z
grub-efi-ia32zgrub-efi-armzgrub-efi-arm64�
sicherbootc3�p�K�|]-}|�jvxr�j|j���/y�w�N)r�r�)r��blr�s  �r/r�z6DistUpgradeController._checkBootEfi.<locals>.<genexpr>�s0�����Z��2����#�C��
�
�2��(C�(C�C�Z�s�36z'UEFI system, but no UEFI grub installedFz/proc/mountszline 'z"' in /proc/mounts not understood (r
Nz	/boot/efi�rw�,zFound writable ESP %sz%EFI System Partition (ESP) not usablezxYour EFI System Partition (ESP) is not mounted at /boot/efi. Please ensure that it is properly configured and try again.zzThe EFI System Partition (ESP) mounted at /boot/efi is not writable. Please mount this partition read-write and try again.)
ryr{r�r�r�r�r@r�splitr+r�r�r�)r��bootloaders�mounted�mountsr[�what�where�fsr~r-�br�s`           r/�
_checkBootEfiz#DistUpgradeController._checkBootEfi�ss����w�w�~�~�1�2��M�M�.�/��y���Z�k�Z�Z��M�M�C�D����
�.�
!�	 �V��
 ���Z�Z�\���7;�z�z�|�4�T�5�"�g�q�!�
�K�'�����7�=�=��-�-��M�M�"9�4�@��!	 �	 �
 �	 �$��J�J���Q�F�G�� J�K�
L��	
�J�J���Q�F�G�� J�K�
L���/"���M�M�UY�[\�"]�^�����	 �	 �sB�2E8�	E� E8�<E8�E8�	E5�E0�+E8�0E5�5E8�8Fc
�d�td�}td�}td�}td�}td�}td�}td�}|jjdd	d
�rtjd�y|j�}	|jj|�y#t$r�}	tjjd
�}
d}|
|d|d|d|d|d|i}|	jD]�}
|dk7r|dz
}|
j|vrD||j|
j|
j|
j||
j��z
}�_||j|
j|
j|
jd��z
}��|j j#||�Yd}	~	y
d}	~	wwxYw)z: this checks if we have enough free space on /var and /usrzNot enough free disk spacez�The upgrade has aborted. The upgrade needs a total of {str_total} free space on disk '{str_dir}'. Please free at least an additional {str_needed} of disk space on '{str_dir}'. {str_remedy}zIRemove temporary packages of former installations using 'sudo apt clean'.z�You can remove old kernels using 'sudo apt autoremove' and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.zbEmpty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.z!Reboot to clean up files in /tmp.r2�	FreeSpace�	SkipCheckFz,free space check skipped via config overrideT�Dir::Cache::archivesz/varz/bootr>z/tmpz/usrrL)�	str_total�str_dir�
str_needed�
str_remedyN)r�r�rPr�r�� _is_apt_btrfs_snapshot_supportedr��checkFreeSpacer"r�r��free_space_required_list�dirr��
size_total�size_neededr�r�)r��err_sum�err_msg�remedy_archivedir�remedy_boot�remedy_root�
remedy_tmp�
remedy_usr�with_snapshotsr��
archivedir�err_long�remedy�reqs              r/�_checkFreeSpacez%DistUpgradeController._checkFreeSpaces����0�1���9�:��
�F�G���=�>��
�0�1���:�;�
��r�U�
��;�;�%�%�k�+�e�D��O�O�J�K���>�>�@��	��J�J�%�%�n�5�4��3'�	�!���0�0�1G�H�J��H� �"3��/��{��;��j��j�*�F��1�1�

>���r�>���_�X��7�7�f�$��������QT�QX�QX�:=�/�/�:@����/�!/�!K�K�H��������QT�QX�QX�:=�/�/�:<�!/�!>�>�H�

>�
�J�J���W�h�/���1	�s�B.�.	F/�7C.F*�*F/c	�(�|jjtd��|jj	|j|j
|j�sy|j
r0|jj|jj�sy|jj�}|jj�|j�|jj�|j�sy|j�sy|jj�|jj�|_t!|j�dkDr�|jj#�t%j&ddj)|jD�cgc]}|j*��c}�z�t%j&d|j,z�|jj�|Scc}w)N�Calculating the changesFrz
demoted: '%s'rLzfound components: %s)r�r�r�r��distUpgraderr��installTasks�installedTasks�get_changesr�r�r@r%�get_installed_demoted_packages�installed_demotionsr,r�r�r�r|r�r])r��changesrss   r/�calcDistUpgradez%DistUpgradeController.calcDistUpgradeXs{���
�
����";� <�=��z�z�%�%�d�j�j�$�/�/�4�CW�CW�X���?�?��:�:�*�*�4�:�:�+D�+D�E���*�*�(�(�*���
�
� � �"�	
�����
�
� � �"��#�#�%���!�!�#���
�
� � �"�$(�:�:�#L�#L�#N�� ��t�'�'�(�1�,��$�$�)�)�+��M�M�/�C�H�H�d�F^�F^�5_��a�f�f�5_�,`�`�a��M�M�0�4�3H�3H�H�I�	
�
�
� � �"����6`s�1Hc��|j�}|sy|jjtd�||j|j
j�}|S)NFz!Do you want to start the upgrade?)rJr��confirmChangesr�rHr��required_download)r�rIr�s   r/�askDistUpgradez$DistUpgradeController.askDistUpgrade~sU���&�&�(�����j�j�'�'��*M�(N�(/�(,�(@�(@�(,�
�
�(D�(D�F���
rRc��tj�}|j|j�xrtj
j
d�S)Nz2/var/snap/canonical-livepatch/common/machine-token)�distro_info�UbuntuDistroInfo�is_ltsr�ryr{�isfile)r��dis  r/�_isLivepatchEnabledz)DistUpgradeController._isLivepatchEnabled�s6��
�
)�
)�
+���y�y����'�p�B�G�G�N�N�;o�,p�prRc�4��tj�}�j�r|j�j�ryt�fd�|j
d�D��j�}�jjdtd�|z�}|S)NTc3�j�K�|]*}|j�jk(s�|j���,y�wr)�seriesr��version)r��rr�s  �r/r�z5DistUpgradeController.askLivepatch.<locals>.<genexpr>�s$�����[�a�1�8�8�t�{�{�CZ��	�	�[�s�3�3�objectzdLivepatch security updates are not available for Ubuntu %s. If you upgrade, Livepatch will turn off.)
rPrQrUrRr��next�get_allr��askCancelContinueQuestionr�)r�rTrYr�s`   r/�askLivepatchz"DistUpgradeController.askLivepatch�s����
�
)�
)�
+���'�'�)�R�Y�Y�t�{�{�-C���[�2�:�:�h�+?�[�]a�]h�]h�i���j�j�2�2�4�
�9�
:�<C�
D�E���
rRc���tjjd�rBtjdt|j�z�tjdd�yy)N�/etc/cron.daily/aptzdisabling apt cron job (%s)i�)ryr{r�r�r��octr��chmodr�s r/�_disableAptCronJobz(DistUpgradeController._disableAptCronJob�sD��
�7�7�>�>�/�0��M�M�7�#�d�>S�>S�:T�T�U��H�H�*�5�1�1rRc��tjjd�r6tjd�tj
d|j�yy)Nrazenabling apt cron job)ryr{r�r�r�rcr�r�s r/�_enableAptCronJobz'DistUpgradeController._enableAptCronJob�s:��
�7�7�>�>�/�0��M�M�1�2��H�H�*�D�,A�,A�B�1rRc���|j�d}|jj�}|jj	ddd�}|rX	tj�djd�d}|jj�j|�d|���|jjdd	�}d
}d}||krk	tj|jj �}tj"|�|_|jj'|j$|�y|r/|jj3t5d�t5d��nGtj0d�|jj1t5d�t5d�d|z�|j7�|j9�y#tjd�d}Y��sxYw#t(jj*$r#}	tj,d�d}|	}Yd}	~	��d}	~	wt.$r.}	tj0d
|	�d|�d��|dz
}|	}Yd}	~	���d}	~	wwxYw)Nrru�SlideshowUrlr��getdefaultlocale�enz#locale=rprqFz
user canceledT�IOError in cache.commit(): '�'. Retrying (currentTry: r
rzUpgrade canceledzwThe upgrade will cancel now and the original system state will be restored. You can resume the upgrade at a later time.�+giving up on fetching after maximum retries�Could not download the upgradesz�The upgrade has aborted. Please check your Internet connection or installation media and try again. All files downloaded so far have been kept.rJ)rdr�r�r�rP�localerirr�rW�getHtmlViewr@r�r��PackageManagerr��	_depcache�Acquirer��_fetch_archives�apt�FetchCancelledExceptionrrr�r�r�rfr�)
r�r�	fprogress�url�langr��
user_canceledrW�pmr�s
          r/�doDistUpgradeFetchingz+DistUpgradeController.doDistUpgradeFetching�s�����!����J�J�1�1�3�	��k�k�(�(��.��F���
��.�.�0��3�9�9�#�>�q�A��
�J�J�"�"�$�)�)�C��*F�G��[�[�'�'�	�,�?�
��
�
�	��Z�'�
��+�+�D�J�J�,@�,@�A��&���y�9����
�
�*�*�4�<�<��<����J�J�"�"�1�%7�#8�#$�&-�$.�
/�
�M�M�G�H��J�J���Q�@�A�� C�D�"�I�-�
/�	
��� ��
�
���y
��!�!�"4�5����8�9�9�4�4�
����_�-� $�
��	����
��
�
�^_�`l�m�n���!���	���
�s1�
)G
�
A)G,�
G)�,I!�	H'�'I!�3#I�I!c���	ddl}	|j�}|j�}t	jd|z�|S#t$rYywxYw#t	j
d�YyxYw)z' check if apt-btrfs-snapshot is usable rNzfailed to check btrfs supportFz!apt btrfs snapshots supported: %s)�apt_btrfs_snapshot�ImportError�AptBtrfsSnapshot�snapshots_supportedr�rWr�)r�r~�	apt_btrfsr�s    r/r.z6DistUpgradeController._is_apt_btrfs_snapshot_supported�sp��	�%�	�*�;�;�=�I��/�/�1�C�	�
�
�9�C�?�@��
���	��	��
	����=�>��s�A� A�	A
�A
�A)c���|j�syddl}|j�}d|jz}|j	|�}tjd|�d|�d��y)z2 create btrfs snapshot (if btrfs layout is there) Nrzrelease-upgrade-%s-zcreating snapshot 'z' (success=r
)r.r~r�r��create_btrfs_root_snapshotr�r)r�r~r��prefixr�s     r/� _maybe_create_apt_btrfs_snapshotz6DistUpgradeController._maybe_create_apt_btrfs_snapshotsQ���4�4�6��!�&�7�7�9�	�&����4���2�2�6�:�����f�c�J�KrRc	��i}tjdg|d<dtjd<tjdg|d<tjd��5}|jtjd<dD]F}tjj|�||dz<tjj
|��H	|j�|D],}||D]"}tjj||��$�.cddd�S#|D],}||D]"}tjj||��$�.wxYw#1swYyxYw)Nzdir::bin::dpkgz	/bin/truezDir::State::extended_states�apt_extended_states_)r�)zdpkg::pre-invokezdpkg::pre-install-pkgszdpkg::post-invokezdpkg::post-install-pkgsz::)	r�r��tempfile�NamedTemporaryFiler��
value_list�clear�
doDistUpgrader�)r��backupsrH�lst�items     r/�doDistUpgradeSimulationz-DistUpgradeController.doDistUpgradeSimulation
sE����%,�^�^�4D�%E�$F�� �!�+6����'�(�
3:�.�.�A^�2_�1`��-�.�
�
(�
(�0F�
G�	6�1�<=�F�F�G�N�N�8�9�s�
*��&-�n�n�&?�&?��&D���d�
�#����$�$�S�)�
*�
6��)�)�+�"�6�C� '���6�����*�*�3��5�6�6�	6�	6��#�6�C� '���6�����*�*�3��5�6�6��	6�	6�s%�A)E�D�1E�3E�E�E
c�D�d}|jj�}|jj|j�}|jjdd�}|js+|jjd�|j�d}d}||krF	|jj||�}tjd|z�|j-�ytjd�|jjt/d�t/d �d!|z�|j1�y#t$�r�}tjd|z�|}tj j#d�r�t%d�5}|j'�}ddd�n#1swYnxYwtjd	|z�d
dg}	|	D]�}
t)|�j+|
�s�tjd�|j-�t/d
�}|dt)|�zz
}|t/d�z
}|jjt/d�|�|j1���t/d�}|jst3�s|t/d|z�z
}|jjt/d�|�gd�}tj4j7d�dk(r|j9d�|jj;�j=|�|j-�Yd}~yd}~wt>$r.}tjd|�d|�d��|dz
}|}Yd}~���d}~wt@$r�}tjBd�|}|jDdk(ro|j-�t/d
�}|dt)|�zz
}|t/d�z
}|jjt/d�|�|j1�Yd}~��Gd}~wwxYw)"Nrrprq�StartUpgradeFzcache.commit() returned %sz#SystemError from cache.commit(): %sz./var/run/ubuntu-release-upgrader-apt-exceptionzfound exception: '%s'z;E:Internal Error, Could not perform immediate configurationz E:Couldn't configure pre-depend z-detected preconfigure error, restorting state�Error during commitz
'%s'
�Restoring original system statezCould not install the upgradeszrThe upgrade has aborted. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a).z�

Please report this bug in a browser at http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug and attach the files in /var/log/dist-upgrade/ to the bug report.
%sr�r�r�r�rkrlr
rzcache.commit()�TrmrnzdThe upgrade has aborted. Please check your Internet connection or installation media and try again. rJ)#r�r��getInstallProgressr�r�r�r�r�r�r��commitr�r�rr�ryr{r�r@rCr�r\rfr�r�r#r�rr?r�r�rr�rW�errno)
r�rrw�	iprogressr�r�rWr�rH�pre_configure_errors�
preconf_error�msgr�s
             r/r�z#DistUpgradeController.doDistUpgrade"s������J�J�1�1�3�	��J�J�1�1�$�*�*�=�	��[�[�'�'�	�,�?�
��#�#��K�K�O�O�N�+��1�1�3����	��Z�'�D
!��j�j�'�'�	�)�<���
�
�:�S�@�A�H
�"�"�$��	�
�
�C�D��
�
����<�=��@�A� �)�+�		-�	
�
�
���]�.
��
�
�C�a�G�H��	��7�7�>�>�"R�S��N�O�%�ST��F�F�H��%�%�%���M�M�"9�A�"=�>�V�:�,<�(�*>�)�
��q�6�,�,�]�;�#�M�M�*Y�Z� �2�2�4�#$�$9�":�C��:��A��#6�6�C��1�%F�#G�G�C� �J�J�,�,�Q�/O�-P�RU�V� �J�J�L�)��>�?���+�+�%�<��q�"&�)*�	"*� +�+��
�
�
� � ��#C�!D�c�J�:���:�:�>�>�"3�4�8H�H��J�J�0�1��
�
�&�&�(�-�-�c�2��&�&�(����
��
�
�^_�`l�m�n���!���	����
!��!�!�"2�3��	��7�7�b�=��*�*�,��1�2�C��:��A��.�.�C��1�>�?�?�C��J�J�$�$�Q�'G�%H�#�N��J�J�L���
!�sR�4D<�<
P�AL>�
F$�	L>�$F-	�)AL>�,E
L>�>P�
#M3�3P�?BP�Pc	��t�jd�tjj	t
jjd��}|jjD]l}tjj	tjj|j��|k(s�M	tj|j��n|j�|jj!d�|j"j%t&j(�|j"j+t-d��|j.j1�}|j.j3|j4|j6|j8�}t;j<ddj?tA|��z�t;j<ddj?tA|��z�|jjCdd	�D]*}||vs�t;jDd
|z�tG�}n|jjIddd�st;j<d
�y|jjCdd�D]`}||j.vs�|j.|jJs�,|jLjO|jjC|d���bt;j<d|jLz�|jPr||jRz
}n-tG|jTD�cgc]}|jV��c}�}|tG|jL�z}|j.jY�}t;j<ddj?|�z�|tG|�z}|jjIddd�st;j<d�tG�}t;j<d|z�t;j<d�|j"j[�}	t]|�D]�\}
}|	j_|
tatc|��zdz�||jdvs�>|j"jg�|j.ji|||jL|jd�r��t;j<d|���t;j<d�|	jk�|j.jm�}t;j<ddj?|D�cgc]}|jV��c}�z�t-d�}
t-d�t-d�g}tc|�dkDr||j"jo|
|gd|d�r\|j"jq�}|j"js|j.�}	|j.ju||�|jj!d"�|jzs|j}�|j�dkr|j��y#t$rY��*wxYwcc}wcc}w#tvtxf$rT}t;jDd|z�|j"jEt-d�t-d �d!|z�Yd}~��d}~wwxYw)#N�POSTUPGRADEr)�PostUpgradezSearching for obsolete softwarerrLrrur4zXthe BaseMetaPkg '%s' is in the obsolete list, something is wrong, ignoring the obsoletes�RemoveObsoletesTzSkipping obsolete Removalr�rvzforced_obsoletes: %szUnused dependencies: %sz0Skipping RemoveObsoletes as stated in the configzremove_candidates: '%s'z Start checking for obsolete pkgsgY@z:'%s' scheduled for remove but not safe to remove, skippingz!Finish checking for obsolete pkgsz1The following packages are marked for removal: %szRemove obsolete packages?�_Keep�_RemoverFz,cache.commit() in doPostUpgrade() failed: %sr�z[A problem occurred during the clean-up. Please see the below message for more information. rJ�PostCleanup)Ar��	add_stageryr{r�r�r�r�r�r��abspath�destfile�unlinkr�r�r�r�r��setStepr�CLEANUPr�r�r�rrr�r�r�r�r�r|rlr�r�r�rPr�r�rkr�rrHr��_getUnusedDependenciesr��	enumerater�floatr,rr��tryMarkObsoleteForRemoval�donerFrLr�r�r�rrr��runPostInstallScriptsr�r�)r�r<r��now_obsolete�now_foreignr��remove_candidates�p�unused_dependenciesr�rJrprIr��actionsrwr�r�s                  r/�
doPostUpgradez#DistUpgradeController.doPostUpgrade�s}����!�!�-�0��W�W�_�_��N�N�#�#�$:�;�=�
��L�L�&�&�	�D��w�w���r�w�w���t�}�}�=�>�*�L���I�I�d�m�m�,�	�	
����	
�����
�&�	
�
�
���4�<�<�(��
�
����"C� D�E��z�z�3�3�5���j�j�0�0����d�m�m�T�[�[�Y���
�
�n�s�x�x��|�0D�'E�E�F��
�
�m�c�h�h�v�k�/B�&C�C�D�
�;�;�&�&�x��?�	�C��l�"��
�
�x�{~�~��"�u���		��{�{�)�)�(�3D�d�K��M�M�5�6���;�;�&�&�x�
�;�	Y�C��d�j�j� �T�Z�Z��_�%A�%A��%�%�,�,�T�[�[�-@�-@��EV�-W�X�	Y�	�
�
�,�t�/D�/D�D�E�
�?�?�!-�t�/A�/A� A��
!$�T�5M�5M�$N��Q�V�V�$N� O���S��!6�!6�7�7��#�j�j�?�?�A���
�
�/����:M�1N�N�O��S�!4�5�5���{�{�)�)�(�3D�d�K��M�M�L�M� #����
�
�/�2C�C�D��
�
�8�9��:�:�0�0�2��%�&7�8�	i�L�Q���O�O�Q�u�S�):�%;�<�<�e�C�D��d�/�/�/��
�
�(�(�*��z�z�;�;�G�EV�X\�Xm�Xm�os�pA�pA�B��M�M�"^�`g�h�	i�	�
�
�9�:��
�
���*�*�(�(�*���
�
�I�C�H�H�jq�Ur�cf�VY�V^�V^�Ur�Ls�s�t��/�0���W�:�q��|�,��
��L�1���J�J�%�%�g�w��A�w��N��
�
�5�5�7�I��
�
�5�5�d�j�j�A�I�
-��
�
�!�!�)�I�6�	
�����
�&��#�#��&�&�(�� � �"�a�'��'�'�)���O�����b%O��4Vs�� ��)�
-��
�
�L�q�P�Q��
�
� � ��#8�!9�!"�$3�"4�$(�!�8�	-�-��
-�s7�:Z
�Z�$Z�Z$�
	Z�Z�$\�3A
\�\c	��|jr4|jj�|jj�|jj	dd�D]�}t
jj|�stjd|z��;tjd|z�	t|�|jj�j|gd����|jr|jj#�y
y
#t$r&}tj d|�d|�d	��Yd
}~��d
}~wwxYw)z�
        scripts that are run in any case after the distupgrade finished
        whether or not it was successful

        Cache lock is released during script runs in the event that the
        PostInstallScripts require apt or dpkg changes.
        ru�PostInstallScriptsz!PostInstallScript: '%s' not foundzRunning PostInstallScript: '%s'T)�hiddenz!got error from PostInstallScript z (r
N)r�r�r�r�r�ryr{r�r�r�r�r	r�r�r��	Exceptionr��get_lock)r��scriptr�s   r/r�z+DistUpgradeController.runPostInstallScripts�s����:�:��J�J�#�#�%��J�J�'�'�)��k�k�)�)�(�3G�H�
	X�F��7�7�>�>�&�)���� C�f� L�M���M�M�;�f�D�E�
X�"�6�*��
�
�&�&�(�-�-�v�h�t�-�D�
	X��:�:��J�J���!����
X��
�
�F�TU�V�W�W��
X�s�17D�	E�D<�<Ec�V�tjd�t|d�r%|jj	|j
�|jjtd��|jj�|j�tjd�y)z2 abort the upgrade, cleanup (as much as possible) zabort calledrUr�rN)
r�r��hasattrrU�restore_backupr�r�r�r�r�r�r�r�r�s r/r�zDistUpgradeController.abortsm���
�
�n�%��4��#��L�L�'�'��(?�(?�@��
�
����"C� D�E��
�
������������rRc��tj|�D]�}tjd|z�|D]�}|d}|d}|d}||jvrtj
d|z�y|j|}t
|jdd�}|dk7s�gtj|||�d	k(s��y	��tj
d
|z�y)z+ check if a given depends can be satisfied zchecking: '%s' rrr8z_checkDep: '%s' not in cacheFrYNTzdepends '%s' is not satisfied)	r��
parse_dependsr�r�r�r��getattr�	installed�	check_dep)	r��depstr�or_group�dep�depname�ver�operr��instvers	         r/�	_checkDepzDistUpgradeController._checkDeps����-�-�f�5�
	 �H��M�M�+�h�6�7��
 ���a�&���!�f���1�v���$�*�*�,��M�M�"@�7�"J�K� ��z�z�'�*��!�$�.�.�)�T�B���t�O��%�%�g�d�3�7�4�?��
 �
	 �	�
�
�5��>�?�rRc���tjd�d}|jjdd�}|j	|jj|j
jjd��|D]u}tjd|�||j|�z}|r�0|j
jtd�td|z��tjd��w|S)	z  check if depends are satisfied zcheckViewDepends()Tr��Dependsz
depends: '%s'z!Required depends is not installedz/The required dependency '%s' is not installed. r)
r�r�r�r�rkr�r�rNr�r�r�r�r�)r�r��dependsr�s    r/rz&DistUpgradeController.checkViewDepends2s����
�
�*�+����+�+�%�%�f�Y�7�����t�{�{�*�*�4�:�:�+?�+?�+H�+H�+4�6�	7��		�C��M�M�/�3�/��4�>�>�#�&�&�C���
�
� � ��#F�!G�!"�$1�36�$7�"8�9������		��
rRc��|jjdd�}d}tjjdd�}|jj	dd�}||kr�|jd�	�|j
�|D]3}||jvs�tjd
|z�t|��|j|�rn@tjd�tjjdd�|d
z
}||kr��||k(rtjd�ytjjd|�y)N�PreRequists�PackagesrzAcquire::http::No-CachersrprqF)rzCan not find backport '%s'z>setting a cache control header to turn off caching temporarily�truerz+pre-requists item is NOT trusted, giving upT)r�r�r�r�r�rr�r�r�r�rM�_allBackportsAuthenticatedr�r�)r��
backportslistrJ�noCacher�rps      r/�_verifyBackportsz&DistUpgradeController._verifyBackportsFs�����+�+�M�*�E�
�
���.�.�%�%�&?��H���[�[�'�'�	�,�?�
��*�n��M�M�U�M�+��N�N��(�
=���$�*�*�,��M�M�">��"H�I�3�G�<�<�
=��.�.�}�=���M�M�Z�[��N�N���8��@�
��F�A��*�n�
�
�?��M�M�G�H�������4�W�=�rRc�r�tjjdd�dk(rtjd�y	|jjdd�}|ry	|D]I}|j|}|jsy|jjD]}|js��Hyy#t$rY�ZwxYw)NzAPT::Get::AllowUnauthenticatedFTzIskip authentication check because of APT::Get::AllowUnauthenticated==trueru�AllowUnauthenticated)r�r��find_br�r��
getbooleanrr�rQrR�trusted)r�r�r$rpr��cands      r/r�z0DistUpgradeController._allBackportsAuthenticatedas����>�>� � �!A�%�H�D�P��O�O�g�h��	����&�&�x�0F�G�A����%�	�G��*�*�W�%�C��=�=���
�
�-�-�
���<�<��
��	����	��	�s�B*�*	B6�5B6c�h�|jd�}t|�\}}}}}d|vr|jd�d}|�d|�|��}|jD]`}|jd�}t	||�ry|jd�d}	|j|	�s�Ht
jd|z�yy)	z  check if uri is a known mirror r>�@rz://Tz//z)found apt-cacher/apt-torrent style uri %sF)�rstriprrr�rr�r�r�)
r�r(�raw_uri�scheme�netlocr{�query�fragment�mirror�mirror_host_parts
          r/rdzDistUpgradeController.isMirrorws����*�*�S�/��08��0A�-����e�X��&�=��\�\�#�&�q�)�F�#�V�T�2���(�(�
	�F��]�]�3�'�F����%�� &�|�|�D�1�!�4���|�|�,�-��
�
�I�C�O�P��
	�rRc��|jd�}|jD]!}|jd�}t||�s�!yy)z/ check if uri is an allowed third-party mirror r>TF)r�r�r)r�r(r�s   r/rez(DistUpgradeController.isThirdPartyMirror�sD���j�j��o���+�+�	�F��]�]�3�'�F����%��	�rRc��d}td��}|jD]�}|js|jr�|jdk(s�,|jdk(s�<|j|j�s�Xd|jvs�gd|jz|jvs��|jjd�r��|jjd	�r��d
|j�d|j�d�}||vs��||z
}��|S)
z7 get sources.list snippet lines for the current mirror r2rVr�r9Fr&rKzhttp://security.ubuntu.comzhttp://archive.ubuntu.comzdeb rLz-updates main
)rrZr^r_rfrdr(rar�r-r\)r��dumbr�rUr%�new_lines      r/�_getPreReqMirrorLinesz+DistUpgradeController._getPreReqMirrorLines�s������#�.���\�\�	&�E��}�}������
�
�e�#����%�'��
�
�e�i�i�(��%�+�+�%��t�}�}�,��
�
�:��I�I�(�(�)E�F��I�I�(�(�)D�E�9>���D�M�M�R���5�(��X�%�E�	&�"�rRc�t�tjd|z�|j|�}t|d�5}t|�5}|D]H}t	|�}|j|��}|j
|�tjd|z��J	ddd�ddd�y#1swY�xYw#1swYyxYw)z9 add prerequists based on template into the path outfile z*writing prerequists sources.list at: '%s' r�)r�zadding '%s' prerequistsNT)r�r�r�r@r�safe_substituter�)	r��templaterGr��mirrorlines�outfile�infiler[�outlines	         r/�_addPreRequistsSourcesListz0DistUpgradeController._addPreRequistsSourcesList�s���	�
�
�B�S�H�I��0�0��6��
�#�s�^�	C�w��X��	C�&��
C��#�D�>��"�2�2�+�2�F���
�
�g�&��
�
�7�'�A�B�	
C�	C�	C��
	C�	C��	C��s$�B.�AB"�B.�"B+	�'B.�.B7c�~�tjd�d}tjj	tj
�d�}tjj
|�stj|�|jjdd�}d}|jjd|d|jzz�r|d|jzz}|jjd|�}tjj
|�stjd|z�y	tjj	tjjd
�|�}tjj	tjjd
�|�}|j!||�	|j#�|D]�}	|j(|	}
|j(j*j-|
j.�}|s/tjd|	z�tj0|�y	|j2d
k(r/tjd|	z�tj0|�y	tjd|	z�|
j5d	d	����d	}	|j(j7|j8j;�|j8j=|j(��}|d	k(rtj&d�	tj0|�|jE�S#t$$rW|j!||d��	|j#�Yy	#t$$r#}tj&d|z�Yd
}~Yy	d
}~wwxYwwxYw#t>$r$}tjd|z�d	}Yd
}~��d
}~wt@$r$}tjd|z�d	}Yd
}~��d
}~wwxYw#tB$r1}tjd|z�Yd
}~|jE�Sd
}~wwxYw)z5 download the backports specified in DistUpgrade.cfg zgetRequiredBackports()Tr5r�r�rz-%szsourceslist not found '%s'Frd)r�zno backport for '%s' foundNzNo candidate for '%s'zNo ver.file_list for '%s'zmarking '%s' for install)�	auto_inst�auto_fixzfetch_archives returned '%s'zinstall_archives returned '%s'z,_fetch_archives for backports returned Falsez(failed to unlink pre-requists file: '%s')#r�r�ryr{r|rzr��mkdirr�r��
has_optionr�rr�r�r�r�r�rMr�r�rr�get_candidate_ver�_pkgr��	file_list�mark_installr�r�r�r�rrr��setupRequiredBackports)r�r�rr��conf_option�prereq_template�outpathr�r�rpr�r�s            r/�getRequiredBackportsz*DistUpgradeController.getRequiredBackports�s[���
�
�.�/����w�w�|�|�B�I�I�K��<���w�w�~�~�l�+��H�H�\�"����+�+�M�*�E�
�*$���;�;�!�!�-��E�D�I�I�<M�0M�N�%���	�	�(9�9�K��+�+�/�/�-��D���w�w�~�~�o�.��M�M�6��H�I���'�'�,�,�w�~�~�6�6�7N�O�Q`�a���'�'�,�,�w�~�~�6�6�7N�O�Q`�a���'�'���A�	��!�!�#�%�	>�G��*�*�W�%�C��*�*�&�&�8�8����B�C���
�
�5��?�@��	�	�'�"���}�}��$��
�
�9�G�C�D��	�	�'�"���M�M�4�w�>�?����u�u��=�	>�"��	��*�*�#�#�D�J�J�$A�$A�$C�$(�J�J�$A�$A�$�*�*�$M�O�C��%�<��O�O�J�K�	J��I�I�g���*�*�,�,��[)�	��+�+�O�W�4�+�P�
B��%�%�'���-�
B���� <�q� @�A�A���
B��		��<�	��M�M�8�1�<�=��C���	��M�M�:�Q�>�?��C��	���	J��M�M�D�q�H�I�I��*�*�,�,��	J�sm�;M�-AN'�P�N$�"M4�4	N �=N�N$�N � N$�'	O?�0O�O?�O:�:O?�	P<�P7�7P<c���dtjd<tj�t	j
dd�tjdgz}|jr|jd�n|jd�tjd�ttjd	�tjtjd	|tj�y)
Nz$/usr/lib/release-upgrader-python-apt�
PYTHONPATHz/var/log/dist-upgrade/main.logz&/var/log/dist-upgrade/main_pre_req.logz--have-prerequistsz--with-networkz--without-networkzrestarting upgraderr)
ryr�r��shutdown�shutilrcr��argvr�r?rr	�execve)r��argss  r/r�z,DistUpgradeController.setupRequiredBackports	s���$J��
�
�<� ��������4�<�	>��x�x�/�0�0���?�?��K�K�(�)��K�K�+�,����*�+�	�3�8�8�A�;�'�
�	�	�#�(�(�1�+�d�B�J�J�/rRc��|jjtd��|jjtj
�|j
�s�tjd�tjjd�rF|jjtd�td��tjddg�nC|jjtd�td��tjd	�|j�|jj!d
��r|j"r�|j"j$dk(r�tj&d�|j)�s�tjjd�rF|jjtd
�td��tjddg�nC|jjtd
�td��tjd	�|j�|j+�s|j�|j-dd��|j/�|j1�s|j�	|jjtj2�|jjtd��|j5�}|dkDr6tj&d�|j7�s�|j�n�|dk(r�tj&d�t9|j:d��|_|j<j?|j@�|jC�|j<jE�|jG�s|j�|j-�s|j�|jjtd��|j/d��|jHr|jJjM�|_$|jNjQ�|jjSdd�D�]E}||jJvs)|jJjU|jJ|�r�;tjd|z�||jJvrtjd|z�|jJjU|jJ|�stjd|z�|jjtd�td�|z�tjjd�rtjddg�ntjd	�|j���H|jjtd ��|jW�s|j�|jY�|jjtjZ�|jjtd!��|j]�s |j_�|j�|jjtj`�|jjtd"��|jc�s>|jjtd#�td$��|j�|jJje�d}	|jJd%jg�d}r�|jjtj`�|jjtd"��|jo�sC|jjqtd(�td)��tsjtd�|j/d��|jJjM�|_$|jNjQ�|jjtd ��|jw�sV|rD|jjqtd(�td)��tsjtd�n|j�|jjtj`�|jjtd"��|jo�sS|jy�|jjqtd*�td+��tsjtd�|j{�tjjd,�rtj|d,�|jjtj~�|jjtd-��t��j��t��s�|j��r]|jj��t�d.d/d0�1�5}|j�d2�ddd�|jj��n/|jj��rtjd3�tsjtd�y#th$r.}d&tk|�vrtj&d'�	Yd}~���d}~wwxYw#tl$r|j�Y���wxYw#1swY��xYw)4NzChecking package managerzself.prepare() failedr�zPreparing the upgrade failedzXPreparing the system for the upgrade failed so a bug reporting process is being started.r�r�z�Preparing the system for the upgrade failed. To report a bug install apport and then execute 'apport-bug ubuntu-release-upgrader'.r�r�Fzneed backportsz$Getting upgrade prerequisites failedz�The system was unable to get the prerequisites for the upgrade. The upgrade will abort now and restore the original system state.

Additionally, a bug reporting process is being started.z�The system was unable to get the prerequisites for the upgrade. The upgrade will abort now and restore the original system state.

To report a bug install apport and then execute 'apport-bug ubuntu-release-upgrader'.r)rrzUpdating repository informationrzAlready migrated to deb822z!Rewriting existing deb822 sourcesTr�)r�rur4z@No '%s' available/downloadable after sources.list rewrite+updatez'%s' was not in the cachez'%s' was not downloadablezInvalid package informationa�After updating your package information, the essential package '%s' could not be located. This may be because you have no official mirrors listed in your software sources, or because of excessive load on the mirror you are using. See /etc/apt/sources.list for the current list of configured software sources.
In the case of an overloaded mirror, you may want to try the upgrade again later.rB�Fetching�	UpgradingzUpgrade infeasiblezQThe upgrade could not be completed, there were errors during the upgrade process.�libc6�pkgProblemResolverz'Unable to mark libc6 alone for install.zUpgrade incompletezUThe upgrade has partially completed but there were errors during the upgrade process.�Upgrade complete�KThe upgrade has completed but there were errors during the upgrade process.z:/var/lib/ubuntu-release-upgrader/release-upgrade-availablezSystem upgrade is complete.z/run/launcher-commandzw+zutf-8)�encodingzaction: reboot
�/sbin/reboot)Ir�r�r�r�r�PREPARErr�r�ryr{r�r�rr�r�r�r~rr�rr_rr�r��MODIFY_SOURCESr�r�rr}rUr�r�r�r�r�rr�rr��+ensure_recommends_are_installed_on_desktopsr��anyVersionDownloadablerN�_inhibitIdle�FETCHr|rf�INSTALLr�r�r�rr��KeyboardInterruptr�r�r�r�rJr�r�r��REBOOTr�r�r�_inside_WSL�adviseExitOtherWSLr@r��adviseRestartWSL�confirmRestart)r��migratedr��libc6_possibler�rHs      r/�fullUpgradez!DistUpgradeController.fullUpgrade(	sV���
�
����"<� =�>��
�
���4�<�<�(��|�|�~��M�M�1�2��w�w�~�~�3�4��
�
� � ��#A�!B�!"�$4�"5�6�� � �,�0N�!O�P��
�
� � ��#A�!B�!"�$?�"@�A�
�
�
�,�-��J�J�L�
�K�K�#�#�M�2��L�L��L�L�(�(�E�1��M�M�*�+��,�,�.��7�7�>�>�"7�8��J�J�$�$�Q�'M�%N�%&�(8�&9�:��$�$�l�4R�%S�T��J�J�$�$�Q�'M�%N�%&�(C�&D�E��M�M�#0�1��
�
��� � �"��J�J�L�	
�
�
��Q�
�7������'�'�)��J�J�L�y	��J�J���t�2�2�3��J�J�#�#�A�&G�$H�I��,�,�.�H��!�|��
�
�:�;��/�/�1��J�J�L��q�=��M�M�"E�F�#.�4�<�<�PT�#U�D�L��L�L�'�'��(?�(?�@��-�-�/��L�L�%�%�'�
�-�-�/��J�J�L��=�=�?��
�
��
�J�J�#�#�A�&@�$A�B�
�N�N��N�=����"&�*�*�"=�"=�"?����K�K�C�C�E�
�{�{�*�*�8�N�C�
!���t�z�z�)��
�
�9�9�$�*�*�S�/�J�
�M�M�"d�gj�"j�k��$�*�*�,��
�
�&A�C�&G�H��:�:�<�<�T�Z�Z��_�M��
�
�&A�C�&G�H��J�J�$�$�Q�'D�%E�%&�(R�&S�*-�&-�
.��w�w�~�~�&;�<�"�(�(�,�8V�)W�X��
�
�'4�5��J�J�L�?
!�F
�J�J�#�#�A�&?�$@�A��&�&�(��
�
������
�J�J���t�z�z�*��J�J�#�#�A�j�M�2��-�-�/��&�&�(��
�
��
�J�J���t�|�|�,��J�J�#�#�A�k�N�3��/�/�1��
�
� � ��#7�!8�!"�$.�"/�0��
�
��
�J�J����"�N�
��
�
�7�#�0�0�2�!%����J�J���t�|�|�,��J�J�#�#�A�k�N�3��%�%�'��
�
�&�&�q�)=�'>�'(�*4�(5�6�
�����	
���D��9��*�*�5�5�7������?�?�A��
�
����";� <�=��#�#�%���
�
�&�&�q�)=�'>�'(�*4�(5�6�
������
�
��	
�
�
���4�<�<�(��
�
����+��/��!�!�#��&�&�(��J�J�"�"�1�%7�#8�#$�&0�$1�
2�

�H�H�Q�K�	
�����7�7�>�>�V�W��I�I�R�S�	
�
�
���4�;�;�'��
�
����"?� @�A�����������!��
�
�-�-�/��1�4�'�J�0�a��G�G�.�/�0��
�
�+�+�-����*�*�,�� � ��0��H�H�Q�K���Q�
�'�3�q�6�1��M�M�"K�L����
��!�	��J�J�L�	��|0�0�sJ�-H.m�Jm�3l�$m8�	m�'#m�
m�m�m�m5�4m5�8nc�V�|jj�|j�Sr)r�r�r#r�s r/r�zDistUpgradeController.run0
s!���
�
� � �"����!�!rRc��|jjtj�|jj	tj
�|jj	tj�d|_|j�|j�sy|j�sy|jjtj�|jjtd��|j�sy|jjtj�|jjtd��|j!�s/|jj#td�td��y|j%�s/|jj#td�td��yt&j(j+t,�r0|jj/�rt1j2d�y|jj#td�td��y)	z, partial upgrade mode, useful for repairing TFrr
rrrz"The partial upgrade was completed.)r�r�rr�hideSteprrr�rr�rNrr�r�r|rr�r�r�ryr{r��REBOOT_REQUIRED_FILEr r�rr�s r/�doPartialUpgradez&DistUpgradeController.doPartialUpgrade4
s����
�
���4�<�<�(��
�
���D�/�/�0��
�
���D�K�K�(�#��������'�'�)���"�"�$���
�
���4�:�:�&��
�
����*�
�.��)�)�+���
�
���4�<�<�(��
�
����+��/��!�!�#��J�J�"�"�1�%7�#8�#$�&0�$1�
2���!�!�#��J�J�"�"�1�%7�#8�#$�&0�$1�
2��
�7�7�>�>�.�/��z�z�(�(�*�� � ��0��
�J�J�"�"�1�%7�#8�#$�%I�#J�
L�rRc�0�tjd�	ddl}|j�|j	�|_|j
j
dd�}|j|d��}|jdd�td�}td	�}tjtj��|j j#||�y#t$r�}tjd
d�dvr,Yd}~tjtj��ytjd
t|�z�td�}td�}Yd}~��d}~wwxYw#tjtj��wxYw)Nzinhibit screensaverrzorg.freedesktop.ScreenSaverz/org/freedesktop/ScreenSaver)�dbus_interfacerXzUpgrading UbuntuzLock screen disabledzOYour lock screen has been disabled and will remain disabled during the upgrade.�XDG_SESSION_TYPEr2)r2�ttyzfailed to inhibit screensaver: zUnable to disable lock screenz�It is highly recommended that the lock screen be disabled during the upgrade to prevent later issues. Please ensure your screen lock is disabled before continuing.)r�r��dbus�_setNonRootEUID�
SessionBusr��
get_object�	Interface�Inhibitr�r�ry�getenv�seteuid�getuidr�r�r�)r�r-�proxy�screensaverr��messager�s       r/rz"DistUpgradeController._inhibitIdle[
s<���
�
�+�,�	$��� � �"�!%��� 1�D���%�%�0�0�1N�1O�Q�E��.�.��?\�.�]�K���� 9�;M�N��.�/�G��7�8�G�
�J�J�r�y�y�{�#��
�
���w��0���
	7��y�y�+�R�0�K�?��
�J�J�r�y�y�{�#�
�M�M�;�c�!�f�D�E��7�8�G��6�7�G��
	7��
�J�J�r�y�y�{�#�s6�BC�	E)�$E$�<E,�(7E$�E,�$E)�)E,�,)Fc��tj�dk7rytjd�}|stjd�}|stjd�ytj
t
|��y)Nr�SUDO_UID�
PKEXEC_UIDz"failed to determine user upgrading)ryr5r3r�r�r4�int)r��uids  r/r.z%DistUpgradeController._setNonRootEUID�
sU��
�9�9�;�!����i�i�
�#����)�)�L�)�C���M�M�>�?��
�
�
�3�s�8�rRc�@�tjjd�S)Nz#/proc/sys/fs/binfmt_misc/WSLInterop)ryr{r�r�s r/rz!DistUpgradeController._inside_WSL�
s���w�w�~�~�C�D�DrR)NN)TF)T)TN)F);rNrOrP�__doc__r�r�r�r�r�r�rrr+r.r�r�r�r�r�r�r�r�r�r�r�r�rr%r@rJrNrUr_rdrfr|r.r�r�r�r�r�r�r�rr�r�rdrer�r�rr�r#r�r(rr.rrQrRr/rTrTsB��=�p!�d!$�FK�0	�9�v�>�>G�R&�<
4�|�|	!�FPN�d
R�R���:B�HF�Pc�J4�(/�b!�H-�^7�t$�L�q��2�
C�
H�T
�L�6�0d�Lp�d"�4	��&�(�6�,�,��.�U-�p0�*F�P"�%�N$1�L�ErRrT�__main__)�DistUpgradeViewText)�level)Qrur�rArPr�ryr�ror�rrr�r�rc�configparserrrr��	telemetryrr��utilsrrr	r
rrr
rr�stringr�urllib.parser�DistUpgradeViewr�DistUpgradeCacher�DistUpgradeConfigParserrr�
aptsourcesrr�DistInfo�aptsources.sourceslistrrrrr�rrqrr�DistUpgradeGettextrr�rr r!r"�DistUpgradeApportr#r'r0r;rKr�rMr[rTrNrA�basicConfig�DEBUG�v�dcrdrfrQrRr/�<module>rTsD��.��
��
�	��
��
�����&�9�+�#�#�#��!�!�%�6�0� �"��(�(���/�/�%�8�#��:�,�(��8�8�*�1�����	�	�	�P(E�F�P(E�fP�z��8��G���g�m�m�,���A�	�q�	!�B�����������WR�%�$��%�s�-E�E!� E!

Zerion Mini Shell 1.0