From 9ee3af1afbb78333a74788ae1642ef539e2b80df Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 18 Nov 2020 16:42:07 -0700 Subject: [PATCH] cleanup: use -Force making directories --- _example/install.ps1 | 6 +++--- _webi/bootstrap.ps1 | 2 +- _webi/template.ps1 | 6 +++--- _webi/webi.ps1 | 16 ++++++---------- dotenv/install.ps1 | 2 +- ffmpeg/install.ps1 | 1 + fzf/install.sh | 2 +- gitdeploy/install.ps1 | 2 +- goreleaser/install.ps1 | 4 ++-- keypairs/install.ps1 | 2 +- watchexec/install.ps1 | 6 +++--- wsl.bak/install.ps1 | 15 +++++++++++++++ 12 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 ffmpeg/install.ps1 create mode 100644 wsl.bak/install.ps1 diff --git a/_example/install.ps1 b/_example/install.ps1 index e99cf7f..9f08cd2 100644 --- a/_example/install.ps1 +++ b/_example/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\foobar-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\foo.exe" -Recurse -ErrorAction Ignore @@ -46,10 +46,10 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\foobar-*\foo.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/_webi/bootstrap.ps1 b/_webi/bootstrap.ps1 index f707248..0060fab 100644 --- a/_webi/bootstrap.ps1 +++ b/_webi/bootstrap.ps1 @@ -1,5 +1,5 @@ # Download the latest webi, then install {{ exename }} -IF (!(Test-Path -Path .local\bin)) { New-Item -Path .local\bin -ItemType Directory } +New-Item -Path .local\bin -ItemType Directory -Force IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" } curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/_webi/webi.ps1" -o "$Env:USERPROFILE\.local\bin\webi.ps1" Set-ExecutionPolicy -Scope Process Bypass diff --git a/_webi/template.ps1 b/_webi/template.ps1 index 6ddd2fc..121eea0 100644 --- a/_webi/template.ps1 +++ b/_webi/template.ps1 @@ -24,15 +24,15 @@ pushd $Env:USERPROFILE # Make paths if needed if (!(Test-Path -Path Downloads)) { - New-Item -Path Downloads -ItemType Directory + New-Item -Path Downloads -ItemType Directory -Force } if (!(Test-Path -Path .local\bin)) { - New-Item -Path .local\bin -ItemType Directory + New-Item -Path .local\bin -ItemType Directory -Force } if (!(Test-Path -Path .local\opt)) { - New-Item -Path .local\opt -ItemType Directory + New-Item -Path .local\opt -ItemType Directory -Force } # {{ baseurl }} diff --git a/_webi/webi.ps1 b/_webi/webi.ps1 index dd7ac94..3a2b9c6 100644 --- a/_webi/webi.ps1 +++ b/_webi/webi.ps1 @@ -25,24 +25,20 @@ $exename = $args[0] pushd $Env:USERPROFILE # Make paths if needed -if (!(Test-Path -Path .local\bin)) -{ - New-Item -Path .local\bin -ItemType Directory -} -if (!(Test-Path -Path .local\xbin)) -{ - New-Item -Path .local\xbin -ItemType Directory -} +New-Item -Path .local\bin -ItemType Directory -Force +# TODO replace all xbin with opt\bin\ +New-Item -Path .local\xbin -ItemType Directory -Force + # See note on Set-ExecutionPolicy above Set-Content -Path .local\bin\webi.bat -Value "@echo off`r`npushd %USERPROFILE%`r`npowershell -ExecutionPolicy Bypass .local\bin\webi.ps1 %1`r`npopd" if (!(Test-Path -Path .local\opt)) { - New-Item -Path .local\opt -ItemType Directory + New-Item -Path .local\opt -ItemType Directory -Force } # TODO windows version of mktemp -d if (!(Test-Path -Path .local\tmp)) { - New-Item -Path .local\tmp -ItemType Directory + New-Item -Path .local\tmp -ItemType Directory -Force } # TODO SetStrictMode diff --git a/dotenv/install.ps1 b/dotenv/install.ps1 index 62d57ed..fb533d9 100644 --- a/dotenv/install.ps1 +++ b/dotenv/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\dotenv.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/ffmpeg/install.ps1 b/ffmpeg/install.ps1 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ffmpeg/install.ps1 @@ -0,0 +1 @@ + diff --git a/fzf/install.sh b/fzf/install.sh index 392fe8c..908001c 100644 --- a/fzf/install.sh +++ b/fzf/install.sh @@ -19,7 +19,7 @@ } pkg_install() { - # $HOME/.local/xbin + # $HOME/.local/bin mkdir -p "$pkg_src_bin" # mv ./fzf* "$HOME/.local/opt/fzf-v0.21.1/bin/fzf" diff --git a/gitdeploy/install.ps1 b/gitdeploy/install.ps1 index 5d9d232..ebab831 100644 --- a/gitdeploy/install.ps1 +++ b/gitdeploy/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\gitdeploy.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/goreleaser/install.ps1 b/goreleaser/install.ps1 index 08f4716..68644cb 100644 --- a/goreleaser/install.ps1 +++ b/goreleaser/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\goreleaser-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\goreleaser.exe" -Recurse -ErrorAction Ignore @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\goreleaser.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/keypairs/install.ps1 b/keypairs/install.ps1 index 0a5f9cf..fcfa2b1 100644 --- a/keypairs/install.ps1 +++ b/keypairs/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\keypairs.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/watchexec/install.ps1 b/watchexec/install.ps1 index 7e53bb5..3825abd 100644 --- a/watchexec/install.ps1 +++ b/watchexec/install.ps1 @@ -34,16 +34,16 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\watchexec-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\watchexec.exe" -Recurse -ErrorAction Ignore echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path ".\watchexec-*\watchexec.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/wsl.bak/install.ps1 b/wsl.bak/install.ps1 new file mode 100644 index 0000000..23c3ba9 --- /dev/null +++ b/wsl.bak/install.ps1 @@ -0,0 +1,15 @@ +#!/usr/bin/env pwsh + +curl.exe -s "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi" -o "$Env:USERPROFILE\Downloads\wsl_update_x64.msi" +msiexec /a "$Env:USERPROFILE\Downloads\wsl_update_x64.msi" /qb TARGETDIR="C:\temp" +copy C:\temp\System32\lxss\tools\kernel C:\Windows\System32\lxss\tools\ + +dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart +dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart + +Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux + +wsl --set-default-version 2 + +# TODO +#Set-VMProcessor -VMName -ExposeVirtualizationExtensions $true -- 2.25.1