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

26 lines
681 B
Bash
Executable file

#!/bin/bash
# Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE" "$USER"
else
bin=oh-my-posh
workingDirectory=$(pwd)
contextRoot=$(mktemp -d)
cd $contextRoot
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O $bin
install $bin /usr/local/bin
cd $workingDirectory
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