feat(main): changed to functions

This commit is contained in:
Paul Fey 2025-03-30 21:11:28 +02:00
parent b74fb85125
commit c447b1707b

41
main
View file

@ -31,27 +31,34 @@ if [ -d "$HOME/.local/bin" ]; then
fi fi
# #
# Detect Device Arch # Detect Device Arch
arch="$(uname -m | tr '[:upper:]' '[:lower:]')" get_architecture() {
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
case "${arch}" in case "${arch}" in
x86_64) arch="amd64" ;; x86_64) arch="amd64" ;;
armv*) arch="arm" ;; armv*) arch="arm" ;;
arm64) arch="arm64" ;; arm64) arch="arm64" ;;
aarch64) arch="arm64" ;; aarch64) arch="arm64" ;;
i686) arch="386" ;; i686) arch="386" ;;
esac esac
if [ "${arch}" = "arm64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then if [ "${arch}" = "arm64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
arch=arm arch=arm
fi fi
echo "$arch"
}
# #
# Detect Device Platform # Detect Device Platform
platform="$(uname -s | awk '{print tolower($0)}')" get_platform() {
platform="$(uname -s | awk '{print tolower($0)}')"
case "${platform}" in case "${platform}" in
linux) platform="linux" ;; linux) platform="linux" ;;
darwin) platform="darwin" ;; darwin) platform="darwin" ;;
esac esac
echo "$platform"
}
# #
# Set the OMP Path and create the directory # Set the OMP Path and create the directory
OMP_PATH="$HOME/.config/dotfiles/oh-my-posh" OMP_PATH="$HOME/.config/dotfiles/oh-my-posh"
@ -61,7 +68,7 @@ OMP_PATH="$HOME/.config/dotfiles/oh-my-posh"
OMP_THEME_PATH="$OMP_PATH/$OMP_THEME.toml" OMP_THEME_PATH="$OMP_PATH/$OMP_THEME.toml"
# #
# Set the OMP target Platform # Set the OMP target Platform
OMP_TARGET="$platform-$arch" OMP_TARGET="$(get_platform)-$(get_architecture)"
# #
# Set the path to the OMP Executeable # Set the path to the OMP Executeable
OMP_EXE="$OMP_PATH/posh-$OMP_TARGET" OMP_EXE="$OMP_PATH/posh-$OMP_TARGET"