403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_grub_dpkg.cpython-36.pyc
3

��b��@sDdZddlZddlmZmZddlmZddgZdd�Zd	d
�Z	dS)a�
Grub Dpkg
---------
**Summary:** configure grub debconf installation device

Configure which device is used as the target for grub installation. This module
should work correctly by default without any user configuration. It can be
enabled/disabled using the ``enabled`` config key in the ``grub_dpkg`` config
dict. The global config key ``grub-dpkg`` is an alias for ``grub_dpkg``. If no
installation device is specified this module will execute grub-probe to
determine which disk the /boot directory is associated with.

The value which is placed into the debconf database is in the format which the
grub postinstall script expects. Normally, this is a /dev/disk/by-id/ value,
but we do fallback to the plain disk name if a by-id name is not present.

If this module is executed inside a container, then the debconf database is
seeded with empty values, and install_devices_empty is set to true.

**Internal name:** ``cc_grub_dpkg``

**Module frequency:** per instance

**Supported distros:** ubuntu, debian

**Config keys**::

    grub_dpkg:
        enabled: <true/false>
        grub-pc/install_devices: <devices>
        grub-pc/install_devices_empty: <devices>
    grub-dpkg: (alias for grub_dpkg)
�N)�subp�util)�ProcessExecutionErrorZubuntuZdebiancCsXd}g}y"tjddddgdd�dj�}Wnptk
r|}z6t|jt�rT|jd	�nd
|jkrj|jd�n�WYdd}~Xn tk
r�t	j
|d
�YnX|s�tjj
|�r�dSy(tjdddd|gdd�dj�j�}Wn"tk
r�t	j
|d|�YnX|jddj|��dd�|D�}|jddj|��|�rDt|�dn|}|jd|�|S)z�
    Fetches the /dev/disk/by-id device grub is installed to.
    Falls back to plain disk name if no by-id entry is present.
    �z
grub-probez-t�diskz/bootT)Zcapturerz'grub-probe' not found in $PATHzfailed to get canonical pathz)grub-probe 'failed to get canonical path'Nz*grub-probe failed to execute for grub-dpkgZudevadm�infoz--rootz--query=symlinkz3udevadm DEVLINKS symlink query failed for disk='%s'z%considering these device symlinks: %s�,cSsg|]}d|kr|�qS)z
disk/by-id�)�.0Zdevr	r	�"/usr/lib/python3.6/cc_grub_dpkg.py�
<listcomp>gszfetch_idevs.<locals>.<listcomp>z)filtered to these disk/by-id symlinks: %szselected %s)r�stripr�
isinstance�reason�FileNotFoundError�debug�stderr�	Exceptionr�logexc�os�path�exists�split�join�sorted)�logrZdevices�e�idevsr	r	r�fetch_idevs4s:
rc
Cs�|jd|jdi��}|si}|jdd�}tj|�rD|jd||�dStj|dd�}tj|dd�}|dkrpt|�}|dkr�|r�dnd	}d
||f}	|jd||f�ytjdg|	�Wn tk
r�tj|d
�YnXdS)NZ	grub_dpkgz	grub-dpkg�enabledTz*%s disabled by config grub_dpkg/enabled=%szgrub-pc/install_deviceszgrub-pc/install_devices_emptyZfalse�truez[grub-pc grub-pc/install_devices string %s
grub-pc grub-pc/install_devices_empty boolean %s
z2Setting grub debconf-set-selections with '%s','%s'zdebconf-set-selectionsz2Failed to run debconf-set-selections for grub-dpkg)	�getrZis_falserZget_cfg_option_strrrrr)
�nameZcfgZ_cloudrZ_argsZmycfgrrZidevs_emptyZ	dconf_selr	r	r�handleps.


r#)
�__doc__rZ	cloudinitrrZcloudinit.subprZdistrosrr#r	r	r	r�<module>*s<

Youez - 2016 - github.com/yon3zu
LinuXploit