Last active
July 11, 2022 16:04
-
-
Save FilBot3/2e9ba8041a14bad7967904b6942f0957 to your computer and use it in GitHub Desktop.
Make a custom Fedora Toolbox for Silverblue. Has Teams and Chrome with some other tools I use regularly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Fail on errors. | |
| set -e | |
| function print_output() { | |
| # print_output takes a string of input and formats with color the output. | |
| # Useful for logging. | |
| # | |
| # Parameters | |
| # ---------- | |
| # $1 -> Just uses $@ to take in all input. | |
| # | |
| # Returns | |
| # ------- | |
| # None | |
| # | |
| echo -e "\e[35m\e[1m==>\e[0m \e[32m\e[4m$@\e[0m" | |
| } | |
| # Get verbose output. | |
| #set -x | |
| FEDORA_VERSION=36 | |
| print_output "Pull Fedora Toolbox Image" | |
| container=$(buildah from registry.fedoraproject.org/fedora-toolbox:${FEDORA_VERSION}) | |
| print_output "Installing Git" | |
| buildah run ${container} -- dnf install --assumeyes git | |
| print_output "Install Zsh" | |
| buildah run ${container} -- dnf install --assumeyes zsh tmux | |
| print_output "Installing Neovim and supporting packages" | |
| buildah run ${container} -- dnf install --assumeyes neovim python3-neovim ripgrep fd-find | |
| print_output "Install NodeJS Modules" | |
| buildah run ${container} -- dnf module install nodejs:16 --assumeyes | |
| print_output "Installing Google Chrome" | |
| buildah run ${container} -- dnf install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm --assumeyes | |
| print_output "Installing Microsoft Teams" | |
| buildah run ${container} -- dnf install https://packages.microsoft.com/yumrepos/ms-teams/teams-1.5.00.10453-1.x86_64.rpm --assumeyes | |
| print_output "Installing Golang and Rust" | |
| buildah run ${container} -- dnf install --assumeyes go rust cargo | |
| print_output "Installing Microsoft Repository" | |
| buildah run ${container} -- dnf install --assumeyes https://packages.microsoft.com/yumrepos/microsoft-fedora$(rpm -E %fedora)-prod/packages-microsoft-prod.rpm | |
| print_output "Install DotNet" | |
| buildah run ${container} -- dnf install --assumeyes dotnet-sdk-6.0 | |
| print_output "Installing RPM Fusion Repositories" | |
| buildah run ${container} -- dnf install --assumeyes https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm | |
| print_output "Landing kubernetes.repo" | |
| buildah run ${container} -- sh -c 'echo "[kubernetes] | |
| name=Kubernetes | |
| baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 | |
| enabled=1 | |
| gpgcheck=1 | |
| repo_gpgcheck=1 | |
| gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" | tee /etc/yum.repos.d/kubernetes.repo' | |
| print_output "Installing kubectl" | |
| buildah run ${container} -- dnf install --assumeyes kubectl | |
| print_output "Installing Helm" | |
| buildah run ${container} -- sh -c "curl --location --output helm.tar.gz https://get.helm.sh/helm-v3.8.2-linux-amd64.tar.gz && tar -xvf helm.tar.gz && mv linux-amd64/helm /usr/local/bin && rm -rf linux-amd64" | |
| print_output "Installing Terraform" | |
| buildah run ${container} -- dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo | |
| buildah run ${container} -- dnf install --assumeyes terraform | |
| print_output "Installing k9s" | |
| buildah run ${container} -- sh -c "curl --location --output k9s.tar.gz https://github.com/derailed/k9s/releases/download/v0.25.18/k9s_Linux_x86_64.tar.gz && tar -xvf k9s.tar.gz && mv k9s /usr/local/bin && rm LICENSE README.md" | |
| print_output "Installing universal-ctags" | |
| buildah run ${container} -- sh -c "dnf copr enable jgoguen/universal-ctags -y && dnf install --assumeyes universal-ctags" | |
| print_output "Cleaning DNF Cache" | |
| buildah run ${container} -- dnf clean all | |
| print_output "Setting SHELL to /usr/bin/zsh" | |
| buildah config --env="SHELL=/usr/bin/zsh" ${container} | |
| #print_output "Set ENTRYPOINT" | |
| #buildah config --entrypoint='["/usr/bin/zsh"]' ${container} | |
| print_output "Committing image to local repository" | |
| buildah commit --rm --squash ${container} localhost/fedoratoolbox:${FEDORA_VERSION} | |
| print_output "Listing images" | |
| buildah images |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment