Init a functional script

This commit is contained in:
Heuze Florent 2020-12-31 16:28:47 +01:00
parent 2b86e88873
commit 3cd8b78aba
2 changed files with 71 additions and 68 deletions

View File

@ -3,41 +3,41 @@ version : 1
architecture : all architecture : all
section : base section : base
priority : optional priority : optional
name : name :
categories : categories :
maintainer : Heuzef <heuzef@firewall-services.com> maintainer : Heuzef <heuzef@firewall-services.com>
description : Ghostscript for Windows description : Ghostscript for Windows
depends : depends :
conflicts : conflicts :
maturity : PROD maturity : PROD
locale : locale :
target_os : target_os :
min_os_version : min_os_version :
max_os_version : max_os_version :
min_wapt_version : min_wapt_version :
sources : sources :
installed_size : installed_size :
impacted_process : impacted_process :
description_fr : SMB1 Client on Windows description_fr : SMBv1 Client on Windows
description_pl : description_pl :
description_de : description_de :
description_es : description_es :
description_pt : description_pt :
description_it : description_it :
description_nl : description_nl :
description_ru : description_ru :
audit_schedule : audit_schedule :
editor : editor :
keywords : keywords :
licence : licence :
homepage : https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3 homepage : https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3
package_uuid : package_uuid :
valid_from : valid_from :
valid_until : valid_until :
forced_install_on : forced_install_on :
changelog : changelog :
signer : signer :
signer_fingerprint: signer_fingerprint:
signature : signature :
signature_date : signature_date :
signed_attributes : signed_attributes :

View File

@ -1,37 +1,40 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuphelpers import * from setuphelpers import *
import re
uninstallkey = []
uninstallkey = []
def install():
print("Enable SMB v1") def install():
print('Checking status') print("Enable SMBv1 ...")
if: # print('Checking status of SMBv1 ...')
# smbv1_status = run_powershell('Get-WindowsOptionalFeature -Online -FeatureName smb1protocol | out-string -stream | select-string State')
else: # print('Current status : %s' % (smbv1_status,))
# patterns = ["Enabled"]
def uninstall(): # text = smbv1_status
print('Disable SMB v1') # for pattern in patterns:
print('Checking status') # print('Looking for "%s" in "%s" ->' % (pattern, text),)
# if re.search(pattern, text):
if: # print('FOUND A MATCH!')
# else:
else: # print('NO MATCH')
smbv1_enable = run_powershell('Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
print('Turn ON SMBv1 : %s' % (smbv1_enable,))
print('Done, SMBv1 is now enabled. Reboot is required.')
# SMBv1 already enable
# else:
# print('SMBv1 is already enabled. No reboot required.')
def uninstall():
# Disable : print("Disable SMBv1 ...")
#
# Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart smbv1_disable = run_powershell('Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
#
# Enable : print('Turn OFF SMBv1 : %s' % (smbv1_disable,))
# print('Done, SMBv1 is now disabled. Reboot is required.')
# Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
#
# Status :
#
# Get-WindowsOptionalFeature -Online -FeatureName smb1protocol
#
# https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3