Skip to content

Commit

Permalink
Compile Cleanup and Tweak Fixes (#2062)
Browse files Browse the repository at this point in the history
* Simple improvements to 'applications.json' File (#2043)

* Replace Spaces with Tabs in 'applications.json' File

* Correct 'AFFiNE' App Entry's Winget ID from 'AFFiNE.stable' to 'ToEverything.AFFiNE' in 'applications.json' File

* Compile Winutil

* Tweaks (#2051)

* Fix Numlock toggle (#2044)

* Fix Numlock at login

* Compile Winutil

---------

Co-authored-by: ChrisTitusTech <[email protected]>

* Compile Winutil

* fix typo (#2041)

* Compile Winutil

* Update README.md

* * Fixed .getignore issues, it's it not enough to just add to gitgnore if it was already tracked by git it will be continued to be tracked by git, so you have to 'git rm' it
* Fixed ooshutup, there is no need to download configs, they are
  already compiled into winutil
+ Added a tweak to remove and disable Intel LMS, which have been
  identifed as a potential backdoor into Windows.

* Update winget.ps1

* + Added new release actions, every time we merge into main it will
  create a release by extracting the version fromwinutil.ps1 and setting
  all appropriate tags and versions

* fix merge

* add compile back in

* Update action to latest tools

* Ensure Compile is finished

---------

Co-authored-by: Chris Titus <[email protected]>
Co-authored-by: ChrisTitusTech <[email protected]>
Co-authored-by: nikolan <[email protected]>
Co-authored-by: KonTy <[email protected]>
Co-authored-by: Chris Titus <[email protected]>

* Compile Winutil

* Rework Compile (#2061)

* Compile Winutil

---------

Co-authored-by: Mr.k <[email protected]>
Co-authored-by: ChrisTitusTech <[email protected]>
Co-authored-by: KonTy <[email protected]>
Co-authored-by: nikolan <[email protected]>
Co-authored-by: KonTy <[email protected]>
Co-authored-by: Martin Wiethan <[email protected]>
  • Loading branch information
7 people committed Jun 10, 2024
1 parent 1325ef5 commit 2b80e14
Show file tree
Hide file tree
Showing 13 changed files with 727 additions and 1,336 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Compile

on:
push:
branches:
- main
- test*

jobs:
build-runspace:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Compile project
shell: pwsh
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; ./Compile.ps1
continue-on-error: false # Directly fail the job on error, removing the need for a separate check
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Compile Winutil
if: success()
52 changes: 35 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
name: Update Branch
name: Release WinUtil

on:
push:
branches:
- main
- test*
workflow_run:
workflows: ["Compile WinUtil"] #Ensure Compile winget.ps1 is done
types:
- completed

jobs:
build-runspace:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Compile project
shell: pwsh
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; ./Compile.ps1
continue-on-error: false # Directly fail the job on error, removing the need for a separate check
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Compile Winutil
if: success()
- name: Checkout Repository
uses: actions/checkout@v4

- name: Extract Version from winutil.ps1
id: extract_version
run: |
$version = ''
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
$version = $matches[1]
echo "version=$version" >> $GITHUB_ENV
break
}
}
if (-not $version) {
Write-Error "Version not found in winutil.ps1"
exit 1
}
shell: pwsh

- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.extract_version.outputs.version }}
name: Release ${{ steps.extract_version.outputs.version }}
body_path: path/to/release-notes.md
files: ./winutil.ps1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85 changes: 51 additions & 34 deletions Compile.ps1
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
param (
[switch]$Debug
)
$OFS = "`r`n"
$scriptname = "winutil.ps1"

# Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot
$sync.configs = @{}

if (Test-Path -Path "$($scriptname)")
{
Remove-Item -Force "$($scriptname)"
}

Write-output '
$header = @"
################################################################################################################
### ###
### WARNING: This file is automatically generated DO NOT modify this file directly as it will be overwritten ###
### ###
################################################################################################################
' | Out-File ./$scriptname -Append -Encoding ascii
"@

(Get-Content .\scripts\start.ps1).replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)") | Out-File ./$scriptname -Append -Encoding ascii
# Create the script in memory.
$script_content = [System.Collections.Generic.List[string]]::new()

Get-ChildItem .\functions -Recurse -File | ForEach-Object {
Get-Content $psitem.FullName | Out-File ./$scriptname -Append -Encoding ascii
}
Write-Progress -Activity "Compiling" -Status "Adding: Header" -PercentComplete 5
$script_content.Add($header)

Write-Progress -Activity "Compiling" -Status "Adding: Version" -PercentComplete 10
$script_content.Add($(Get-Content .\scripts\start.ps1).replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))

Write-Progress -Activity "Compiling" -Status "Adding: Functions" -PercentComplete 20
Get-ChildItem .\functions -Recurse -File | ForEach-Object {
$script_content.Add($(Get-Content $psitem.FullName))
}
Write-Progress -Activity "Compiling" -Status "Adding: Config *.json" -PercentComplete 40
Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {

$json = (Get-Content $psitem.FullName).replace("'","''")

# Replace every XML Special Character so it'll render correctly in final build
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
# Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method
$jsonAsObject = $json | convertfrom-json
$firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object {
$_.Replace('=}','').Replace('@{','').Replace(' ','')
Expand All @@ -38,7 +46,7 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
$firstLevelName = $firstLevelJsonList[$i]
# Note: Avoid using HTML Entity Codes (for example '&rdquo;' (stands for "Right Double Quotation Mark")), and use HTML decimal/hex codes instead.
# as using HTML Entity Codes will result in XML parse Error when running the compiled script.
# as using HTML Entity Codes will result in XML parse Error when running the compiled script.
if ($jsonAsObject.$firstLevelName.content -ne $null) {
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&#38;').replace('','&#8220;').replace('','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;')
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop
Expand All @@ -49,44 +57,53 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-
}
}
# The replace at the end is required, as without it the output of converto-json will be somewhat weird for Multiline String
# Most Notably is the scripts in json files, make=ing it harder for users who want to review these scripts that are found in the final compiled script
# Most Notably is the scripts in json files, making it harder for users who want to review these scripts that are found in the final compiled script
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")

$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" | Out-File ./$scriptname -Append -Encoding ascii
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
}
Write-Progress -Activity "Compiling" -Status "Adding: Config *.cfg" -PercentComplete 45
Get-ChildItem .\config | Where-Object {$PSItem.Extension -eq ".cfg"} | ForEach-Object {
Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'" | Out-File ./$scriptname -Append -Encoding ascii
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'"))
}
Get-ChildItem .\config | Where-Object {$PSItem.Extension -eq ".cfg"} | ForEach-Object {
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'"))
}

$xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")

# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1

## Xaml Manipulation
$tabColumns = Get-TabXaml "applications" 5
$tabColumns | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tabColumns = Get-TabXaml "tweaks"
$tabColumns | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$tabColumns = Get-TabXaml "feature"
$tabColumns | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
Write-Progress -Activity "Compiling" -Status "Building: Xaml " -PercentComplete 75
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"

# Assuming inputApp.xaml is in the same directory as main.ps1
$appXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputApp.xaml"
$tweaksXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputTweaks.xaml"
$featuresXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputFeatures.xaml"

# Load the XAML content from inputApp.xaml
$appXamlContent = Get-Content -Path $appXamlPath -Raw
$tweaksXamlContent = Get-Content -Path $tweaksXamlPath -Raw
$featuresXamlContent = Get-Content -Path $featuresXamlPath -Raw

Write-Progress -Activity "Compiling" -Status "Adding: Xaml " -PercentComplete 90
# Replace the placeholder in $inputXML with the content of inputApp.xaml
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
$xaml = $xaml -replace "{{InstallPanel_features}}", $featuresXamlContent

Write-output "`$inputXML = '$xaml'" | Out-File ./$scriptname -Append -Encoding ascii
$script_content.Add($(Write-output "`$inputXML = '$xaml'"))

$script_content.Add($(Get-Content .\scripts\main.ps1))

if ($Debug){
Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95
$appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
}
else {
Write-Progress -Activity "Compiling" -Status "Removing temporary files" -PercentComplete 99
Remove-Item ".\xaml\inputApp.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue
Remove-Item ".\xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue
}

Get-Content .\scripts\main.ps1 | Out-File ./$scriptname -Append -Encoding ascii
Set-Content -Path $scriptname -Value ($script_content -join "`r`n") -Encoding ascii
Write-Progress -Activity "Compiling" -Completed
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ or by executing:
iwr -useb https://christitus.com/win | iex
```

if for some reason this site is not reachable from your country please try running it directly from github

if for some reason this site is not reachable from your country please try running it directly from github (replace 24.06.07 with current release that you are interested in)
```
irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winutil.ps1 | iex
irm "https://raw.githubusercontent.com/ChrisTitusTech/winutil/24.06.07/winutil.ps1" | iex
```

#### Automation
Expand Down
32 changes: 16 additions & 16 deletions config/applications.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"winget": "Famatech.AdvancedIPScanner"
},
"WPFInstallaffine": {
"category": "Document",
"choco": "na",
"content": "AFFiNE",
"description": "AFFiNE is an open source alternative to Notion. Write, draw, plan all at once. Selfhost it to sync across devices.",
"link": "https://affine.pro/",
"winget": "AFFiNE.stable"
},
"category": "Document",
"choco": "na",
"content": "AFFiNE",
"description": "AFFiNE is an open source alternative to Notion. Write, draw, plan all at once. Selfhost it to sync across devices.",
"link": "https://affine.pro/",
"winget": "ToEverything.AFFiNE"
},
"WPFInstallaimp": {
"category": "Multimedia Tools",
"choco": "aimp",
Expand Down Expand Up @@ -2408,13 +2408,13 @@
"winget": "Waterfox.Waterfox"
},
"WPFInstallwazuh": {
"category": "Utilities",
"choco": "wazuh-agent",
"content": "Wazuh.",
"description": "Wazuh is an open-source security monitoring platform that offers intrusion detection, compliance checks, and log analysis.",
"link": "https://wazuh.com/",
"winget": "Wazuh.WazuhAgent"
},
"category": "Utilities",
"choco": "wazuh-agent",
"content": "Wazuh.",
"description": "Wazuh is an open-source security monitoring platform that offers intrusion detection, compliance checks, and log analysis.",
"link": "https://wazuh.com/",
"winget": "Wazuh.WazuhAgent"
},
"WPFInstallwezterm": {
"category": "Development",
"choco": "wezterm",
Expand Down Expand Up @@ -2736,7 +2736,7 @@
"winget": "magic-wormhole.magic-wormhole"
},
"WPFInstallqgis": {
"category": "Multimedia Tools",
"category": "Multimedia Tools",
"choco": "qgis",
"content": "QGIS",
"description": "QGIS (Quantum GIS) is an open-source Geographic Information System (GIS) software that enables users to create, edit, visualize, analyze, and publish geospatial information on Windows, Mac, and Linux platforms.",
Expand All @@ -2758,7 +2758,7 @@
"description": "GlazeWM is a tiling window manager for Windows inspired by i3 and Polybar",
"link": "https://github.com/glzr-io/glazewm",
"winget": "glzr-io.glazewm"
},
},
"WPFInstallfancontrol": {
"category": "Utilities",
"choco": "na",
Expand Down
14 changes: 9 additions & 5 deletions config/ooshutup10_recommended.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############################################################################
# This file was created with O&O ShutUp10++ V1.9.1436
# This file was created with O&O ShutUp10++ V1.9.1438
# and can be imported onto another computer.
#
# Download the application at https://www.oo-software.com/shutup10
Expand All @@ -13,7 +13,7 @@
# user does not get any feedback about the import.
#
# We are always happy to answer any questions you may have!
# © 2015-2023 O&O Software GmbH, Berlin. All rights reserved.
# © 2015-2024 O&O Software GmbH, Berlin. All rights reserved.
# https://www.oo-software.com/
############################################################################

Expand Down Expand Up @@ -179,6 +179,8 @@ C015 +
C101 +
C201 +
C102 +
C103 +
C203 +
L001 +
L003 +
L004 -
Expand Down Expand Up @@ -208,9 +210,9 @@ S014 -
K001 +
K002 +
K005 +
M003 -
M003 +
M015 +
M016 -
M016 +
M017 -
M018 +
M019 -
Expand All @@ -221,7 +223,9 @@ M001 +
M004 +
M005 +
M024 +
M026 +
M027 +
M012 -
M013 -
M014 -
N001 -
N001 -
Loading

0 comments on commit 2b80e14

Please sign in to comment.