2023-02-01 18:44:01 -08:00
|
|
|
{{- if eq .host.distro.family "linux" -}}
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-02-04 01:11:07 -08:00
|
|
|
{{- $secretKey := "" -}}
|
2023-03-18 00:11:48 -07:00
|
|
|
{{- if (stat (joinPath (.chezmoi.sourceDir ".chezmoitemplates" "secrets" "key-VMWARE_WORKSTATION_LICENSE_KEY"))) -}}
|
|
|
|
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (includeTemplate "secrets/key-VMWARE_WORKSTATION_LICENSE_KEY" | decrypt)) -}}
|
2023-02-01 18:44:01 -08:00
|
|
|
{{- else -}}
|
2023-02-04 01:11:07 -08:00
|
|
|
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (env "VMWARE_WORKSTATION_LICENSE_KEY")) -}}
|
2023-02-01 18:44:01 -08:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
# Source: https://gist.github.com/PurpleVibe32/30a802c3c8ec902e1487024cdea26251
|
2023-02-04 01:11:07 -08:00
|
|
|
# key: {{ $secretKey }}
|
2023-02-01 18:44:01 -08:00
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile-before" }}
|
|
|
|
{{ includeTemplate "universal/logg-before" }}
|
|
|
|
|
|
|
|
### Install VMware Workstation
|
|
|
|
if ! command -v vmware > /dev/null; then
|
|
|
|
### Download VMWare Workstation
|
|
|
|
logg info 'VMware Workstation is not installed'
|
|
|
|
VMWARE_WORKSTATION_URL=https://www.vmware.com/go/getworkstation-linux
|
|
|
|
VMWARE_WORKSTATION_DIR=/tmp/workstation-downloads
|
|
|
|
mkdir -p $VMWARE_WORKSTATION_DIR
|
|
|
|
logg info 'Downloading VMware Workstation Installer'
|
|
|
|
curl -sSLA "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20220101 Firefox/102.0" "$VMWARE_WORKSTATION_URL" -o "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh"
|
|
|
|
|
|
|
|
### Register product key / license
|
|
|
|
VMWARE_WORKSTATION_LICENSE_KEY='{{- $secretKey -}}'
|
|
|
|
if [ -n "$VMWARE_WORKSTATION_LICENSE_KEY" ]; then
|
|
|
|
logg info 'Registering VMware Workstation Pro license with serial number'
|
|
|
|
sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required --set-setting vmware-workstation serialNumber "$VMWARE_WORKSTATION_LICENSE_KEY"
|
|
|
|
else
|
|
|
|
logg info 'Agreeing to VMWare Workstation Pro license (without serial number)'
|
|
|
|
sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required
|
|
|
|
fi
|
|
|
|
logg success 'VMware Workstation installed successfully'
|
|
|
|
else
|
|
|
|
logg info 'VMware Workstation is already installed'
|
|
|
|
fi
|
|
|
|
{{ end -}}
|