PortValhalla/scripts/Software/Oh My Posh/install.sh

24 lines
704 B
Bash
Executable file

#!/bin/bash
# Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE" "$USER";
else
bin=oh-my-posh;
contextRoot="$(mktemp -d)";
pushd "$contextRoot" > /dev/null;
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O "$bin";
install "$bin" /usr/local/bin;
popd > /dev/null;
rm -rf "$contextRoot";
homeDir="$(sudo -u "$1" bash -c 'realpath ~')";
sudo -u "$1" mkdir -p "$homeDir/.omp";
sudo -u "$1" cp "$homeDir/Nextcloud/.omp/manuel.omp.json" "$homeDir/.omp/manuel.omp.json";
echo 'eval "$(oh-my-posh init bash --config ~/.omp/manuel.omp.json)"' \
| sudo -u "$1" tee -a "$homeDir/.bashrc";
fi