From 01c38477326898e2462b6d0e2eee4cae0f6b2007 Mon Sep 17 00:00:00 2001 From: Yosef Durr Date: Tue, 11 Sep 2018 14:35:18 -0700 Subject: [PATCH] updating all recipes to use dynamic helper script loading (#69) --- README.md | 8 +++++--- dev_app.ps1 | 21 +++++++++++++-------- dev_ml_windows.ps1 | 19 ++++++++++++------- dev_ml_wsl.ps1 | 4 ---- dev_web.ps1 | 21 +++++++++++++-------- dev_web_nodejs.ps1 | 19 ++++++++++++------- 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 6688574..eb98ab0 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ A recipe is the script you run. It calls multiple helper scripts. These curren **Helper Scripts**: A helper script performs setup routines that may be useful by many recipes. Recipes call helper scripts (you don't run helper scripts directly). The helper scripts live in the **scripts** folder - ## You may want to customize the scripts These scripts should cover a lot of what you need but will not likely match your personal preferences exactly. In this case please fork the project and change the scripts however you desire. We really appreciate PR's back to this project if you have recommended changes. @@ -45,10 +44,13 @@ To run a recipe script, click a link in the table below from your target machine | | More Coming Soon! | **Notes:** -ยน If you're a Node.js contributor working on Node.js core, please see the [Node.js Bootstrapping Guide](https://github.com/nodejs/node/tree/master/tools/bootstrap) or [click here to run](http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter). +1. If you are using WSL there's a followup step we recommend after running the setup script. When the script finishes you will only have a root user with a blank password. You should manually create a non-root user via `$ sudo adduser [USERNAME] sudo` +with a non-blank password. Use this user going forward. For more info on WSL please refer to the [documentation](https://docs.microsoft.com/en-us/windows/wsl/about). +2. If you're a Node.js contributor working on Node.js core, please see the [Node.js Bootstrapping Guide](https://github.com/nodejs/node/tree/master/tools/bootstrap) or [click here to run](http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter). ## Known issues -- Windows 1803 is not successfully launching Boxstarter via the web launcher. This is actively under investigation and there are workarounds such as running Boxstarter locally. See this issue for details: https://github.com/chocolatey/boxstarter/issues/301 +- Reboot is not always logging you back in to resume the script. This is being tracked [here](https://github.com/chocolatey/boxstarter/issues/318). If you experience this please login manually and the script will continue running. +- There have been reports of Windows 1803 not successfully launching Boxstarter via the web launcher. See this issue for details: https://github.com/chocolatey/boxstarter/issues/301 ## Working with Chocolatey in an organization? As an organization, you may not be keen to reach out to the internet. That's fine as with just a few modifications you can still take advantage of these scripts. Visit the [organizational use page](ORGANIZATION.md) to learn how. diff --git a/dev_app.ps1 b/dev_app.ps1 index f5e8b54..2f77c99 100644 --- a/dev_app.ps1 +++ b/dev_app.ps1 @@ -4,16 +4,21 @@ Disable-UAC -# see if we can't get calling URL somehow, that would eliminate this need -# should move to a config file -$user = "Microsoft"; -$baseBranch = "master"; -$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts"; +# Get the base URI path from the ScriptToCall value +$bstrappackage = "-bootstrapPackage" +$helperUri = $Boxstarter['ScriptToCall'] +$strpos = $helperUri.IndexOf($bstrappackage) +$helperUri = $helperUri.Substring($strpos + $bstrappackage.Length) +$helperUri = $helperUri.TrimStart("'", " ") +$helperUri = $helperUri.TrimEnd("'", " ") +$helperUri = $helperUri.Substring(0, $helperUri.LastIndexOf("/")) +$helperUri += "/scripts" +write-host "helper script base URI is $helperUri" function executeScript { - Param ([string]$script) - write-host "executing $finalBaseHelperUri/$script ..." - iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script")) + Param ([string]$script) + write-host "executing $helperUri/$script ..." + iex ((new-object net.webclient).DownloadString("$helperUri/$script")) } #--- Setting up Windows --- diff --git a/dev_ml_windows.ps1 b/dev_ml_windows.ps1 index 469282a..32997d5 100644 --- a/dev_ml_windows.ps1 +++ b/dev_ml_windows.ps1 @@ -4,16 +4,21 @@ Disable-UAC -# see if we can't get calling URL somehow, that would eliminate this need -# should move to a config file -$user = "Microsoft"; -$baseBranch = "MLSamples"; -$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts"; +# Get the base URI path from the ScriptToCall value +$bstrappackage = "-bootstrapPackage" +$helperUri = $Boxstarter['ScriptToCall'] +$strpos = $helperUri.IndexOf($bstrappackage) +$helperUri = $helperUri.Substring($strpos + $bstrappackage.Length) +$helperUri = $helperUri.TrimStart("'", " ") +$helperUri = $helperUri.TrimEnd("'", " ") +$helperUri = $helperUri.Substring(0, $helperUri.LastIndexOf("/")) +$helperUri += "/scripts" +write-host "helper script base URI is $helperUri" function executeScript { Param ([string]$script) - write-host "executing $finalBaseHelperUri/$script ..." - iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script")) + write-host "executing $helperUri/$script ..." + iex ((new-object net.webclient).DownloadString("$helperUri/$script")) } #--- Setting up Windows --- diff --git a/dev_ml_wsl.ps1 b/dev_ml_wsl.ps1 index 53d3e43..9526a05 100644 --- a/dev_ml_wsl.ps1 +++ b/dev_ml_wsl.ps1 @@ -6,11 +6,7 @@ Disable-UAC # Get the base URI path from the ScriptToCall value $bstrappackage = "-bootstrapPackage" -$Boxstarter | Foreach-Object { write-host "The key name is $_.Key and value is $_.Value" } - $helperUri = $Boxstarter['ScriptToCall'] -write-host "ScriptToCall is $helperUri" - $strpos = $helperUri.IndexOf($bstrappackage) $helperUri = $helperUri.Substring($strpos + $bstrappackage.Length) $helperUri = $helperUri.TrimStart("'", " ") diff --git a/dev_web.ps1 b/dev_web.ps1 index ec84da9..630eb18 100644 --- a/dev_web.ps1 +++ b/dev_web.ps1 @@ -4,18 +4,23 @@ Disable-UAC +# Get the base URI path from the ScriptToCall value +$bstrappackage = "-bootstrapPackage" +$helperUri = $Boxstarter['ScriptToCall'] +$strpos = $helperUri.IndexOf($bstrappackage) +$helperUri = $helperUri.Substring($strpos + $bstrappackage.Length) +$helperUri = $helperUri.TrimStart("'", " ") +$helperUri = $helperUri.TrimEnd("'", " ") +$helperUri = $helperUri.Substring(0, $helperUri.LastIndexOf("/")) +$helperUri += "/scripts" +write-host "helper script base URI is $helperUri" + function executeScript { Param ([string]$script) - write-host "executing $finalBaseHelperUri/$script ..." - iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script")) + write-host "executing $helperUri/$script ..." + iex ((new-object net.webclient).DownloadString("$helperUri/$script")) } -# see if we can't get calling URL somehow, that would eliminate this need -# should move to a config file -$user = "Microsoft"; -$baseBranch = "master"; -$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts"; - #--- Setting up Windows --- executeScript "FileExplorerSettings.ps1"; executeScript "SystemConfiguration.ps1"; diff --git a/dev_web_nodejs.ps1 b/dev_web_nodejs.ps1 index 12c1081..bfe60a9 100644 --- a/dev_web_nodejs.ps1 +++ b/dev_web_nodejs.ps1 @@ -4,16 +4,21 @@ Disable-UAC -# see if we can't get calling URL somehow, that would eliminate this need -# should move to a config file -$user = "Microsoft"; -$baseBranch = "master"; -$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts"; +# Get the base URI path from the ScriptToCall value +$bstrappackage = "-bootstrapPackage" +$helperUri = $Boxstarter['ScriptToCall'] +$strpos = $helperUri.IndexOf($bstrappackage) +$helperUri = $helperUri.Substring($strpos + $bstrappackage.Length) +$helperUri = $helperUri.TrimStart("'", " ") +$helperUri = $helperUri.TrimEnd("'", " ") +$helperUri = $helperUri.Substring(0, $helperUri.LastIndexOf("/")) +$helperUri += "/scripts" +write-host "helper script base URI is $helperUri" function executeScript { Param ([string]$script) - write-host "executing $finalBaseHelperUri/$script ..." - iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script")) + write-host "executing $helperUri/$script ..." + iex ((new-object net.webclient).DownloadString("$helperUri/$script")) } #--- Setting up Windows ---