
    쑛h                     r    d dl Z d dlmZ d dlmZ  e j
                  e      Z G d dej                        Zy)    Nsubp)debianc                   D     e Zd ZdedededefdZd	dZdef fdZ xZS )
Distrolayoutmodelvariantoptionsc                 4    t        j                   dd|g       y)zKCurrently Raspberry Pi OS sys-mods only supports
        setting the layoutz+/usr/lib/raspberrypi-sys-mods/imager_custom
set_keymapNr   )selfr   r	   r
   r   s        C/usr/lib/python3/dist-packages/cloudinit/distros/raspberry_pi_os.pyr   zDistro.set_keymap   s     			=	
    c                     	 t        j                   ddd| g       y # t         j                  $ r] |j                  d      s4t        j	                  d|       t        j                   ddd| dg       Y y t        j                  d       Y y w xY w)Nz/usr/bin/raspi-confignonintdo_change_localez.UTF-8zTrying to set locale %s.UTF-8zFailed to set locale %s)r   ProcessExecutionErrorendswithLOGinfoerror)r   localeout_fnkeynames       r   apply_localezDistro.apply_locale   s    	5II+&h	 )) 	5??8,8&A		/ *!(&)	 		34	5s    AB5BBreturnc                     t        |   |fi |}|s|S 	 t        j                  g dd|i       y# t        j                  $ r }t        j                  d|       Y d}~yd}~ww xY w)z
        Add a user to the system using standard GNU tools

        This should be overridden on distros where useradd is not desirable or
        not available.

        Returns False if user already exists, otherwise True.
        )z/usr/bin/rename-userz-fz-s	SUDO_USER)
update_envzFailed to setup user: %sNFT)superadd_userr   r   r   r   )r   namekwargsresulte	__class__s        r   r"   zDistro.add_user4   sp     !$1&1M	II
 (. 	 )) 	II0!4	s   3 A&A!!A&)NLANG)	__name__
__module____qualname__strr   r   boolr"   __classcell__)r'   s   @r   r   r      s:    

 

S 

3 

 

50$  r   r   )	logging	cloudinitr   cloudinit.distrosr   	getLoggerr)   r   r    r   r   <module>r4      s4      $g!AV]] Ar   