#!/usr/bin/env bash # shellcheck disable=all # This is a handlerbars template, so ignore issues {{!~ 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 (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 }} {{ header "Done :3" }}