K6h dZddlZddlmZmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZmZddlmZGd d e ZGd d eZGd deZdS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)CoreANTIVIRUS_MODE)run_cmd_and_log OsReleaseInfo)AbstractFeature FeatureError FeatureStatus)PATCHMAN_PACKAGE)REALTIME_PACKAGE is_installedr ceZdZUdZdZeed<dZeed<dZeed<dZ eed<e dZ de fd Z ejd Zejd Zd ede fd ZdS)_AbstractPackageFeaturezO Provides an interface for installing *PACKAGE_NAME* in the background NNAME PACKAGE_NAMEINSTALL_LOG_FILE_MASKREMOVE_LOG_FILE_MASKcJtjtjzrdndS)Nzapt-getyum)rid_likeDEBIANselfs J/opt/imunify360/venv/lib/python3.11/site-packages/imav/patchman/feature.pypackage_managerz'_AbstractPackageFeature.package_manager1s)$&&)== II returncK|jSNr rs r_check_installed_implz-_AbstractPackageFeature._check_installed_impl9s  rcKt|jd|j|jt t jdd{VS)Nz -y install noninteractive)DEBIAN_FRONTEND)env)rrrrdictosenvironrs rinstallz_AbstractPackageFeature.install<sk$# D D1B D D  &RZ1ABBB          rcZKt|jd|j|jd{VS)Nz -y remove )rrrrrs rremovez_AbstractPackageFeature.removeDsS$# C C0A C C  %         rstatusc^K|d{Vdd}||kS)Nitemsr+)r+)rr+current_statuss r has_statusz"_AbstractPackageFeature.has_statusKs: $ ------w7A''r)__name__ __module__ __qualname____doc__rstr__annotations__rrrpropertyrboolr rraise_if_shouldnt_install_nowr(raise_if_shouldnt_remove_nowr*r r/rrrr'sD#L#!%3%%% $#$$$   X !T!!!!2  32 1  21 (}(((((((rrcXeZdZdZeZdejdZdejdZ e dZ dS)PatchmanFeaturepatchman /var/log/z/install-patchman.log.*z/remove-patchman.log.*ctSr)is_patchman_installedrs rr zPatchmanFeature.is_installedVs$&&&rN) r0r1r2rr rrPRODUCTrrr6r r:rrr<r<Ps] D#LM MMMKt|KKK ''X'''rr<cneZdZdZeZdejdZdejdZ e de fdZ fdZ xZS)RealtimeFeaturez realtime-avr>z/install-realtime-av.log.*z/remove-realtime-av.log.*rctSr)is_realtime_av_installedrs rr zRealtimeFeature.is_installedcs')))rcKtstdtd{VdS)NzKCan't remove imunify-realtime-av, since it is a part of imunify360-firewall)rrsuperr*)r __class__s rr*zRealtimeFeature.removegsT < ggnnr)r0r1r2rr rrrArrr6r7r r* __classcell__)rHs@rrCrC[s D#LrPsX* AAAAAAAA@@@@@@@@ 544444FEEEEE&(&(&(&(&(o&(&(&(R'''''-'''-r