[Help] Script for pre-installing Bash/Ubuntu

Discussion in 'Scripting' started by kal, Sep 14, 2017.

  1. kal

    kal MDL Member

    Aug 18, 2007
    105
    21
    10
    Hello

    I'm looking for a way to preinstall bash/ubuntu on my custom windows 10. I've already enabled Developer mode & feature Microsoft-Windows-Subsystem-Linux. But, on a fresh install, when type bash, it downloads ubuntu and install it.

    I would like to find a way to preinstall bash and avoid the need to download ubuntu the first time I type bash.

    Any ideas ? :)
     
  2. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #3 Chibi ANUBIS, Apr 9, 2018
    Last edited: Apr 9, 2018
    1) To add packages to an offline image by using DISM

    Type the following command to mount the offline Windows image.
    Code:
    Dism /Mount-Image /ImageFile:c:\images\myimage.wim /Index:1 /mountdir:c:\test\offline
    
    To service an offline image, specify the location of the mounted image directory. For example, type:
    Code:
    Dism /Image:C:\test\offline /Get-Features
    
    (You can use >featurelist.txt to redirect the output of the command to a text file that is named featurelist.)

    To service an offline image, specify the location of the mounted image directory. For example, type:
    Code:
    Dism /Image:C:\test\offline /Enable-Feature /FeatureName:[NAME OF THE APP FEATURES] /All
    
    (Here is SubSytem Linux)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #4 Chibi ANUBIS, Apr 9, 2018
    Last edited: Apr 9, 2018
    2) To preinstall a Microsoft Store-signed app by using the Dism.exe tool

    Add the app to the mounted image. Use the /PackagePath option and the /DependencyPackagePath option to specify the location of the folder containing all of the unpacked files and the dependency files from the Microsoft Store package. /PackagePath should specify the root folder for the extracted folders. The root folder contains the license.xml, AUMIDs.txt, and all of the package files. At the command prompt, type:
    Code:
    Dism /Image:c:\test\offline /Add-ProvisionedAppxPackage /PackagePath:c:\downloads\appxpackage /DependencyPackagePath:c:\downloads\appxpackagedependency
    
    Save changes and unmount the image. At the command prompt, type:
    Code:
    Dism /Unmount-Image /mountdir:c:\test\offline /commit
    
    You need to get the Ubuntu APPX, follow this tutorial : https://www.maketecheasier.com/download-appx-files-from-windows-store/
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...