관리-도구
편집 파일: system_upgrade.cpython-36.pyc
3 �f�h � @ s� d Z ddlmZmZmZmZ ddlZddlZddlZddl Z ddl Z ddlZddlm Z ddlmZmZ ddlZddlZddlmZ ddlmZ ddlZddlmZmZ ddlZed � ejd �Zejd�Zejd�Zejd �Z eZ!dZ"ed�Z#ed�Z$ed�Z%dZ&dd� Z'dd� Z(g fdd�Z)d7dd�Z*dd� Z+G dd� de,�Z-G dd � d e,�Z.e.� Z/G d!d"� d"ej0j1�Z2d#d$� Z3d%d&� Z4d'd(� Z5d)d*� Z6d+d,dd-d.gZ7G d/d0� d0ej8�Z9G d1d2� d2ej:j;�Z<G d3d4� d4e<�Z=G d5d6� d6e<�Z>dS )8zGsystem_upgrade.py - DNF plugin to handle major-version system upgrades.� )�call�Popen�check_output�CalledProcessErrorN)�journal)�_�logger)�CliError)�ucd)�serialize_transaction�TransactionReplayzthe color of the skyZ 9348174c5cc74001a71ef26bd79d302eZ fef1cc509d5047268b83a3a553f54b43Z 3e0a5636d16b4ca4bbe5321d06c6aa62Z 8cec00a1566f4d3594f116450395f06cz/usr/bin/plymouthz<Need a --releasever greater than the current system version.z�Download complete! Use 'dnf {command} reboot' to start the upgrade. To remove cached metadata and transaction use 'dnf {command} clean'zESorry, you need to use 'download --releasever' instead of '--network'� c C s. t jddd�rtjtd�� ntddg� d S )NZDNF_SYSTEM_UPGRADE_NO_REBOOTF)�defaultz!Reboot turned off, not rebooting.Z systemctl�reboot)�os�getenvr �infor r � r r �$/usr/lib/python3.6/system_upgrade.pyr E s r c C s| d} xrdD ]j}yNt |��<}x4|D ],}|j� }|j| �r |t| �d � jd�S q W W d Q R X W q tk rr w Y q X q W d S )NzUPGRADE_GUIDE_URL=�/etc/os-release�/usr/lib/os-release�")r r )�open�strip� startswith�len�IOError)�key�pathZrelease_file�liner r r �get_url_from_os_releaseL s (r c C s~ t jj| �sd S xht j| �D ]Z}t jj| |�}||kr8qy(t jj|�rTtjj|� n t j|� W q t k rt Y qX qW d S )N) r r �isdir�listdir�join�dnf�utilZrm_rf�unlink�OSError)r �ignore�entryZfullpathr r r � clear_dir[ s r* c C s6 t jj| j�| jkrtt��|r2|| jkr2tt��d S )N)r$ �rpm�detect_releasever�installroot� releaseverr �RELEASEVER_MSG�CANT_RESET_RELEASEVER)�conf�targetr r r �check_release_verl s r3 c C sP yt dd�} | jd� W n2 tk rJ } zttd�| � W Y d d }~X nX d S )Nz /dev/tty0�wbs [9;0]z%Screen blanking can't be disabled: %s)r �write� Exception�printr )Ztty�er r r �disable_blankingu s r9 c @ s� e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z e d�Z e d�Ze d�Ze d�Z e d�Ze d�Ze d�Ze d�Ze d�Ze d�Ze d�Ze d�Ze d�ZdS )�Statec C s || _ i | _| j� d S )N)� statefile�_data�_read)�selfr; r r r �__init__� s zState.__init__c C sp y&t | j��}tj|�| _W d Q R X W nD tk r@ i | _Y n, tk rj i | _tjt d�| j� Y nX d S )Nz;Failed loading state file: %s, continuing with empty state.) r r; �json�loadr<