43 lines
1.3 KiB
Bash
43 lines
1.3 KiB
Bash
--==BOUNDARY==
|
|
Content-Type: text/x-shellscript; charset="us-ascii"
|
|
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
# Run Order: 1
|
|
# Run Frequency: only once, on first boot
|
|
|
|
# Tasks:
|
|
# - Install Dependencies
|
|
# - Install x
|
|
|
|
# Note: dollar-sign curly braces are template values from Terraform.
|
|
# Non curly brace ones are normal bash variables...
|
|
|
|
printf '%s\n' "Install X" "-----------------" "Under Usr: ${whoami}, proj: ${PWD##*/}"
|
|
sleep 1
|
|
|
|
sudo apt update -y && sudo apt install gpg wget -y
|
|
|
|
# === Install X via apt ===
|
|
|
|
# Get the keyring
|
|
wget -O- https://apt.releases.x.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/x-archive-keyring.gpg
|
|
|
|
# Verify the keyring
|
|
gpg --no-default-keyring --keyring /usr/share/keyrings/x-archive-keyring.gpg --fingerprint
|
|
|
|
# Check the exit status of the last command
|
|
if [ $? -eq 0 ]; then
|
|
# If the exit status is 0 (which means the previous command was successful), add the repo
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/x.gpg] https://apt.releases.x.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/x.list
|
|
|
|
# Install the vault
|
|
sudo apt update && sudo apt install x -y
|
|
else
|
|
# If the exit status is not 0 (which means the previous command failed), print an error message and exit
|
|
echo "Keyring verification of X failed. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
--==BOUNDARY==-- |