Edit File: cagefs.cpython-311.opt-1.pyc
� 5/9e � � � d dl mZ d dlZd dlmZmZ d dlmZ d dlm Z d dl mZ ddlm Z d d lmZ d d lmZ G d� de � � ZdS ) � )�absolute_importN)�CageFs�CageFsException)�check_cagefs_initialized)�MODULES_LOGS_DIR)�InstallationFailedException� )�WizardInstaller)�ExternalProgramFailed)�Featurec � � � e Zd Zej � ed� � Zej Z � fd�Zd� Zd� Z d� Zd� Zd� Zd� Zed � � � Zd � Z� xZS )�CagefsInstallerz cagefs.logc � �� t t | � � � � � t | j �� � | _ d S )N)�logger)�superr �__init__r � app_logger�cgfs)�self� __class__s ��py/clwizard/modules/cagefs.pyr zCagefsInstaller.__init__ s7 �� � �o�t�$�$�-�-�/�/�/��$�/�2�2�2�� � � � c �� � | j � � � }| j � � � }| j � d|� � |dk r| j � � � dS dS )z` Enable all users statuses and after it toggle to initial mode :return: z.Cagefs users status was updated to enabled: %s�Disable AllN)r � get_user_mode�set_enabled_moder �info�toggle_user_mode)r �initial_mode�outs r �_enable_existing_usersz&CagefsInstaller._enable_existing_users sp � � �y�.�.�0�0���i�(�(�*�*������M�s�S�S�S��=�(�(��I�&�&�(�(�(�(�(� )�(r c � � | j � � � }| j � d|� � |dk rO| j � d� � | j � � � | j � d� � d S d S )NzCurrent mode is: %sr zTry to set mode to Enable allzMode was toggled to Enable all)r r r r r )r �modes r �_set_enabled_modez!CagefsInstaller._set_enabled_mode) s� � ��y�&�&�(�(������2�D�9�9�9��=� � ��O� � �!@�A�A�A��I�&�&�(�(�(��O� � �!A�B�B�B�B�B� !� r c �� � | � d� � s9 | � d� � d S # t $ r}t � � |�d }~ww xY w| j � d� � d S )N�cagefsz2Skip package installation, it is already installed)�_is_package_installed�_install_packager r r r )r �errs r �_install_cagefs_packagez'CagefsInstaller._install_cagefs_package1 s� � ��)�)�(�3�3� W� =��%�%�h�/�/�/�/�/��(� =� =� =�1�3�3��<����� =���� �O� � �!U�V�V�V�V�Vs �. � A�A�Ac �V � t � � s� | j � � � }| j � d|� � d S # t $ r<}| j � dt |� � � � t � � |�d }~ww xY w| j � d� � d S )NzCagefs was initialized: %sz+Cagefs initialization failed with error: %sz8Initializing was skipped, cagefs was already initialized) r r �initialize_cagefsr r r �error�strr �r r r) s r �_initialize_cagefsz"CagefsInstaller._initialize_cagefs: s� � �'�)�)� ]� =��i�1�1�3�3����$�$�%A�3�G�G�G�G�G��"� =� =� =���%�%�&S�UX�Y\�U]�U]�^�^�^�1�3�3��<����� =���� �O� � �![�\�\�\�\�\s �4A � B�7B�Bc � � | j � � � }| j � d|� � d S # t $ r}t � � |�d }~ww xY w)Nz/Cagefs was enabled, ready for configuration %s)r � enable_cagefsr r r r r/ s r �_enable_cagefszCagefsInstaller._enable_cagefsE sg � � 9��)�)�)�+�+�C��O� � �!S�UX�Y�Y�Y�Y�Y��� 9� 9� 9�-�/�/�S�8����� 9���s �48 � A�A�Ac � � | � � � | � � � | � � � |d r| � � � |d r| � � � d S d S # t $ r<}| j � dt |� � � � t � � |�d }~ww xY w)N�enable_for_existing_users�enable_for_new_userszCan`t configure options: %s) r* r0 r3 r! r$ r r r- r. r )r �optionsr) s r �run_installationz CagefsInstaller.run_installationL s� � ��$�$�&�&�&����!�!�!������� 9��2�3� .��+�+�-�-�-��-�.� )��&�&�(�(�(�(�(� )� )��� 9� 9� 9��O�!�!�"?��S���J�J�J�-�/�/�S�8����� 9���s �8A: �: C �7B;�;C c � � ddhS )Nr5 r6 � )�clss r �supported_optionsz!CagefsInstaller.supported_optionsY s � �+�-C�D�Dr c �� � | j � � � dk }n,# t $ r | j � d� � d}Y nw xY wt t � � � � d|id�S )Nz Enable Allz?Unable to detect cagefs mode, assuming that it is "Disable All"Fr6 )�already_configuredr7 )r r r r �warning�boolr )r �enabled_for_news r �initial_statuszCagefsInstaller.initial_status] s� � � $�"�i�5�5�7�7�<�G�O�O��� $� $� $��O�#�#�4� 5� 5� 5� $�O�O�O� $���� #'�'?�'A�'A�"B�"B�'��9� � � s � �&A �A )�__name__� __module__�__qualname__�os�path�joinr �LOG_FILEr �CAGEFS�_REQUIRED_CL_COMPONENT_SUPPORTr r! r$ r* r0 r3 r8 �classmethodr<