Update 3 files

- /home/.chezmoiscripts/universal/run_onchange_before_05-install-vmware.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_44-vmware-install.tmpl
- /docs/CHEZMOI-INTRO.md
This commit is contained in:
Brian Zalewski 2023-02-02 02:44:01 +00:00
parent b04945819c
commit 3f9ef114b3
3 changed files with 44 additions and 28 deletions

View file

@ -152,3 +152,7 @@ in `.chezmoitemplates/secrets/key-surgesh-password` to leverage this functionali
### OpenVPN Password
* Environment Variable: `OVPN_PASSWORD`
### VMWare Workstation Key
* Environment Variable: `VMWARE_WORKSTATION_LICENSE_KEY`

View file

@ -0,0 +1,39 @@
{{- if eq .host.distro.family "linux" -}}
#!/usr/bin/env bash
{{- if (stat (joinPath (.chezmoi.sourceDir ".chezmoitemplates" "secrets" "key-vmware-workstation"))) -}}
{{- $secretKey := (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (includeTemplate "secrets/key-vmware-workstation" | decrypt)) -}}
{{- else -}}
{{- $secretKey := (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (env "VMWARE_WORKSTATION_LICENSE_KEY")) -}}
{{- end }}
# Source: https://gist.github.com/PurpleVibe32/30a802c3c8ec902e1487024cdea26251
# key: {{- $secretKey }}
{{ 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 -}}

View file

@ -1,27 +0,0 @@
{{- if eq .host.distro.family "linux" -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
### Install VMware Workstation
if [ ! command -v vmware > /dev/null ]; then
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"
logg info 'Installing VMware Workstation'
if [[ -v VMWARE_WORKSTATION_LICENSE_KEY && -n $VMWARE_WORKSTATION_LICENSE_KEY ]]; then
sudo $VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh --eulas-agreed --console --required \
--set-setting vmware-workstation serialNumber $VMWARE_WORKSTATION_LICENSE_KEY
else
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 -}}