1212# #
1313# #############################################################################
1414
15- # Last update: September 15 , 2024
15+ # Last update: September 16 , 2024
1616
1717# ########################
1818# ## Configuration ###
@@ -777,7 +777,7 @@ function installOVJ([string]$distribution) {
777777 }
778778
779779 # Start the installer - User will need to complete interactively, including shell prompts
780- wsl - d $distribution - u root -- cd ' /tmp/dvdimageOVJ' / bin/ bash - lic ./ load.nmr
780+ wsl - d $distribution - u root -- cd ' /tmp/dvdimageOVJ' / bin/ bash - lic " touch LocatorOff && ./load.nmr"
781781 wsl -- shutdown # reboot
782782
783783
@@ -978,66 +978,66 @@ function installController {
978978 $instU = 1 # Install flag
979979 $ubuntus = @ ((wsl - l) -replace " `0 " | Select-String Ubuntu) # -replace "`0" due to wsl UTF-16LE-encoded output
980980 $almas = @ ((wsl - l) -replace " `0 " | Select-String - Pattern " (Alma)" ) # -replace "`0" due to wsl UTF-16LE-encoded output
981- if ( $ubuntus -Or $almas ) { # 1+ Ubuntu/Alma/Oracle distributions already installed
982- $step = 0
983- $validDistros = @ ()
984- foreach ($dist in $ubuntus ) { # Remove older, unsupported Ubuntu versions from list
985- if ( $dist -match " -" ) {
986- if ((($dist -split " \." )[0 ] -replace " Ubuntu-" ) -ge $minDist ) {
987- $validDistros += $dist
988- }
981+ $step = 0
982+ $validDistros = @ ()
983+ foreach ($dist in $ubuntus ) { # Remove older, unsupported Ubuntu versions from list
984+ if ( $dist -match " -" ) {
985+ if ((($dist -split " \." )[0 ] -replace " Ubuntu-" ) -ge $minDist ) {
986+ $validDistros += $dist
989987 }
990- else {$validDistros += $dist } # Plain Ubuntu (no version label) case
991- }
992- foreach ($dist in $almas ) { # Remove older, unsupported Alma versions from list
993- if ( $dist -match " -" ) {
994- if (($dist -replace " Alma.*-" ) -ge $minAlma ) {
995- $validDistros += $dist
996- }
988+ } else {$validDistros += $dist } # Plain Ubuntu (no version label) case
989+ }
990+ foreach ($dist in $almas ) { # Remove older, unsupported Alma versions from list
991+ if ( $dist -match " -" ) {
992+ if (($dist -replace " Alma.*-" ) -ge $minAlma ) {
993+ $validDistros += $dist
997994 }
998995 }
999- $step = 0
1000- echo " "
1001- echo " ╔═════════════════════════════════════════╗"
1002- echo " ║ Select a supported distro for OpenVnmrJ ║"
1003- echo " ╚═════════════════════════════════════════╝"
1004- echo " "
1005- if ($validDistros ) {
1006- echo " Distros already present on this system"
1007- echo " -------------------------------------------"
1008- foreach ($dist in $validDistros ) {
1009- echo " [$step ] $dist "
1010- $validDistros [$step ] = $ ($dist -replace ' \(.*' ).Trim()
1011- $step ++
1012- }
1013- echo " "
1014- echo " Or install a new supported distro"
1015- } else {
1016- echo " Install a supported distro"
1017- }
1018-
996+ }
997+ $step = 0
998+ echo " "
999+ echo " ╔═════════════════════════════════════════╗"
1000+ echo " ║ Select a supported distro for OpenVnmrJ ║"
1001+ echo " ╚═════════════════════════════════════════╝"
1002+ echo " "
1003+ if ($validDistros ) {
1004+ echo " Distros already present on this system"
10191005 echo " -------------------------------------------"
1020- $notInstalled = $supportedWSL | ? {$_ -notin $validDistros }
1021- foreach ($dist in $notInstalled ) {
1006+ foreach ($dist in $validDistros ) {
10221007 echo " [$step ] $dist "
1008+ $validDistros [$step ] = $ ($dist -replace ' \(.*' ).Trim()
10231009 $step ++
10241010 }
10251011 echo " "
1026- do { # Verify number input
1027- $whichDistro = Read-Host - Prompt " Select distribution to use"
1028- if ($whichDistro -eq ' ' ) {$whichDistro = $step + 1 }
1029- $value = $whichDistro -as [Int ]
1030- $ok = $ (($value -ne $NULL ) -And ($value -lt $step ))
1031- if (-not $ok ) {Write-Host " " ; Write-Host " ! Enter digit less than $step only" }
1032- } until ($ok )
1033- if ($whichDistro -ge $validDistros.Length ) {
1034- $installDist = $notInstalled [$whichDistro - $validDistros.Length ]
1035- } else {
1036- $instU = 0 # Use an installed distribution
1037- $installDist = $validDistros [$whichDistro ]
1038- }
1012+ echo " Or install a new supported distro"
1013+ } else {
1014+ echo " Install a supported distro"
1015+ }
1016+
1017+ echo " -------------------------------------------"
1018+ $notInstalled = $supportedWSL | ? {$_ -notin $validDistros }
1019+ foreach ($dist in $notInstalled ) {
1020+ echo " [$step ] $dist "
1021+ $step ++
1022+ }
1023+ echo " "
1024+ do { # Verify number input
1025+ $whichDistro = Read-Host - Prompt " Select distribution to use"
1026+ if ($whichDistro -eq ' ' ) {$whichDistro = $step + 1 }
1027+ $value = $whichDistro -as [Int ]
1028+ $ok = $ (($value -ne $NULL ) -And ($value -lt $step ))
1029+ if (-not $ok ) {Write-Host " " ; Write-Host " ! Enter digit less than $step only" }
1030+ } until ($ok )
1031+ if ($whichDistro -ge $validDistros.Length ) {
1032+ $installDist = $notInstalled [$whichDistro - $validDistros.Length ]
1033+ } else {
1034+ $instU = 0 # Use an installed distribution
1035+ $installDist = $validDistros [$whichDistro ]
10391036 }
10401037
1038+ echo " "
1039+ $setDefault = Read-Host - Prompt " Do you want to make $installDist the default WSL distribution [y/N]?"
1040+
10411041 if ($instU ) { installUbuntu($installDist ) }
10421042 setupUbuntu($installDist )
10431043 installOVJ($installDist )
@@ -1047,6 +1047,10 @@ function installController {
10471047 echo " Restoring default WSL install version to 1"
10481048 wsl -- set-default - version 1
10491049 }
1050+ if ($setDefault -ieq " y" -Or $setDefault -ieq " yes" ) {
1051+ echo " " ;echo " Setting $installDist as the default WSL distribution"
1052+ wsl - s $installDist
1053+ }
10501054 echo " " ;echo " *** Installation Complete! ***" ;echo " "
10511055 Read-Host - Prompt " Press [Enter] to close this window"
10521056}
0 commit comments