feat(linux): add installation script

resolves #3815
This commit is contained in:
Jan De Dobbeleer 2023-05-10 19:53:23 +02:00 committed by Jan De Dobbeleer
parent 7d7a8c41c0
commit 221cd7bad2
2 changed files with 7 additions and 21 deletions

View file

@ -35,31 +35,17 @@ To display all icons, we recommend the use of a [Nerd Font][fonts].
</TabItem> </TabItem>
<TabItem value="manual"> <TabItem value="manual">
Oh My Posh can also be installed manually by downloading the release. Install the latest version for your system by running the following command:
Depending on your distro, this may or may not work (please refer to the homebrew installation
in case it doesn't work).
**Download Oh My Posh**
:::caution
The below commands assume the processor architecture is `amd64` while we have support for `arm` and `arm64` as well.
Make sure you validate your architecture and adjust `posh-linux-<ARCH>` accordingly. If you don't know your
processor architecture, you can display it using `uname -m`.
:::
```bash ```bash
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh curl -s https://ohmyposh.dev/install.sh | bash -s
sudo chmod +x /usr/local/bin/oh-my-posh
``` ```
**Download the [themes][themes]** By default the script will install to `/usr/local/bin` or the existing Oh My Posh executable's installation folder.
If you want to install to a different location you can specify it using the `-d` flag:
```bash ```bash
mkdir ~/.poshthemes curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/bin
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
chmod u+rw ~/.poshthemes/*.omp.*
rm ~/.poshthemes/themes.zip
``` ```
</TabItem> </TabItem>

View file

@ -55,7 +55,7 @@ set_install_directory() {
posh_dir=$(command -v oh-my-posh) posh_dir=$(command -v oh-my-posh)
real_dir=$(realpath $posh_dir) real_dir=$(realpath $posh_dir)
install_dir=$(dirname $real_dir) install_dir=$(dirname $real_dir)
printf "Oh My Posh is already installed, updating existing installation in:\n" printf " Oh My Posh is already installed, updating existing installation in:\n"
printf " ${install_dir}\n" printf " ${install_dir}\n"
else else
install_dir="/usr/local/bin" install_dir="/usr/local/bin"
@ -121,7 +121,7 @@ install() {
printf "🚀 Installation complete.\n\nYou can follow the instructions at https://ohmyposh.dev/docs/installation/prompt\n" printf "🚀 Installation complete.\n\nYou can follow the instructions at https://ohmyposh.dev/docs/installation/prompt\n"
printf "to setup your shell to use oh-my-posh.\n\n" printf "to setup your shell to use oh-my-posh.\n\n"
printf "If you want to use a built-in theme, you can find them in the ${theme_dir} directory:\n" printf "If you want to use a built-in theme, you can find them in the ${theme_dir} directory:\n"
printf " oh-my-posh init {shell} --config theme ${theme_dir}/{theme}.omp.json\n\n" printf " oh-my-posh init {shell} --config ${theme_dir}/{theme}.omp.json\n\n"
} }
detect_arch() { detect_arch() {