0x1949 Team - FAZEMRX - MANAGER
Edit File: DistUpgradeFetcherCore.cpython-310.pyc
o t�d�1 � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlmZ d dl mZ d dlmZ d dlmZ ddlmZmZmZ dd lmZ G d d� de�Zedkroedd�Zed e�dd� � dS dS )� )�TemplateN)�gettext)�SourcesList)�urlopen)� HTTPError� )�get_dist�url_downloadable�country_mirror)�readlinec @ s� e Zd ZdZdZdZdejv Zdd� Z dd� Z d d � Zdd� Zd d� Z d"dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� ZdS )#�DistUpgradeFetcherCorez2 base class (without GUI) for the upgrade fetcher � http://archive.ubuntu.com/ubuntu�main�DEBUG_UPDATE_MANAGERc C s || _ t� | _|| _g | _d S �N)�new_distr �current_dist_name� _progress�run_options)�selfr �progress� r �D/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherCore.py�__init__1 s zDistUpgradeFetcherCore.__init__c C s | j r tj�|d � dS dS )z" helper to show debug information � N)�DEBUG�sys�stderr�write)r �msgr r r �_debug8 s �zDistUpgradeFetcherCore._debugc C s� d| j v rdS | jjd urX| �| jj�}t�� }zt�d� t|�}|�� � dd�}W n' t y? | �td�td�� Y dS t yR | �td �td �� Y dS w t�|� t� t|� ttd�dd � t� }|�� �� �td��rwdS dS )Nz(--frontend=DistUpgradeViewNonInteractiveT� zUTF-8�replacez'Could not find the release announcementzThe server may be overloaded.Fz+Could not download the release announcementz&Please check your internet connection.zContinue [yN] � )�end�y)r r �releaseNotesURI� _expandUri�socket�getdefaulttimeout�setdefaulttimeoutr �read�decoder �error�_�IOError�printr �strip�lower� startswith)r �uri�timeout� release_notes�notes�resr r r �showReleaseNotes= s8 � �� z'DistUpgradeFetcherCore.showReleaseNotesc C s t |� t |� dS )z� minimal implementation for error display, should be overwriten by subclasses that want to more fancy method F)r0 )r �summary�messager r r r- X s zDistUpgradeFetcherCore.errorc C sv | j jr9| jd tj�| j j� }| jd tj�| j j� }ttd�tj�|�tj�|�d� � | � ||�r9dS dS )N�/z0authenticate '%(file)s' against '%(signature)s' )�file� signatureTF) r �upgradeToolSig�tmpdir�os�path�basename�upgradeToolr0 r. �gpgauthenticate)r �f�sigr r r �authenticate` s � �z#DistUpgradeFetcherCore.authenticateNc C s@ dg}|sd}|d|g7 }|d||g7 }t j|t jd�}|dkS )zx authenticated a file against a given signature, if no keyring is given use the apt default keyring zapt-keyz./usr/share/keyrings/ubuntu-archive-keyring.gpgz --keyring�verify)r r )� subprocess�call�PIPE)r r= r>