From bfd554080946ad50b53a45896fc23e576e438dba Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:37:07 +0100 Subject: [PATCH 1/2] feat(release-zip): link to install docs --- src/release-zip/Read the Install Guide First!.url | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/release-zip/Read the Install Guide First!.url diff --git a/src/release-zip/Read the Install Guide First!.url b/src/release-zip/Read the Install Guide First!.url new file mode 100644 index 0000000000..b2f0cd545e --- /dev/null +++ b/src/release-zip/Read the Install Guide First!.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,11 +[InternetShortcut] +IDList= +URL=https://docs.atlasos.net/getting-started/installation/ From c83687746ebc3921085eea4c44b71d8ad4229513 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:37:27 +0100 Subject: [PATCH 2/2] feat(version): winver, get dynamically from .conf --- src/local-build.ps1 | 33 ++++++++- src/playbook/Configuration/custom.yml | 16 +++- .../tweaks/misc/config-oem-information.yml | 14 +++- .../performance/system/config-boot-config.yml | 10 --- src/playbook/Executables/UPGRADECHECK.ps1 | 74 ------------------- 5 files changed, 55 insertions(+), 92 deletions(-) delete mode 100644 src/playbook/Executables/UPGRADECHECK.ps1 diff --git a/src/local-build.ps1 b/src/local-build.ps1 index ecae38cbfa..a0a275c56b 100644 --- a/src/local-build.ps1 +++ b/src/local-build.ps1 @@ -10,7 +10,7 @@ param ( $removals | % { Set-Variable -Name "remove$_" -Value $true } -# Function to convert paths for convienience, needed for Linux/macOS +# Convert paths for convienience, needed for Linux/macOS function Seperator { return $args -replace '\\', "$([IO.Path]::DirectorySeparatorChar)" } @@ -101,7 +101,7 @@ while ($true) { Get-Content -Wait -LiteralPath $a -EA 0 | Write-Output; Start-Sl Set-Content -Path $tempCustomYmlPath -Value $newCustomYml } else { - Write-Error "Can't find "$customYmlPath", not adding live log." + Write-Error "Can't find '$customYmlPath', not adding live log." } } @@ -120,10 +120,37 @@ while ($true) { Get-Content -Wait -LiteralPath $a -EA 0 | Write-Output; Start-Sl Set-Content -Path $tempStartYmlPath -Value $newStartYml } else { - Write-Error "Can't find "$startYmlPath", not removing dependencies." + Write-Error "Can't find '$startYmlPath', not removing dependencies." } } + $oemYmlPath = Seperator "Configuration\tweaks\misc\config-oem-information.yml" + $tempOemYmlPath = Seperator "$playbookTemp\$oemYmlPath" + if (Test-Path $oemYmlPath -PathType Leaf) { + $confXml = ([xml](Get-Content "playbook.conf" -Raw -EA 0)).Playbook + $version = "v$($confXml.Version)" + if ($version -like '*.*.*') { + if ($confXml.Title | Select-String '(dev)' -Quiet) { + $version = $version + ' (dev)' + } + + $oemToReplace = 'AtlasVersionUndefined' + $oemYml = Get-Content -Path $oemYmlPath -Raw + $tempOemYml = $oemYml -replace $oemToReplace, $version + + if ($tempOemYml -eq $oemYml) { + Write-Error "Couldn't find OEM string '$oemToReplace'." + } else { + New-Item (Split-Path $tempOemYmlPath) -ItemType Directory -Force | Out-Null + Set-Content -Path $tempOemYmlPath -Value $tempOemYml + } + } else { + Write-Error "Can't XML in 'playbook.conf', not setting OEM version." + } + } else { + Write-Error "Can't find '$oemYmlPath', not setting OEM version." + } + # exclude files $excludeFiles = @( "local-build.*", diff --git a/src/playbook/Configuration/custom.yml b/src/playbook/Configuration/custom.yml index 0d7203e0b9..dadce24914 100644 --- a/src/playbook/Configuration/custom.yml +++ b/src/playbook/Configuration/custom.yml @@ -2,10 +2,20 @@ title: Root Playbook File description: Runs all of the Playbook files actions: - # Check various conditions to see if the user should run Atlas or not + # Warn user if their Windows install is old - !powerShell: - command: '.\UPGRADECHECK.ps1' - exeDir: true + command: | + if ((gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation' -Name 'Model' -EA 0).Model -notmatch 'Atlas') { + if (20 -lt ((Get-Date) - (gcim Win32_OperatingSystem).InstallDate).Days) { + @' + Windows seems to have been installed a while ago. A full Windows reinstall is highly recommended to ensure your initial install of Atlas works without problems. + + Atlas will install anyways, but remember this if there's issues. + + Follow our installation guide: https://docs.atlasos.net/getting-started/installation/ + '@ | msg * + } + } wait: true - !writeStatus: {status: 'Copying files'} diff --git a/src/playbook/Configuration/tweaks/misc/config-oem-information.yml b/src/playbook/Configuration/tweaks/misc/config-oem-information.yml index 951e2ed8d5..b5bfea7087 100644 --- a/src/playbook/Configuration/tweaks/misc/config-oem-information.yml +++ b/src/playbook/Configuration/tweaks/misc/config-oem-information.yml @@ -3,8 +3,18 @@ title: Configure OEM Information description: Configures OEM information to contain the Atlas version and the Atlas Discord server actions: - !powerShell: - command: '.\UPGRADECHECK.ps1 -SetVersion' - exeDir: true + command: | + $version = 'AtlasVersionUndefined' + + Write-Output 'Setting boot entry name...' + bcdedit /set description """AtlasOS $(('10', '11')[[int]([System.Environment]::OSVersion.Version.Build -ge 22000)]) $version""" + + Write-Output 'Setting other versioned OEM information...' + $reportedVer = """Atlas Playbook $version""" + # Shows in Settings + Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation' -Name 'Model' -Value $reportedVer -Force + # Shows in winver + Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name 'RegisteredOrganization' -Value $reportedVer -Force wait: true - !registryValue: path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation' diff --git a/src/playbook/Configuration/tweaks/performance/system/config-boot-config.yml b/src/playbook/Configuration/tweaks/performance/system/config-boot-config.yml index 0d2763f851..9c5244768a 100644 --- a/src/playbook/Configuration/tweaks/performance/system/config-boot-config.yml +++ b/src/playbook/Configuration/tweaks/performance/system/config-boot-config.yml @@ -11,13 +11,3 @@ actions: # Use legacy boot menu - !run: {exe: 'bcdedit', args: '/set {bootloadersettings} bootmenupolicy legacy'} - - # Set boot manager descriptions - - !run: - exe: 'bcdedit' - args: '/set description "AtlasOS 10"' - builds: [ '<22000' ] - - !run: - exe: 'bcdedit' - args: '/set description "AtlasOS 11"' - builds: [ '>=22000' ] diff --git a/src/playbook/Executables/UPGRADECHECK.ps1 b/src/playbook/Executables/UPGRADECHECK.ps1 deleted file mode 100644 index 8e02f95663..0000000000 --- a/src/playbook/Executables/UPGRADECHECK.ps1 +++ /dev/null @@ -1,74 +0,0 @@ -param ( [switch]$SetVersion ) - -$version = 'v0.5.0 (dev)' -$upgradableFrom = 'v0.4.0' ` - -replace '[^0-9]' -replace '^0+' - -$oemInfo = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation' -if ($SetVersion) { - Set-ItemProperty $oemInfo -Name "Model" -Value "AtlasOS $version" -Force - exit [int]$? -} - -################################################################################ - -# Kill AME and its processes -function KillAme { - $ameProcesses = Get-Process | Where-Object { - ($_.Company -like 'Ameliorated LLC*' -and $_.Description -like 'AME*') -or - $_.Name -like '*TrustedUninstaller*' - } - - if ($null -eq $ameProcesses) { - Write-Error "No AME processes found!" - while ($true) { Start-Sleep 999999999 } - } - - $ameProcesses | Stop-Process -Force - - exit 1 -} - -$version = [int]($version -replace '[^0-9]' -replace '^0+') - -# Check if Atlas is installed -$model = (Get-ItemProperty $oemInfo -Name "Model" -EA 0).Model -$guide = "Follow our installation guide: https://docs.atlasos.net/getting-started/installation/" -if ($model -notlike "*Atlas*") { - Write-Output "Model doesn't contain Atlas, Atlas doesn't seem to be installed currently." - if (20 -lt ((Get-Date) - (Get-CimInstance Win32_OperatingSystem).InstallDate).Days) { - @" -Windows seems to have been installed a while ago. A full Windows reinstall is highly recommended to ensure your initial install of Atlas works without problems. - -Atlas will install anyways, but remember this if there's issues. - -$guide -"@ | msg * - } - exit 2 -} -$installedVersion = [int]($model -replace '[^0-9]' -replace '^0+') - -# Check if you can upgrade -if ($upgradableFrom -gt $installedVersion) { - @" -You can't upgrade from your current version of Atlas to this newer version. Only upgrades from Atlas v0.4.0 and onwards are supported. - -We are sorry for the inconvenience. - -$guide -"@ | msg * - - KillAme -} - -# Check if user is trying to downgrade -if ($installedVersion -gt $version) { - @" -You can't downgrade from your current version of Atlas to this older version. - -If there's an issue with the newest release, consider filing an issue on GitHub: https://github.com/Atlas-OS/Atlas/issues -"@ | msg * - - KillAme -} \ No newline at end of file