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
21 "apache-ant-1.10.15-bin.zip",
22 "clang-format-5.0.0-win.exe",
25 "make-4.2.1-msvc.exe",
26 "strawberry-perl-5.40.0.1-64bit-portable.zip",
28 !(($files | foreach {Test-Path "$env:PUBLIC/Downloads/$_"}) -contains $false)
29 - resource: xPSDesiredStateConfiguration/xScript
32 description: check that wsl utility is available/working - i.e. whether wsl is installed
34 TestScript: wsl.exe --status ; return ![bool]$LASTEXITCODE
35 GetScript: return $false
36 SetScript: return $false
38 - resource: xPSDesiredStateConfiguration/xScript
41 description: create the ~/bin directory
43 TestScript: Test-Path -Path "$env:UserProfile/bin" -PathType "Container"
44 GetScript: Test-Path -Path "$env:UserProfile/bin" -PathType "Container"
45 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name "bin"
46 - resource: xPSDesiredStateConfiguration/xScript
49 description: create the ~/lo directory
51 TestScript: Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
52 GetScript: Test-Path -Path "$env:UserProfile/lo" -PathType "Container"
53 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name "lo"
54 - resource: xPSDesiredStateConfiguration/xScript
59 description: copy make.exe to the ~/bin directory
61 TestScript: Test-Path -Path "$env:USERPROFILE/bin/make.exe"
62 GetScript: Test-Path -Path "$env:USERPROFILE/bin/make.exe"
63 SetScript: Copy-Item -Path "$env:PUBLIC/Downloads/make-4.2.1-msvc.exe" -Destination "$env:USERPROFILE/bin/make.exe"
64 - resource: xPSDesiredStateConfiguration/xScript
69 description: copy clang-format.exe to the ~/bin directory
71 TestScript: Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
72 GetScript: Test-Path -Path "$env:USERPROFILE/bin/clang-format.exe"
73 SetScript: Copy-Item -LiteralPath "$env:PUBLIC/Downloads/clang-format-5.0.0-win.exe" -Destination "$env:USERPROFILE/bin/clang-format.exe"
74 - resource: xPSDesiredStateConfiguration/xScript
79 description: copy junit to the ~/lo directory
81 TestScript: Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
82 GetScript: Test-Path -Path "$env:USERPROFILE/lo/junit-4.10.jar"
83 SetScript: Copy-Item -LiteralPath "$env:PUBLIC/Downloads/junit-4.10.jar" -Destination "$env:USERPROFILE/lo/junit-4.10.jar"
84 # the DSC Archive module doesn't operate with $env:FOO / would need hardcoded paths
85 - resource: xPSDesiredStateConfiguration/xScript
90 description: extract ant to the ~/lo directory
92 TestScript: Test-Path -Path "$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
93 GetScript: Test-Path -Path "$env:USERPROFILE/lo/apache-ant-1.10.15/bin/ant"
94 SetScript: Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/apache-ant-1.10.15-bin.zip" -Destination "$env:USERPROFILE/lo/"
95 - resource: xPSDesiredStateConfiguration/xScript
100 description: extract strawberry-perl-portable to the ~/lo directory
102 TestScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
103 GetScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/bin/perl.exe"
104 SetScript: Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/strawberry-perl-5.40.0.1-64bit-portable.zip" -Destination "$env:USERPROFILE/lo/spp"
105 - resource: xPSDesiredStateConfiguration/xScript
106 id: spp-install-font-ttf
110 description: install perl-font-TTF to spp via cpan
112 TestScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
113 GetScript: Test-Path -Path "$env:USERPROFILE/lo/spp/perl/site/lib/Font/TTF.pm"
115 $env:Path = "$env:USERPROFILE/lo/spp/c/bin;$env:USERPROFILE/lo/spp/perl/bin;$env:path"
117 - resource: xPSDesiredStateConfiguration/xScript
123 description: extract and copy jom to the ~/bin directory
125 TestScript: Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
126 GetScript: Test-Path -Path "$env:USERPROFILE/bin/jom.exe"
128 Expand-Archive -LiteralPath "$env:PUBLIC/Downloads/jom_1_1_4.zip" -Destination "$env:USERPROFILE/lo/jom_unpack"
129 Copy-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack/jom.exe" -Destination "$env:USERPROFILE/bin/jom.exe"
130 Remove-Item -LiteralPath "$env:USERPROFILE/lo/jom_unpack" -Recurse
131 - resource: xPSDesiredStateConfiguration/xScript
134 description: configure git to use protocol.version 2 and core.autocrlf false
136 TestScript: return $false
137 GetScript: return $false
139 git config --global core.autocrlf false
140 git config --global protocol.version 2
141 - resource: xPSDesiredStateConfiguration/xScript
146 description: create an autogen.input snippet with some sensible defaults
148 TestScript: Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
149 GetScript: Test-Path -Path "$env:USERPROFILE/lo/autogen.input"
151 New-Item -Path "$env:USERPROFILE/lo" -Name "autogen.input" -ItemType "file" -Value "# adjust to your needs
152 --host=x86_64-pc-cygwin
153 #--host=i686-pc-cygwin
155 --with-visual-studio=2022
156 --enable-python=fully-internal
158 --disable-online-update
159 --with-external-tar=$env:USERPROFILE\lo\lo-externaltar
160 --with-strawberry-perl-portable=$env:USERPROFILE\lo\spp
161 --with-ant-home=$env:USERPROFILE\lo\apache-ant-1.10.15
162 --with-junit=$env:USERPROFILE\lo\junit-4.10.jar
163 --with-doxygen=$env:USERPROFILE\lo\spp\c\bin\doxygen.exe
165 #--disable-dependency-tracking
169 - resource: xPSDesiredStateConfiguration/xScript
172 description: create the ~/.cloud-init directory
174 TestScript: Test-Path -Path "$env:UserProfile/.cloud-init" -PathType "Container"
175 GetScript: Test-Path -Path "$env:UserProfile/.cloud-init" -PathType "Container"
176 SetScript: New-Item -ItemType "directory" -Path "$env:UserProfile" -Name ".cloud-init"
177 - resource: xPSDesiredStateConfiguration/xScript
178 id: cloud-init-config
182 description: create a cloud-init configuration to automate the installation of Ubuntu 24.04
184 TestScript: Test-Path -Path "$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
185 GetScript: Test-Path -Path "$env:USERPROFILE/.cloud-init/Ubuntu-24.04.user-data"
187 New-Item -Path "$env:USERPROFILE/.cloud-init" -Name "Ubuntu-24.04.user-data" -ItemType "file" -Value '#cloud-config
191 password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
192 groups: [user, adm, dialout, cdrom, floppy, sudo, audio, dip, video, plugdev, netdev]
196 - path: /etc/wsl.conf
202 packages: [pkg-config, automake, make, gperf, bison, nasm, flex, zip, libfont-ttf-perl]
204 - resource: xPSDesiredStateConfiguration/xScript
209 description: installs Ubuntu with help of the cloud-init file
211 TestScript: wsl.exe --list ; return ![bool]$LASTEXITCODE
212 GetScript: wsl.exe --list ; return ![bool]$LASTEXITCODE
214 wsl.exe --install --no-launch --distribution Ubuntu-24.04
215 ubuntu2404.exe install --root
216 ubuntu2404.exe run cloud-init status --wait
217 configurationVersion: 0.2.0