1 # yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
3 # configuration to setup the dependencies in ~/lo and add make, jom and clang-format to ~/bin
4 # and install a wsl distro with the required packages
5 # this configuration is meant to be applied as the build user, and after the admin_java_and_deps one
6 # has been applied. It also creates a ~/lo/autogen.input with some sensible defaults that can be
7 # used as a template for own modifications
11 - resource: xPSDesiredStateConfiguration/xScript
14 description: check that everything had been downloaded by the admin-step
16 GetScript: return $false
17 SetSCript: return $false
18 # the empty string element is so that each file can be specified with trailing comma
22 "apache-ant-1.10.15-bin.zip",
23 "clang-format-5.0.0-win.exe",
26 "make-4.2.1-msvc.exe",
27 "strawberry-perl-5.40.0.1-64bit-portable.zip",
29 !(($files | foreach {Test-Path "$env:PUBLIC/Downloads/$_"}) -contains $false)
30 - resource: xPSDesiredStateConfiguration/xScript
33 description: check that wsl utility is available/working - i.e. whether wsl is installed
35 TestScript: wsl.exe --status ; return ![bool]$LASTEXITCODE
36 GetScript: return $false
37 SetScript: return $false
39 - resource: xPSDesiredStateConfiguration/xScript
42 description: create the ~/bin directory
44 TestScript: Test-Path -Path "$env:UserProfile/bin" -PathType "Container"
45 GetScript: Test-Path -Path "$env:UserProfile/bin" -PathType "Container"
46 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name "bin"
47 - resource: xPSDesiredStateConfiguration/xScript
50 description: create the ~/lo directory
52 TestScript: Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
53 GetScript: Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
54 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name "lo"
55 - resource: xPSDesiredStateConfiguration/xScript
60 description: copy make.exe to the ~/bin directory
62 TestScript: Test-Path -Path "$env:USERPROFILE/bin/make.exe"
63 GetScript: Test-Path -Path "$env:USERPROFILE/bin/make.exe"
64 SetScript: Copy-Item -Path "$env:PUBLIC/Downloads/make-4.2.1-msvc.exe" -Destination "$env:USERPROFILE/bin/make.exe"
65 - resource: xPSDesiredStateConfiguration/xScript
70 description: copy clang-format.exe to the ~/bin directory
72 TestScript: Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
73 GetScript: Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
74 SetScript: Copy-Item -LiteralPath "$env:PUBLIC/Downloads/clang-format-5.0.0-win.exe" -Destination "$env:USERPROFILE/bin/clang-format.exe"
75 - resource: xPSDesiredStateConfiguration/xScript
80 description: copy junit to the ~/lo directory
82 TestScript: Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
83 GetScript: Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
84 SetScript: Copy-Item -LiteralPath "$env:PUBLIC/Downloads/junit-4.10.jar" -Destination "$env:USERPROFILE/lo/junit-4.10.jar"
85 # the DSC Archive module doesn't operate with $env:FOO / would need hardcoded paths
86 - resource: xPSDesiredStateConfiguration/xScript
91 description: extract ant to the ~/lo directory
93 TestScript: Test-Path -Path "$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
94 GetScript: Test-Path -Path "$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
95 SetScript: Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/apache-ant-1.10.15-bin.zip" -Destination "$env:USERPROFILE/lo/"
96 - resource: xPSDesiredStateConfiguration/xScript
101 description: extract ucrts to the ~/lo directory
103 TestScript: Test-Path -Path "$env:USERPROFILE/lo/ucrt/Windows8.1-KB2999226-x64.msu"
104 GetScript: Test-Path -Path "$env:USERPROFILE/lo/ucrt/Windows8.1-KB2999226-x64.msu"
105 SetScript: Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/WindowsUCRT.zip" -Destination "$env:USERPROFILE/lo/ucrt"
106 - resource: xPSDesiredStateConfiguration/xScript
111 description: extract strawberry-perl-portable to the ~/lo directory
113 TestScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
114 GetScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
115 SetScript: Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/strawberry-perl-5.40.0.1-64bit-portable.zip" -Destination "$env:USERPROFILE/lo/spp"
116 - resource: xPSDesiredStateConfiguration/xScript
117 id: spp-install-font-ttf
121 description: install perl-font-TTF to spp via cpan
123 TestScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
124 GetScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
126 $env:Path = "$env:USERPROFILE/lo/spp/c/bin;$env:USERPROFILE/lo/spp/perl/bin;$env:path"
128 - resource: xPSDesiredStateConfiguration/xScript
134 description: extract and copy jom to the ~/bin directory
136 TestScript: Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
137 GetScript: Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
139 Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/jom_1_1_4.zip" -Destination "$env:USERPROFILE/lo/jom_unpack"
140 Copy-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack/jom.exe" -Destination "$env:USERPROFILE/bin/jom.exe"
141 Remove-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack" -Recurse
142 - resource: xPSDesiredStateConfiguration/xScript
145 description: configure git to use protocol.version 2 and core.autocrlf false
147 TestScript: return $false
148 GetScript: return $false
150 git config --global core.autocrlf false
151 git config --global protocol.version 2
152 - resource: xPSDesiredStateConfiguration/xScript
157 description: create an autogen.input snippet with some sensible defaults
159 TestScript: Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
160 GetScript: Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
162 New-Item -Path "$env:USERPROFILE/lo" -Name "autogen.input" -ItemType "file" -Value "# adjust to your needs
163 --host=x86_64-pc-cygwin
164 #--host=i686-pc-cygwin
166 --with-visual-studio=2022
167 --enable-python=fully-internal
169 --disable-online-update
170 --with-external-tar=$env:USERPROFILE\lo\lo-externaltar
171 --with-strawberry-perl-portable=$env:USERPROFILE\lo\spp
172 --with-ant-home=$env:USERPROFILE\lo\apache-ant-1.10.15
173 --with-junit=$env:USERPROFILE\lo\junit-4.10.jar
174 --with-doxygen=$env:USERPROFILE\lo\spp\c\bin\doxygen.exe
175 --with-ucrt-dir=$env:USERPROFILE\lo\ucrt
177 #--disable-dependency-tracking
181 - resource: xPSDesiredStateConfiguration/xScript
184 description: create the ~/.cloud-init directory
186 TestScript: Test-Path -Path "$env:UserProfile/.cloud-init" -PathType "Container"
187 GetScript: Test-Path -Path "$env:UserProfile/.cloud-init" -PathType "Container"
188 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name ".cloud-init"
189 - resource: xPSDesiredStateConfiguration/xScript
190 id: cloud-init-config
194 description: create a cloud-init configuration to automate the installation of Ubuntu 24.04
196 TestScript: Test-Path -Path "$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
197 GetScript: Test-Path -Path "$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
199 New-Item -Path "$env:USERPROFILE/.cloud-init" -Name "Ubuntu-24.04.user-data" -ItemType "file" -Value '#cloud-config
203 password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
204 groups: [user, adm, dialout, cdrom, floppy, sudo, audio, dip, video, plugdev, netdev]
208 - path: /etc/wsl.conf
214 packages: [pkg-config, automake, make, gperf, bison, nasm, flex, zip, libfont-ttf-perl]
216 - resource: xPSDesiredStateConfiguration/xScript
221 description: installs Ubuntu with help of the cloud-init file
223 TestScript: wsl.exe --list ; return ![bool]$LASTEXITCODE
224 GetScript: wsl.exe --list ; return ![bool]$LASTEXITCODE
226 wsl.exe --install --no-launch --distribution Ubuntu-24.04
227 ubuntu2404.exe install --root
228 ubuntu2404.exe run cloud-init status --wait
229 configurationVersion: 0.2.0