@florianpat/lando-core 3.23.3-compose → 3.23.22-test1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +117 -1
  2. package/_redirects +1 -0
  3. package/bin/lando +2 -0
  4. package/bin/lando.cmd +3 -0
  5. package/builders/_lando.js +2 -1
  6. package/checksums.txt +0 -0
  7. package/components/l337-v4.js +2 -2
  8. package/components/plugin.js +1 -1
  9. package/config.yml +3 -2
  10. package/hooks/app-run-events.js +22 -0
  11. package/hooks/lando-autostart-engine.js +4 -25
  12. package/hooks/lando-run-setup.js +58 -0
  13. package/hooks/lando-setup-build-engine-darwin.js +13 -12
  14. package/hooks/lando-setup-build-engine-linux.js +14 -4
  15. package/hooks/lando-setup-build-engine-win32.js +27 -20
  16. package/hooks/lando-setup-build-engine-wsl.js +210 -0
  17. package/hooks/lando-setup-check.js +19 -0
  18. package/hooks/lando-setup-create-ca-wsl.js +34 -0
  19. package/hooks/lando-setup-create-ca.js +22 -23
  20. package/hooks/lando-setup-install-ca-darwin.js +5 -1
  21. package/hooks/lando-setup-install-ca-linux.js +4 -1
  22. package/hooks/lando-setup-install-ca-win32.js +5 -1
  23. package/hooks/lando-setup-install-ca-wsl.js +145 -0
  24. package/hooks/lando-setup-orchestrator.js +4 -4
  25. package/index.js +18 -12
  26. package/lib/app.js +2 -2
  27. package/lib/art.js +20 -8
  28. package/lib/compose.js +0 -3
  29. package/lib/daemon.js +79 -76
  30. package/lib/docker.js +2 -2
  31. package/lib/engine.js +10 -3
  32. package/lib/lando.js +2 -2
  33. package/lib/metrics.js +5 -3
  34. package/lib/router.js +1 -1
  35. package/lib/updates.js +18 -3
  36. package/netlify.toml +1 -6
  37. package/node_modules/cross-spawn/README.md +3 -10
  38. package/node_modules/cross-spawn/lib/enoent.js +1 -1
  39. package/node_modules/cross-spawn/lib/util/escape.js +4 -2
  40. package/node_modules/cross-spawn/package.json +1 -1
  41. package/node_modules/nanoid/.devcontainer.json +23 -0
  42. package/node_modules/nanoid/README.md +517 -2
  43. package/node_modules/nanoid/async/index.browser.cjs +37 -2
  44. package/node_modules/nanoid/async/index.browser.js +37 -2
  45. package/node_modules/nanoid/async/index.cjs +38 -2
  46. package/node_modules/nanoid/async/index.js +38 -2
  47. package/node_modules/nanoid/async/index.native.js +33 -2
  48. package/node_modules/nanoid/index.browser.cjs +39 -1
  49. package/node_modules/nanoid/index.browser.js +39 -1
  50. package/node_modules/nanoid/index.cjs +42 -2
  51. package/node_modules/nanoid/index.js +42 -2
  52. package/node_modules/nanoid/non-secure/index.cjs +15 -2
  53. package/node_modules/nanoid/non-secure/index.js +15 -2
  54. package/node_modules/nanoid/package.json +1 -1
  55. package/node_modules/nanoid/url-alphabet/index.cjs +4 -0
  56. package/node_modules/nanoid/url-alphabet/index.js +4 -0
  57. package/package.json +9 -8
  58. package/plugins/networking/app.js +4 -2
  59. package/plugins/networking/index.js +19 -6
  60. package/plugins/proxy/builders/_proxy.js +1 -2
  61. package/release-aliases/3-EDGE +1 -1
  62. package/release-aliases/3-STABLE +1 -1
  63. package/renderers/dc2.js +2 -1
  64. package/scripts/add-to-group.sh +72 -0
  65. package/scripts/docker-engine-start.sh +15 -1
  66. package/scripts/generate-checksums.sh +2 -2
  67. package/scripts/install-docker-desktop.ps1 +11 -12
  68. package/scripts/install-system-ca-win32.ps1 +14 -14
  69. package/scripts/lando-entrypoint.sh +4 -0
  70. package/scripts/run-elevated.ps1 +2 -2
  71. package/scripts/semcompare.sh +142 -0
  72. package/scripts/wait-for-user.sh +1 -2
  73. package/tasks/destroy.js +3 -0
  74. package/tasks/info.js +2 -1
  75. package/tasks/init.js +35 -30
  76. package/tasks/rebuild.js +2 -8
  77. package/tasks/restart.js +2 -8
  78. package/tasks/setup.js +2 -2
  79. package/tasks/shellenv.js +2 -2
  80. package/tasks/start.js +2 -8
  81. package/tasks/stop.js +3 -0
  82. package/utils/build-config.js +2 -0
  83. package/utils/build-tooling-runner.js +2 -1
  84. package/utils/get-app.js +1 -1
  85. package/utils/get-bin-paths.js +2 -2
  86. package/utils/get-compose-x.js +1 -1
  87. package/utils/get-config-defaults.js +12 -7
  88. package/utils/get-docker-bin-path.js +6 -2
  89. package/utils/get-docker-desktop-x.js +21 -0
  90. package/utils/get-docker-x.js +3 -2
  91. package/utils/get-shellenv.js +1 -2
  92. package/utils/get-system-cas.js +25 -6
  93. package/utils/get-win32-envvar-from-wsl.js +7 -0
  94. package/utils/is-admin-user.js +9 -8
  95. package/utils/is-group-member.js +14 -7
  96. package/utils/is-wsl-interop.js +17 -4
  97. package/utils/run-elevated.js +9 -0
  98. package/utils/run-powershell-script.js +31 -5
  99. package/utils/run-tasks.js +3 -2
  100. package/utils/setup-metrics.js +10 -1
  101. package/utils/shutdown-os.js +8 -3
  102. package/utils/spawn-sync-stringer.js +1 -0
  103. package/utils/update-shell-profile.js +8 -7
  104. package/utils/validate-ca.js +31 -0
  105. package/utils/winpath-2-wslpath.js +6 -0
  106. package/utils/wslpath-2-winpath.js +6 -0
  107. package/hooks/lando-dep-check.js +0 -26
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@florianpat/lando-core",
3
3
  "description": "The libraries that power all of Lando. Fork by flo for compose integration",
4
- "version": "3.23.3-compose",
4
+ "version": "3.23.22-test1",
5
5
  "author": "Florian Patruck @florianPat",
6
6
  "license": "GPL-3.0",
7
7
  "repository": "florianPat/lando-core",
@@ -46,7 +46,7 @@
46
46
  "docs:preview": "vitepress preview docs",
47
47
  "docs:rename-sitemap": "node docs/.vitepress/rename-sitemap.js",
48
48
  "lint": "eslint . --ext .js --ext .mjs ",
49
- "pkg": "pkg --config package.json --targets node20 --options 'dns-result-order=ipv4first' bin/lando",
49
+ "pkg": "pkg --config package.json --output dist/lando ---targets node20 --options 'dns-result-order=ipv4first' bin/lando",
50
50
  "test:unit": "nyc --reporter=html --reporter=text mocha --timeout 5000 test/**/*.spec.js",
51
51
  "test:leia": "leia \"examples/**/README.md\" -c 'Destroy tests' --stdin",
52
52
  "test": "npm run lint && npm run test:unit"
@@ -168,7 +168,7 @@
168
168
  "devDependencies": {
169
169
  "@babel/eslint-parser": "^7.16.0",
170
170
  "@lando/leia": "^1.0.0-beta.4",
171
- "@lando/vitepress-theme-default-plus": "^1.1.0-beta.18",
171
+ "@lando/vitepress-theme-default-plus": "github:lando/vitepress-theme-default-plus#main",
172
172
  "@yao-pkg/pkg": "^5.16.1",
173
173
  "chai": "^4.3.4",
174
174
  "chai-as-promised": "^7.1.1",
@@ -181,7 +181,8 @@
181
181
  "nyc": "^15.1.0",
182
182
  "sinon": "^4.3.0",
183
183
  "sinon-chai": "^2.14.0",
184
- "vitepress": "^1.4.2"
184
+ "ua-parser-js": "^1.0.39",
185
+ "vitepress": "^1.5.0"
185
186
  },
186
187
  "bundledDependencies": [
187
188
  "@lando/argv",
@@ -246,9 +247,9 @@
246
247
  "yargs-parser"
247
248
  ],
248
249
  "dist": {
249
- "integrity": "sha512-ymB8zI/RdDsMJ8V0+gcBCWAteGdWjEeP3zOLe7jsxIAFLsLazgzLdiwDp5i/H6d4JKlUgWax/APXyfQTpI7Mgg==",
250
- "shasum": "94c9d63acec21f3e92e932716c9bd4a44f9082bd",
251
- "filename": "florianpat-lando-core-3.23.3-compose.tgz",
252
- "unpackedSize": 60879409
250
+ "integrity": "sha512-h72uRffHk6XuEegs2pNU8qc1+jL8m0KE2jre+r8SEe7nCZH4ThEfay5XTj60VwrsAqen4YuqZaMgHXbY6kF3nw==",
251
+ "shasum": "9007ee7ef574b78df997a031740b1685f0420ec6",
252
+ "filename": "florianpat-lando-core-3.23.22-test1.tgz",
253
+ "unpackedSize": 60947194
253
254
  }
254
255
  }
@@ -22,7 +22,8 @@ module.exports = (app, lando) => {
22
22
  return landonet.disconnect({Container: container.id, Force: true})
23
23
  // Only throw non not connected errors
24
24
  .catch(error => {
25
- if (!_.includes(error.message, 'is not connected to network')) throw error;
25
+ if (!_.includes(error.message, 'is not connected to network') &&
26
+ !_.includes(error.message, 'is not connected to the network')) throw error;
26
27
  })
27
28
  // Connect
28
29
  .then(() => {
@@ -67,7 +68,8 @@ module.exports = (app, lando) => {
67
68
  return bridgeNet.disconnect({Container: proxyContainer, Force: true})
68
69
  // Only throw non not connected errors
69
70
  .catch(error => {
70
- if (!_.includes(error.message, 'is not connected to network')) throw error;
71
+ if (!_.includes(error.message, 'is not connected to network') &&
72
+ !_.includes(error.message, 'is not connected to the network')) throw error;
71
73
  })
72
74
  // Connect
73
75
  .then(() => {
@@ -2,13 +2,15 @@
2
2
 
3
3
  // Modules
4
4
  const _ = require('lodash');
5
+ const fs = require('fs');
6
+ const getDockerDesktopBin = require('../../utils/get-docker-desktop-x');
5
7
 
6
8
  /*
7
9
  * Helper to clean out any old networks when we hit the limit
8
10
  */
9
11
  const cleanNetworks = lando => lando.engine.getNetworks()
10
12
  .then(networks => {
11
- if (_.size(networks) >= 32) {
13
+ if (_.size(networks) >= lando.config.networkLimit) {
12
14
  // Warn user about this action
13
15
  lando.log.warn('Lando has detected you are at Docker\'s network limit!');
14
16
  lando.log.warn('Give us a moment as we try to make space by cleaning up old networks...');
@@ -53,26 +55,37 @@ module.exports = lando => {
53
55
  // skip the installation of the network if set
54
56
  if (options.skipNetworking) return;
55
57
 
58
+ // we need access to dat socket for this to work
59
+ const dependsOn = ['linux', 'wsl']
60
+ .includes(lando.config.os.landoPlatform) ? ['setup-build-engine-group', 'setup-build-engine'] : ['setup-build-engine'];
61
+
56
62
  options.tasks.push({
57
63
  title: `Creating Landonet`,
58
64
  id: 'create-landonet',
59
- dependsOn: ['setup-build-engine'],
65
+ dependsOn,
60
66
  description: '@lando/landonet',
61
67
  comments: {
62
- 'NOT INSTALLED': 'Will create Landonet',
68
+ 'NOT INSTALLED': 'Will create LandoNet',
69
+ },
70
+ skip: () => {
71
+ if (!['linux', 'wsl'].includes(lando.config.os.landoPlatform)) return false;
72
+ return !require('../../utils/is-group-member')('docker');
63
73
  },
64
74
  hasRun: async () => {
65
75
  // if docker isnt even installed then this is easy
66
76
  if (lando.engine.dockerInstalled === false) return false;
67
77
 
78
+ // we also want to do an additional check on docker-destkop
79
+ if (lando.config.os.landoPlatform !== 'linux' && !fs.existsSync(getDockerDesktopBin())) return false;
80
+
68
81
  // otherwise attempt to sus things out
69
82
  try {
83
+ await lando.engine.daemon.up({max: 10, backoff: 1000});
70
84
  const landonet = lando.engine.getNetwork(lando.config.networkBridge);
71
- await lando.engine.daemon.up();
72
85
  await landonet.inspect();
73
86
  return lando.versions.networking > 1;
74
87
  } catch (error) {
75
- debug('looks like there isnt a landonet yet %o %o', error.message, error.stack);
88
+ debug('looks like there isnt a landonet yet %o %o', error?.message, error?.stack);
76
89
  return false;
77
90
  }
78
91
  },
@@ -82,7 +95,7 @@ module.exports = lando => {
82
95
  const daemon = new LandoDaemon(lando.cache, lando.events, undefined, lando.log);
83
96
 
84
97
  // we need docker up for this
85
- await daemon.up();
98
+ await daemon.up({max: 5, backoff: 1000});
86
99
 
87
100
  // if we are v1 then disconnect and remove for upgrade
88
101
  if (lando.versions.networking === 1) {
@@ -17,7 +17,7 @@ const getProxy = ({
17
17
  return {
18
18
  services: {
19
19
  proxy: {
20
- image: 'traefik:2.10.7',
20
+ image: 'traefik:2.11.16',
21
21
  command: proxyCommand.join(' '),
22
22
  environment: {
23
23
  LANDO_APP_PROJECT: '_lando_',
@@ -25,7 +25,6 @@ const getProxy = ({
25
25
  LANDO_PROXY_CONFIG_FILE: '/proxy_config/proxy.yaml',
26
26
  LANDO_PROXY_PASSTHRU: _.toString(proxyPassThru),
27
27
  LANDO_VERSION: version,
28
- LANDO_DOMAIN: proxyDomain,
29
28
  },
30
29
  networks: ['edge'],
31
30
  volumes: [
@@ -1 +1 @@
1
- v3.23.3
1
+ v3.24.0-beta.8
@@ -1 +1 @@
1
- v3.23.3
1
+ v3.23.22
package/renderers/dc2.js CHANGED
@@ -36,8 +36,9 @@ class DC2Renderer extends LandoRenderer {
36
36
  options.states = {
37
37
  COMPLETED: {message: 'Done', color: 'green'},
38
38
  FAILED: {message: 'ERROR', color: 'red'},
39
+ SKIPPED: {message: 'Deferred', color: 'gray'},
39
40
  STARTED: {message: 'Waiting', color: 'green'},
40
- WAITING: {message: 'Waiting', color: 'yellow'},
41
+ WAITING: {message: 'Waiting', color: 'gray'},
41
42
  ...options.states,
42
43
  };
43
44
 
@@ -0,0 +1,72 @@
1
+ #!/bin/bash
2
+ set -eo pipefail
3
+
4
+ DEBUG=0
5
+ GROUP=""
6
+ USER=""
7
+
8
+ chomp() {
9
+ printf "%s" "${1%$'\n'}"
10
+ }
11
+
12
+ abort() {
13
+ printf "ERROR: %s\n" "$(chomp "$1")" >&2
14
+ exit 1
15
+ }
16
+
17
+ debug() {
18
+ if [ "${DEBUG}" == 1 ]; then printf '%s\n' "$1" >&2; fi
19
+ }
20
+
21
+ # PARSE THE ARGZZ
22
+ while (( "$#" )); do
23
+ case "$1" in
24
+ --debug)
25
+ DEBUG=1
26
+ shift
27
+ ;;
28
+ --group)
29
+ GROUP="$2"
30
+ shift 2
31
+ ;;
32
+ --group=*)
33
+ GROUP="${1#*=}"
34
+ shift
35
+ ;;
36
+ --user)
37
+ USER="$2"
38
+ shift 2
39
+ ;;
40
+ --user=*)
41
+ USER="${1#*=}"
42
+ shift
43
+ ;;
44
+ --)
45
+ shift
46
+ break
47
+ ;;
48
+ -*|--*=)
49
+ shift
50
+ ;;
51
+ *)
52
+ shift
53
+ ;;
54
+ esac
55
+ done
56
+
57
+ # Check that both --group and --user were provided
58
+ if [ -z "$GROUP" ] || [ -z "$USER" ]; then
59
+ abort "Usage: $0 --group GROUPNAME --user USERNAME"
60
+ fi
61
+
62
+ # Check if the group exists, create if not
63
+ if ! getent group "$GROUP" > /dev/null 2>&1; then
64
+ debug "Group '$GROUP' does not exist. Creating..."
65
+ groupadd "$GROUP" || { abort "Failed to create group."; }
66
+ fi
67
+
68
+ # Add the user to the group
69
+ debug "Adding user '$USER' to group '$GROUP'..."
70
+ usermod -aG "$GROUP" "$USER" || { abort "Failed to add user to group."; }
71
+
72
+ echo "User '$USER' successfully added to group '$GROUP'."
@@ -1,4 +1,18 @@
1
1
  #!/bin/sh
2
2
  set -e
3
3
 
4
- systemctl start docker.service || service docker start
4
+ # Function to check if a Polkit agent is running
5
+ is_polkit_agent_running() {
6
+ ps aux | grep -q "[p]olkit" && return 0 || return 1
7
+ }
8
+
9
+ # Check if the DISPLAY or XDG_SESSION_TYPE indicates a desktop environment
10
+ if [ -n "$DISPLAY" ] || [ "$XDG_SESSION_TYPE" = "x11" ] || [ "$XDG_SESSION_TYPE" = "wayland" ]; then
11
+ if is_polkit_agent_running; then
12
+ systemctl start docker.service || service docker start
13
+ else
14
+ sudo systemctl start docker.service || sudo service docker start
15
+ fi
16
+ else
17
+ sudo systemctl start docker.service || sudo service docker start
18
+ fi
@@ -72,9 +72,9 @@ debug ""
72
72
  > "$OUTPUT_FILE"
73
73
 
74
74
  # Loop through each file in the directory with specified depth
75
- find "$DIRECTORY" -maxdepth "$DEPTH" -type f | while read -r file; do
75
+ find "$DIRECTORY" -maxdepth "$DEPTH" -type f | sort | while read -r file; do
76
76
  # Calculate the SHA-256 checksum and append to the output file
77
- sha256sum "$file" >> "$OUTPUT_FILE"
77
+ sha256sum "${file#./}" >> "$OUTPUT_FILE"
78
78
  # debug
79
79
  debug "wrote checksum $(sha256sum "$file") to ${OUTPUT_FILE}"
80
80
  done
@@ -1,11 +1,10 @@
1
1
  #!/
2
2
 
3
3
  # handle params
4
- # @NOTE: we omit DEBUG as a param because its "built in"
5
4
  [CmdletBinding(PositionalBinding=$false)]
6
5
  Param(
7
- [string]$installer,
8
- [switch]$acceptlicense = $false
6
+ [string]$Installer,
7
+ [switch]$AcceptLicense = $false
9
8
  )
10
9
 
11
10
  # error handling
@@ -19,28 +18,28 @@ trap {
19
18
 
20
19
  # enable debugging if debug is true
21
20
  $DebugPreference = If ($DebugPreference -eq "Inquire") {"Continue"} Else {"SilentlyContinue"}
22
- $debug = If ($DebugPreference -eq "Continue") {$true} Else {$false}
21
+ $Debug = If ($DebugPreference -eq "Continue") {$true} Else {$false}
23
22
  Write-Debug "running script with:"
24
- Write-Debug "INSTALLER: $installer"
25
- Write-Debug "ACCEPT LICENSE: $acceptlicense"
26
- Write-Debug "DEBUG: $debug"
23
+ Write-Debug "INSTALLER: $Installer"
24
+ Write-Debug "ACCEPT LICENSE: $AcceptLicense"
25
+ Write-Debug "DEBUG: $Debug"
27
26
 
28
27
  # validation
29
28
  # @TODO: check if installer exists on fs?
30
- if ([string]::IsNullOrEmpty($installer)) {
29
+ if ([string]::IsNullOrEmpty($Installer)) {
31
30
  throw "You must pass in an -Installer!"
32
31
  }
33
32
 
34
33
  # Start arg stuff
35
34
  $options = "--backend=wsl-2"
36
35
  # if debug mode is off then make the installer quiet
37
- if ($debug -eq $false) {$options = "$options --quiet"}
36
+ if ($Debug -eq $false) {$options = "$options --quiet"}
38
37
  # if accept license is true then add that as well
39
- if ($acceptlicense -eq $true) {$options = "$options --accept-license"}
38
+ if ($AcceptLicense -eq $true) {$options = "$options --accept-license"}
40
39
 
41
40
  # Install
42
- Write-Debug "Running $installer with 'install $options'"
43
- $p = Start-Process -FilePath "$installer" -ArgumentList "install $options" -Wait -PassThru
41
+ Write-Debug "Running $Installer with 'install $options'"
42
+ $p = Start-Process -FilePath "$Installer" -ArgumentList "install $options" -Wait -PassThru
44
43
  Write-Debug "Process finished with return code: $($p.ExitCode)"
45
44
 
46
45
  # If there is an error then throw here
@@ -1,14 +1,14 @@
1
1
  #!/
2
2
 
3
3
  # handle params
4
- # @NOTE: we omit DEBUG as a param because its "built in"
5
4
  [CmdletBinding(PositionalBinding=$false)]
6
5
  Param(
7
- [string]$ca,
8
- [switch]$noninteractive = $false
6
+ [string]$Ca,
7
+ [switch]$NonInteractive = $env:LANDO_NONINTERACTIVE -or $env:NONINTERACTIVE -or $false
9
8
  )
10
9
 
11
- # error handling
10
+ # Stop execution of this script if any cmdlet fails.
11
+ # We'll still need to check exit codes on any exe we run.
12
12
  $ErrorActionPreference = "Stop"
13
13
 
14
14
  # handle uncaught errorz
@@ -18,30 +18,30 @@ trap {
18
18
  }
19
19
 
20
20
  # validation
21
- # @TODO: check if installer exists on fs?
22
- if ([string]::IsNullOrEmpty($ca)) {
21
+ if ([string]::IsNullOrEmpty($Ca)) {
23
22
  throw "You must pass in a -CA!"
24
23
  }
25
24
 
25
+ # enable debugging if debug is true
26
26
  # enable debugging if debug is true
27
27
  $DebugPreference = If ($DebugPreference -eq "Inquire") {"Continue"} Else {"SilentlyContinue"}
28
- $debug = If ($DebugPreference -eq "Continue") {$true} Else {$false}
28
+ $Debug = If ($DebugPreference -eq "Continue") {$true} Else {$false}
29
29
  Write-Debug "running script with:"
30
- Write-Debug "CA: $ca"
30
+ Write-Debug "CA: $Ca"
31
31
  Write-Debug "CI: $env:CI"
32
- Write-Debug "DEBUG: $debug"
33
- Write-Debug "NONINTERACTIVE: $noninteractive"
32
+ Write-Debug "DEBUG: $Debug"
33
+ Write-Debug "NONINTERACTIVE: $NonInteractive"
34
34
 
35
35
  # if we are in CI then reset non-interactive to true
36
36
  if ($env:CI) {
37
- $noninteractive = $true
37
+ $NonInteractive = $true
38
38
  Write-Debug "Running in non-interactive mode because CI=$env:CI is set."
39
39
  }
40
40
 
41
41
  # if non-interactive eg we are probably on CI lets just powershell it out as admin
42
- if ($noninteractive -eq $true) {
42
+ if ($NonInteractive -eq $true) {
43
43
  # start the process with elevated permissions
44
- $p = Start-Process -FilePath certutil.exe -ArgumentList "-addstore Root `"$ca`"" -Verb RunAs -Wait -PassThru
44
+ $p = Start-Process -FilePath certutil.exe -ArgumentList "-addstore Root `"$Ca`"" -Verb RunAs -Wait -PassThru
45
45
  Write-Debug "Process finished with return code: $($p.ExitCode)"
46
46
 
47
47
  # if there is an error then throw here
@@ -51,7 +51,7 @@ if ($noninteractive -eq $true) {
51
51
  } else {
52
52
  # read the certificate
53
53
  $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
54
- $cert.Import($ca)
54
+ $cert.Import($Ca)
55
55
  # add it to the store
56
56
  $store = New-Object System.Security.Cryptography.X509Certificates.X509Store "Root", "CurrentUser"
57
57
  $store.Open("ReadWrite")
@@ -2,6 +2,10 @@
2
2
 
3
3
  set -e
4
4
 
5
+ if [ -f /tmp/lando-entrypoint-ran ]; then
6
+ rm /tmp/lando-entrypoint-ran
7
+ fi
8
+
5
9
  # Get the lando logger
6
10
  . /helpers/log.sh
7
11
 
@@ -16,8 +16,8 @@ $debug = If ($DebugPreference -eq "Continue") {$true} Else {$false}
16
16
 
17
17
  # figure out the command and setup fake fds
18
18
  $command = $cmd.split(',')
19
- $stdoutfile = Join-Path $Env:Temp $(New-Guid)
20
- $stderrfile = Join-Path $Env:Temp $(New-Guid)
19
+ $stdoutfile = Join-Path $Env:Temp $([guid]::NewGuid().ToString())
20
+ $stderrfile = Join-Path $Env:Temp $([guid]::NewGuid().ToString())
21
21
 
22
22
  # DEBUG
23
23
  Write-Debug "running elevated command:"
@@ -0,0 +1,142 @@
1
+ #!/bin/bash
2
+
3
+ # semcompare.sh
4
+ # Usage: ./semcompare.sh version1 version2
5
+
6
+ version1="$1"
7
+ version2="$2"
8
+
9
+ parse_version() {
10
+ local version="$1"
11
+ local major minor patch pre_release
12
+
13
+ # Updated regex to allow optional leading 'v'
14
+ if [[ "$version" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9A-Za-z.-]+))?$ ]]; then
15
+ major="${BASH_REMATCH[1]}"
16
+ minor="${BASH_REMATCH[2]}"
17
+ patch="${BASH_REMATCH[3]}"
18
+ pre_release="${BASH_REMATCH[5]}"
19
+ else
20
+ echo "Invalid version: $version" >&2
21
+ exit 1
22
+ fi
23
+
24
+ echo "$major" "$minor" "$patch" "$pre_release"
25
+ }
26
+
27
+ compare_pre_release() {
28
+ local pre1="$1"
29
+ local pre2="$2"
30
+
31
+ # If both are empty, they're equal
32
+ if [[ -z "$pre1" && -z "$pre2" ]]; then
33
+ echo 0
34
+ return
35
+ fi
36
+
37
+ # A version without pre-release is higher
38
+ if [[ -z "$pre1" ]]; then
39
+ echo 1
40
+ return
41
+ fi
42
+ if [[ -z "$pre2" ]]; then
43
+ echo -1
44
+ return
45
+ fi
46
+
47
+ IFS='.' read -ra arr1 <<< "$pre1"
48
+ IFS='.' read -ra arr2 <<< "$pre2"
49
+
50
+ local len1="${#arr1[@]}"
51
+ local len2="${#arr2[@]}"
52
+ local len=$(( len1 > len2 ? len1 : len2 ))
53
+
54
+ for ((i=0; i<len; i++)); do
55
+ id1="${arr1[i]}"
56
+ id2="${arr2[i]}"
57
+
58
+ # Treat missing identifiers as empty strings
59
+ [[ -z "$id1" ]] && id1=""
60
+ [[ -z "$id2" ]] && id2=""
61
+
62
+ # Numeric identifiers compare numerically
63
+ if [[ "$id1" =~ ^[0-9]+$ ]] && [[ "$id2" =~ ^[0-9]+$ ]]; then
64
+ if ((10#$id1 > 10#$id2)); then
65
+ echo 1
66
+ return
67
+ elif ((10#$id1 < 10#$id2)); then
68
+ echo -1
69
+ return
70
+ fi
71
+ else
72
+ # Alphanumeric identifiers compare lexically
73
+ if [[ "$id1" > "$id2" ]]; then
74
+ echo 1
75
+ return
76
+ elif [[ "$id1" < "$id2" ]]; then
77
+ echo -1
78
+ return
79
+ fi
80
+ fi
81
+ done
82
+
83
+ echo 0
84
+ }
85
+
86
+ compare_versions() {
87
+ local v1=($1)
88
+ local v2=($2)
89
+
90
+ local major1="${v1[0]}"
91
+ local minor1="${v1[1]}"
92
+ local patch1="${v1[2]}"
93
+ local pre1="${v1[3]}"
94
+
95
+ local major2="${v2[0]}"
96
+ local minor2="${v2[1]}"
97
+ local patch2="${v2[2]}"
98
+ local pre2="${v2[3]}"
99
+
100
+ # Compare major
101
+ if ((major1 > major2)); then
102
+ echo 1
103
+ return
104
+ elif ((major1 < major2)); then
105
+ echo -1
106
+ return
107
+ fi
108
+
109
+ # Compare minor
110
+ if ((minor1 > minor2)); then
111
+ echo 1
112
+ return
113
+ elif ((minor1 < minor2)); then
114
+ echo -1
115
+ return
116
+ fi
117
+
118
+ # Compare patch
119
+ if ((patch1 > patch2)); then
120
+ echo 1
121
+ return
122
+ elif ((patch1 < patch2)); then
123
+ echo -1
124
+ return
125
+ fi
126
+
127
+ # Compare pre-release
128
+ pre_release_cmp=$(compare_pre_release "$pre1" "$pre2")
129
+ echo "$pre_release_cmp"
130
+ }
131
+
132
+ v1_components=$(parse_version "$version1")
133
+ v2_components=$(parse_version "$version2")
134
+
135
+ result=$(compare_versions "$v1_components" "$v2_components")
136
+
137
+ # Return 1 if the first version is higher, else 0
138
+ if [[ "$result" -gt 0 ]]; then
139
+ exit 0
140
+ else
141
+ exit 1
142
+ fi
@@ -5,7 +5,6 @@ set -e
5
5
  # user info
6
6
  user="${1:-$LANDO_WEBROOT_USER}"
7
7
  id="${2:-$LANDO_HOST_UID}"
8
- gid="${3:-$LANDO_HOST_GID}"
9
8
 
10
9
  # retry settings
11
10
  attempt=0
@@ -14,7 +13,7 @@ retry=25
14
13
 
15
14
  until [ "$attempt" -ge "$retry" ]
16
15
  do
17
- id -u "$user" | grep "$id" &>/dev/null && id -g "$user" | grep "$gid" &>/dev/null && break
16
+ id "$user"| grep uid | grep "$id" &>/dev/null && break
18
17
  attempt=$((attempt+1))
19
18
  sleep "$delay"
20
19
  done
package/tasks/destroy.js CHANGED
@@ -22,6 +22,9 @@ module.exports = lando => {
22
22
  // Destroy the app
23
23
  if (app) {
24
24
  console.log(lando.cli.makeArt('appDestroy', {name: app.name, phase: 'pre'}));
25
+ // run setup if we need to
26
+ await require('../hooks/lando-run-setup')(lando);
27
+ // destroy
25
28
  await app.destroy();
26
29
  console.log(lando.cli.makeArt('appDestroy', {name: app.name, phase: 'post'}));
27
30
  }
package/tasks/info.js CHANGED
@@ -34,11 +34,12 @@ module.exports = lando => ({
34
34
  const getData = async () => {
35
35
  // go deep
36
36
  if (options.deep) {
37
+ const separator = _.get(app, '_config.orchestratorSeparator', '_');
37
38
  return await lando.engine.list({project: app.project})
38
39
  .map(async container => await lando.engine.scan(container))
39
40
  .filter(container => {
40
41
  if (!options.service) return true;
41
- return options.service.map(service => `/${app.project}-${service}-1`).includes(container.Name);
42
+ return options.service.map(service => `/${app.project}${separator}${service}${separator}1`).includes(container.Name);
42
43
  });
43
44
 
44
45
  // normal info