76 lines
2.1 KiB
Bash
76 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# shellcheck disable=all
|
|
# This is a handlerbars template, so ignore issues
|
|
|
|
|
|
checksum_file=".dotter/cache/pre_deploy.checksum"
|
|
|
|
if [[ -e "$checksum_file" ]] && sha256sum --check "$checksum_file" >/dev/null 2>&1; then
|
|
echo "Pre deploy script has not changed, skiping script execution"
|
|
echo "To override this, remove the checksum file: $checksum_file"
|
|
exit 0
|
|
fi
|
|
|
|
{{!~ Detect the distribution ~}}
|
|
{{~ assign "distro" (trim (command_output "awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '\"'")) ~}}
|
|
|
|
{{ header "Running pre deploy script for distro" (to_title_case distro) }}
|
|
|
|
{{ #if (and dotter.packages.cli (is_executable "sudo")) }}
|
|
{{ header "Configuring sudo" }}
|
|
|
|
echo "Defaults pwfeedback" | sudo -B tee /etc/sudoers.d/01-user
|
|
echo "Defaults timestamp_timeout=10" | sudo -B tee -a /etc/sudoers.d/01-user
|
|
echo "Defaults timestamp_type=global" | sudo -B tee -a /etc/sudoers.d/01-user
|
|
|
|
{{ /if }}
|
|
|
|
{{#if (eq distro "fedora") ~}}
|
|
|
|
{{! extract the copr repositories variable }}
|
|
{{~ assign "copr" (flatten_table copr) ~}}
|
|
|
|
{{#if (ne (len copr) 0) ~}}
|
|
{{ header "Enabling copr repositories" }}
|
|
|
|
{{# each copr }}
|
|
sudo -B dnf copr enable -y '{{ this }}'
|
|
{{ /each }}
|
|
|
|
{{~ /if }}
|
|
|
|
{{ header "Installing dnf packages" }}
|
|
sudo -B dnf install -y {{~# each (flatten_table packages) }} '{{ this }}' {{~ /each }}
|
|
|
|
{{~ /if }}
|
|
|
|
{{#if (and dotter.packages.rust (not (is_executable "cargo"))) }}
|
|
|
|
{{ header "Installing rust" }}
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable
|
|
|
|
{{ /if }}
|
|
|
|
{{#if (and dotter.packages.rust (ne (len cargo.packages) 0)) }}
|
|
|
|
{{ header "Installing crates" }}
|
|
cargo install --locked {{# each cargo.packages }} "{{ this }}" {{ /each }}
|
|
|
|
{{ /if }}
|
|
|
|
{{ #if dotter.packages.cli }}
|
|
|
|
{{ header "Configuring Nerd Fonts" }}
|
|
|
|
FONT_DIR="$HOME/.local/share/fonts"
|
|
mkdir -p "$FONT_DIR"
|
|
tmp_dir=$(mktemp -d)
|
|
|
|
curl -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/{{ nerd_font }}.zip -o "$tmp_dir/{{ nerd_font}}.zip"
|
|
unzip -o "$tmp_dir/{{nerd_font}}.zip" -d ${FONT_DIR}/{{ nerd_font }}
|
|
|
|
rm -rf "$tmp_dir"
|
|
|
|
{{ /if }}
|
|
|
|
{{ header "Done :3" }}
|