feat(main): changed to functions
This commit is contained in:
parent
b74fb85125
commit
c447b1707b
1 changed files with 24 additions and 17 deletions
25
main
25
main
|
@ -31,27 +31,34 @@ if [ -d "$HOME/.local/bin" ]; then
|
|||
fi
|
||||
#
|
||||
# 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" ;;
|
||||
armv*) arch="arm" ;;
|
||||
arm64) arch="arm64" ;;
|
||||
aarch64) arch="arm64" ;;
|
||||
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
|
||||
fi
|
||||
fi
|
||||
echo "$arch"
|
||||
}
|
||||
#
|
||||
# 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" ;;
|
||||
darwin) platform="darwin" ;;
|
||||
esac
|
||||
esac
|
||||
|
||||
echo "$platform"
|
||||
}
|
||||
#
|
||||
# Set the OMP Path and create the directory
|
||||
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"
|
||||
#
|
||||
# Set the OMP target Platform
|
||||
OMP_TARGET="$platform-$arch"
|
||||
OMP_TARGET="$(get_platform)-$(get_architecture)"
|
||||
#
|
||||
# Set the path to the OMP Executeable
|
||||
OMP_EXE="$OMP_PATH/posh-$OMP_TARGET"
|
||||
|
|
Loading…
Add table
Reference in a new issue