tis-wsl-debian

1.1.3.0-13
Debian Windows Subsystem for Linux
1195 downloads
Download
default icon

  Description 

  • package : tis-wsl-debian
  • version : 1.1.3.0-13
  • architecture : all
  • categories : System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELE,Simon Fonteneau
  • description : Debian Windows Subsystem for Linux
  • locale :
  • target_os : windows
  • min_wapt_version : 1.7
  • sources :
  • installed_size :
  • impacted_process :
  • description_fr :
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor :
  • licence :
  • signature_date : 2020-06-22T17:11:05.375000
  • Depends :
  • Conflicts :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
import xml.etree.ElementTree as ET

uninstallkey = []

bin_name_string = 'DebianGNULinux_%s.Appx'
package_name = 'TheDebianProject.DebianGNULinux'


def set_variables():
    # Declaring variables
    global package_version
    package_version = control.version.split('-')[0]
    global bin_name
    bin_name = bin_name_string % package_version
    global app_name
    app_name = control.name
    global wsl_dir
    wsl_dir = makepath(programfiles,'WSL')
    global wsl_debian
    wsl_debian = makepath(wsl_dir,bin_name)


def install():
    # Initializing variables
    set_variables()

    # Installing the package
    if not isdir(wsl_dir):
        mkdirs(wsl_dir)
    for bin_in_dir in glob.glob(makepath(wsl_dir,'*ebian*')):
        if bin_in_dir != wsl_debian:
            print('Removing %s' % bin_in_dir)
            remove_file(bin_in_dir)

    if not isfile(wsl_debian):
        print('Copying %s in %s ' % (bin_name,wsl_dir))
        filecopyto(bin_name,wsl_dir)


def uninstall():
    # Initializing variables
    set_variables()

    # Uninstalling the package
    print('Removing %s (%s) for all users' % (package_name,app_name))
    run_powershell('Get-AppxPackage -Name %s -AllUsers | Remove-AppxPackage' % package_name)


def session_setup():
    # Initializing variables
    set_variables()

    # Install the Appx in user environment
    try:
        installed_wsl_debian_version = run_powershell('Get-AppxPackage -Name "%s" | Select-Object version' % package_name)['Version']
    except:
        installed_wsl_debian_version = '0.0.0'

    if package_version > installed_wsl_debian_version:
        print("Installing %s for the current user" % app_name)
        run_powershell('Add-AppxPackage -Path "%s"' % wsl_debian)

    # Configuring WSL
    wsl_dir = makepath(user_local_appdata,'Packages','TheDebianProject.DebianGNULinux_76v4gfsz19hv4','LocalState','rootfs')
    wsl_etc_dir = makepath(wsl_dir,'etc')
    wsl_conf = makepath(wsl_etc_dir,'wsl.conf')

    # Need to found a way to edit WSL files (right problems)
    """ try:
        inifile_writestring(wsl_conf,'network','generateResolvConf','false')
    except:
        print('Unable to create %s' % wsl_conf) """



def update_package():
    print('Download/Update package content from upstream binary sources')

    # Getting proxy informations from WAPT settings
    proxy = {}
    if platform.system()=='Windows' and isfile(makepath(user_local_appdata(),'waptconsole','waptconsole.ini')):
        proxywapt = inifile_readstring(makepath(user_local_appdata(),'waptconsole','waptconsole.ini'),'global','http_proxy')
        if proxywapt :
            proxy = {'http':proxywapt,'https':proxywapt}

    # Initializing variables
    set_variables()
    latest_bin = bin_name_string.split('_')[0] + '.Appx'
    url_dl = 'https://aka.ms/wsl-debian-gnulinux'

    print('Download url is: ' + url_dl)

    # Downloading latest binaries
    if isfile(latest_bin):
        remove_file(latest_bin)
    if not isfile(latest_bin):
        print('Downloading: ' + latest_bin)
        wget(url_dl,latest_bin,proxies=proxy)

        # Unzip to get file version
        unzip(latest_bin,target='debian_wsl_temp')

        # Checking version from file
        xml_to_read = ET.parse(r'debian_wsl_temp\AppxManifest.xml')
        xml_content = xml_to_read.getroot()

        for vers in xml_content.getchildren():
            if vers.get('Name') == 'TheDebianProject.DebianGNULinux':
                version_from_file = vers.get('Version')

        version = version_from_file
        old_latest_bin = latest_bin
        latest_bin = bin_name_string % version
        if isfile(latest_bin):
            remove_file(latest_bin)
        os.rename(old_latest_bin,latest_bin)
        print('Verified latest ' + app_name + ' version is: ' + version)

        # Removing temp folder
        remove_tree('debian_wsl_temp')

        # Changing version of the package
        control.version = '%s-%s'%(version,int(control.version.split('-')[-1])+1)
        control.save_control_to_wapt()
        print('Changing version to ' + control.version + ' in WAPT\\control')

    # Deleting outdated binaries
    for bin_in_dir in glob.glob('*.Appx'):
        if bin_in_dir != latest_bin :
            print('Outdated binary: ' + bin_in_dir + ' Deleted')
            remove_file(bin_in_dir)




										

  Changelog 



No changelog.txt.
									
  manifest.sha256