Revert using 7z.exe for extraction, and replace sc with service_start and service_stop
This commit is contained in:
parent
5f69cad3e5
commit
bff7946758
|
@ -1,11 +1,11 @@
|
|||
package : fws-openssh
|
||||
version : 7.7.2.0-4
|
||||
version : 7.7.2.0-5
|
||||
architecture : all
|
||||
section : base
|
||||
priority : optional
|
||||
maintainer : Daniel Berteaud <daniel@firewall-services.com>
|
||||
description : OpenSSH for Windows
|
||||
depends :
|
||||
depends : fws-7zip
|
||||
conflicts :
|
||||
maturity : DEV
|
||||
locale :
|
||||
|
|
14
setup.py
14
setup.py
|
@ -8,25 +8,27 @@ def install():
|
|||
print('Installing OpenSSH')
|
||||
mkdirs(makepath(programfiles,'OpenSSH'))
|
||||
print(' Stoping the service')
|
||||
run_notfatal(r'sc stop sshd')
|
||||
killalltasks('sshd.exe')
|
||||
if service_installed('sshd') and service_is_running('sshd'):
|
||||
service_stop('sshd')
|
||||
killalltasks('sshd.exe')
|
||||
print(' Extract OpenSSH archive')
|
||||
unzip('OpenSSH-Win%s.zip' % '64' if iswin64() else '32',makepath(programfiles,'OpenSSH'))
|
||||
run('"%s" e -y -o"%s" OpenSSH-Win%s.zip' % (makepath(programfiles,'7-Zip','7z.exe'),makepath(programfiles,'OpenSSH'),'64' if iswin64() else '32'))
|
||||
print(' Installing the service')
|
||||
run(r'powershell.exe -ExecutionPolicy Bypass -File "%s\install-sshd.ps1"' % makepath(programfiles,'OpenSSH'))
|
||||
print(' Opening port 22 in the firewall')
|
||||
run_notfatal(r'netsh advfirewall firewall del rule name="OpenSSH Server"')
|
||||
run(r'netsh advfirewall firewall add rule name="OpenSSH Server" dir=in action=allow protocol=TCP localport=22 enable=yes')
|
||||
print(' Starting the service')
|
||||
run(r'sc start sshd', accept_returncodes=[0,1056])
|
||||
service_start('sshd')
|
||||
print(r' Enabling sshd service on boot')
|
||||
run('sc config sshd start= auto')
|
||||
|
||||
def uninstall():
|
||||
print('Removing OpenSSH')
|
||||
print(' Stoping the service')
|
||||
run_notfatal('sc stop sshd')
|
||||
killalltasks('ssh.exe')
|
||||
if service_is_running('sshd'):
|
||||
service_stop('sshd')
|
||||
killalltasks('sshd.exe')
|
||||
print(' Uninstalling the service')
|
||||
run(r'powershell.exe -ExecutionPolicy Bypass -File "%s\uninstall-sshd.ps1"' % makepath(programfiles,'OpenSSH'))
|
||||
print(' Removing files')
|
||||
|
|
Loading…
Reference in New Issue