From 7d0d044d4ccbb71c4d0b5ab7ef9d50161e26773a Mon Sep 17 00:00:00 2001 From: Kenny Yeo Date: Fri, 5 Apr 2024 20:21:17 +1100 Subject: [PATCH 1/5] fix: vagrant link --- setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.ps1 b/setup.ps1 index e7c70dc..7050ea6 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -290,7 +290,7 @@ Try { $installed_vagrant_version = vagrant --version | %{$_.split(' ')[1]} } catch {} #Write-Host Vagrant version: $installed_vagrant_version -$vagrant_url = "https://www.vagrantup.com/downloads" +$vagrant_url = "https://developer.hashicorp.com/vagrant/install" $vagrant_link = (Invoke-WebRequest -UseBasicParsing -Uri $vagrant_url).Links | Where-Object {$_.href -like "*64.msi"} $vagrant_installer_url = [System.Uri]$vagrant_link.href $vagrant_installer_filename = $vagrant_installer_url.Segments[-1] From b6c2c11f3dc61642f3979a6b21b5befdfb86c6ac Mon Sep 17 00:00:00 2001 From: Kenny Yeo Date: Fri, 5 Apr 2024 15:21:33 +0000 Subject: [PATCH 2/5] fix: initial running --- bootstrap.sh | 2 ++ setup.ps1 | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 85c34d6..3f010d4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -210,6 +210,8 @@ EOSSH $ssh "rm ~/.hushlogin" echo --------------------- +mkdir -p ~/.ssh +touch ~/.ssh/config if [ -z "$(grep -w "Host $machine_name" ~/.ssh/config)" ]; then echo Adding ssh config for $machine_name cat $SSH_CONFIG.user >> ~/.ssh/config diff --git a/setup.ps1 b/setup.ps1 index 7050ea6..0f6109d 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -148,23 +148,6 @@ if ($installed_terminal_version -And $terminal_asset.name -match $installed_term } } -# Install vagrant manager -If ($withVagrantManager) { - Write-Host --------------------------------------- - $vmanager_location1="$env:ProgramFiles (x86)\Vagrant Manager\VagrantManager.exe" - $vmanager_location2="$env:LOCALAPPDATA\Programs\Vagrant Manager\VagrantManager.exe" - If ((Test-Path $vmanager_location1) -or (Test-Path $vmanager_location2)) { - Write-Host Vagrant Manager is already installed - } else { - Write-Host Installing Vagrant Manager - $vmanager_installer = download_github_release_installer -url "https://api.github.com/repos/lanayotech/vagrant-manager-windows/releases/latest" -pattern "*.exe" - $install_args = "/SP- /SILENT /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS" - Write-Host Installing $vmanager_installer, $install_args - Start-Process -FilePath $vmanager_installer -ArgumentList $install_args - Write-Host Installed Vagrant Manager. - } -} - ###################### # Install vscode If (-Not $noVsCode) { @@ -282,6 +265,23 @@ if ($installed_vbox_version -And $installed_vbox_version -match $vbox_installer_ } } +# Install vagrant manager +If ($withVagrantManager) { + Write-Host --------------------------------------- + $vmanager_location1="$env:ProgramFiles (x86)\Vagrant Manager\VagrantManager.exe" + $vmanager_location2="$env:LOCALAPPDATA\Programs\Vagrant Manager\VagrantManager.exe" + If ((Test-Path $vmanager_location1) -or (Test-Path $vmanager_location2)) { + Write-Host Vagrant Manager is already installed + } else { + Write-Host Installing Vagrant Manager + $vmanager_installer = download_github_release_installer -url "https://api.github.com/repos/lanayotech/vagrant-manager-windows/releases/latest" -pattern "*.exe" + $install_args = "/SP- /SILENT /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS" + Write-Host Installing $vmanager_installer, $install_args + Start-Process -FilePath $vmanager_installer -ArgumentList $install_args + Write-Host Installed Vagrant Manager. + } +} + ###################### # Install vagrant If (-Not $noVagrant) { From 0feb128ed0b5faadfccf9c576b807d564368b695 Mon Sep 17 00:00:00 2001 From: Kenny Yeo Date: Fri, 5 Apr 2024 15:56:16 +0000 Subject: [PATCH 3/5] fix: add VBS guide --- setup.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.ps1 b/setup.ps1 index 0f6109d..875acbc 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -319,9 +319,13 @@ if ($installed_vagrant_version -And $installed_vagrant_version -match $vagrant_i } Write-Host ================================== -Write-Host Done. Please continue to bootstrap if ($virtualization_enabled -ne "Yes") { - Write-Host Virtualization is not enabled, please follow this link and try to enable - Write-Host https://www.smarthomebeginner.com/enable-hardware-virtualization-vt-x-amd-v/ + Write-Host Virtualization is not enabled, please use follow this link and try to disable Device Guard + Write-Host https://www.microsoft.com/en-my/download/details.aspx?id=53337 + Write-Host and run following + Write-Host ./DG_Readiness_Tool_v3.6.ps1 -Disable -AutoReboot + exit -2 } + +Write-Host Done. Please continue to bootstrap From 8ff03eacfcbf298b29d75b7d2e3efd98f5484df3 Mon Sep 17 00:00:00 2001 From: Kenny Yeo Date: Fri, 5 Apr 2024 15:59:18 +0000 Subject: [PATCH 4/5] fix: add VBS guide --- setup.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.ps1 b/setup.ps1 index 875acbc..0f0b6d9 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -322,9 +322,7 @@ Write-Host ================================== if ($virtualization_enabled -ne "Yes") { Write-Host Virtualization is not enabled, please use follow this link and try to disable Device Guard - Write-Host https://www.microsoft.com/en-my/download/details.aspx?id=53337 - Write-Host and run following - Write-Host ./DG_Readiness_Tool_v3.6.ps1 -Disable -AutoReboot + Write-Host "https://github.com/kennyhyun/linuxdev/issues/71#issuecomment-2040021521" exit -2 } From 1a55073364f4984ec2de3a74b33dbf5c29baa2a0 Mon Sep 17 00:00:00 2001 From: Kenny Yeo Date: Thu, 2 May 2024 18:05:54 +1000 Subject: [PATCH 5/5] fix: setting variable for host only ip --- bootstrap.sh | 2 +- config/env_var.sh | 2 +- destroy.sh | 9 ++++----- scripts/create_docker_certs.sh | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 3f010d4..cc16a3a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -101,7 +101,7 @@ fi ssh="ssh -F $SSH_CONFIG.root root" docker_port=${DOCKER_PORT:-2376} -ip_address=${IP_ADDRESS:-192.168.99.123} +ip_address=${__VM__IP_ADDRESS:-192.168.99.123} $ssh "touch ~/.hushlogin" if [ -z "$exists" ]; then diff --git a/config/env_var.sh b/config/env_var.sh index cf62fcc..cbe224b 100644 --- a/config/env_var.sh +++ b/config/env_var.sh @@ -1 +1 @@ -export VERSION= +export VERSION=25.0.5 diff --git a/destroy.sh b/destroy.sh index 41496f2..f356225 100755 --- a/destroy.sh +++ b/destroy.sh @@ -13,14 +13,13 @@ vagrant destroy machine_name=${NAME:-linuxdev} -vagrant status +not_created=$(vagrant status | grep 'not created') -exitCode=$? -if [[ $exitCode != 0 ]];then +if [ -n "$not_created" ];then echo the VM is not exists any more, removing configs + rm -f status mkdir -p backup - mv ssh.config* backup/ + mv ssh.config* backup/ 2> /dev/null rm -rf ~/.docker/certs.$machine_name - exit $exitCode fi diff --git a/scripts/create_docker_certs.sh b/scripts/create_docker_certs.sh index 48bbe36..f8af0e8 100755 --- a/scripts/create_docker_certs.sh +++ b/scripts/create_docker_certs.sh @@ -8,7 +8,7 @@ fi # https://docs.docker.com/engine/security/protect-access/ -local_ip_addr=192.168.99.123 +local_ip_addr=${IP_ADDRESS:-192.168.99.123} common_name=$local_ip_addr passphrase=pass:passwd