Skip to content

Instantly share code, notes, and snippets.

@khongi
Created April 23, 2021 07:34
Show Gist options
  • Save khongi/23103333ff0493e7cf109d6494515fba to your computer and use it in GitHub Desktop.
Save khongi/23103333ff0493e7cf109d6494515fba to your computer and use it in GitHub Desktop.
Unraid Zsh with persistent config
# This is your .zshrc, put it in /boot/config/extra/
export ZSH="/root/.oh-my-zsh"
ZSH_THEME="robbyrussell"
DISABLE_UPDATE_PROMPT="true"
plugins=(
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configurations
alias l='ls -lFh' #size,show type,human readable
alias la='ls -lAFh' #long list,show almost all,show type,human readable
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=/root/.cache/zsh/history
#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp
# This is the go file that runs at startup, located at: /boot/config/go
# Make sure to enable zsh in nerd pack first
# Install Oh-My-Zsh
HOME="/root"
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
#!/bin/bash
# Run this script with Unraid user scripts plugin at array start
# Located at: /boot/config/plugins/user.scripts/scripts/<script name>/script
HOME=/root
OH_MY_ZSH_ROOT="$HOME/.oh-my-zsh"
ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
OH_MY_ZSH_PLUGINS="$ZSH_CUSTOM/plugins"
OH_MY_ZSH_THEMES="$ZSH_CUSTOM/themes"
mkdir -p $OH_MY_ZSH_PLUGINS
mkdir -p $OH_MY_ZSH_THEMES
# Install zsh-autosuggestions
if [ ! -d "$OH_MY_ZSH_PLUGINS/zsh-autosuggestions" ]; then
echo " -> Installing zsh-autosuggestions..."
git clone https://github.com/zsh-users/zsh-autosuggestions $OH_MY_ZSH_PLUGINS/zsh-autosuggestions
else
echo " -> zsh-autosuggestions already installed"
fi
# Install zsh-syntax-highlighting
if [ ! -d "$OH_MY_ZSH_PLUGINS/zsh-syntax-highlighting" ]; then
echo " -> Installing zsh-syntax-highlighting..."
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $OH_MY_ZSH_PLUGINS/zsh-syntax-highlighting
else
echo " -> zsh-syntax-highlighting already installed"
fi
chmod 755 $OH_MY_ZSH_PLUGINS/zsh-autosuggestions
chmod 755 $OH_MY_ZSH_PLUGINS/zsh-syntax-highlighting
chsh -s /bin/zsh
# Remove oh-my-zsh default .zshrc
rm /root/.zshrc
mkdir -p /root/.cache/zsh/
mkdir -p /boot/config/extra/
# Make sure history file exists
touch /boot/config/extra/history
# Symlink .zshrc and history files
cp -sf /boot/config/extra/.zshrc /root/.zshrc
cp -sf /boot/config/extra/history /root/.cache/zsh/history
@10bn
Copy link

10bn commented Mar 9, 2024

Could the user-script.sh also be run fromt the go file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment