Skip to content

Instantly share code, notes, and snippets.

@mfedatto
Last active February 1, 2024 14:11
Show Gist options
  • Save mfedatto/475a009c0713428503fed83b62a3a2e4 to your computer and use it in GitHub Desktop.
Save mfedatto/475a009c0713428503fed83b62a3a2e4 to your computer and use it in GitHub Desktop.

Oh My Posh MFedatto.io install script

Since I've needed to setup a set of instances with my theme, I've reached this script to automate all tasks I use.

The MFedatto OMP theme has an extra context that I use for an extra diferenciation among my devices and instances, like rpi4, rpi5, opi0 or docker. There is an additional script to set them.

Bash setup

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-omp-bash.sh | bash

MFedatto Context

Context Name Foreground Background WSL
Raspberry Pi 4 rpi4 #d1c5c0 #e30b5d ``
Raspberry Pi 5 rpi5 #d1c5c0 #e30b5d ``
Orange Pi Zero 2W opi02w #197caa #f4a524 ``
Docker Container docker #e5f2fc #00084d ``
Docker Container at WSL docker #e5f2fc #00084d 1
curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- context_name context_foreground context_background [wsl]

Raspberry Pi 4

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- rpi4 \#d1c5c0 \#e30b5d

Raspberry Pi 5

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- rpi5 \#d1c5c0 \#e30b5d

Orange Pi Zero 2W

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- opi02w \#197caa \#f4a524

Docker Container

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- docker \#e5f2fc \#00084d

Docker Container at WSL

curl -s https://gist.githubusercontent.com/mfedatto/475a009c0713428503fed83b62a3a2e4/raw/6275e85e643244be535f288b2b8c62e6562adb1f/mfedatto-context.sh | bash -s -- docker \#e5f2fc \#00084d 1
#!/bin/bash
echo "mf_context: '$1'"
echo " - foreground_color: '$2'"
echo " - background_color: '$3'"
echo " - wsl: '$4' # (empty for non-wsl)"
cp -f ~/.bashrc ~/.bashrc-mfcontext
echo "" >> ~/.bashrc-mfcontext
echo "export MF_CONTEXT=$1" >> ~/.bashrc-mfcontext
echo "export MF_CONTEXT_FGCOLOR=$2" >> ~/.bashrc-mfcontext
echo "export MF_CONTEXT_BGCOLOR=$3" >> ~/.bashrc-mfcontext
echo "export MF_CONTEXT_WSL=$4" >> ~/.bashrc-mfcontext
mv -f ~/.bashrc-mfcontext ~/.bashrc
echo "Run 'exec bash' to reload bash"
#!/bin/bash
echo "Creating install path"
mkdir -p ~/.oh-my-posh
echo ""
echo "Installing Oh My Posh"
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.oh-my-posh
echo ""
echo "Downloading MFedatto Theme"
wget https://raw.githubusercontent.com/mfedatto/mfedatto-omp-theme/master/src/mfedatto.omp.json
echo ""
echo "Moving downloaded theme to install path"
mv -f mfedatto.omp.json ~/.oh-my-posh/
echo ""
echo "Setting up bash"
cp -f ~/.bashrc ~/.bashrc-omp
echo "" >> ~/.bashrc-omp
echo "# OMP - MFedatto Setup" >> ~/.bashrc-omp
echo "" >> ~/.bashrc-omp
echo "export PATH=~/.oh-my-posh:\$PATH" >> ~/.bashrc-omp
echo "" >> ~/.bashrc-omp
echo "eval \"\$(oh-my-posh init bash --config ~/.oh-my-posh/mfedatto.omp.json)\"" >> ~/.bashrc-omp
echo "" >> ~/.bashrc-omp
echo ""
mv -f ~/.bashrc-omp ~/.bashrc
echo "Run 'exec bash' to reload bash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment