Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable omz update command setting #12298

Closed
oskarirauta opened this issue Mar 23, 2024 · 1 comment
Closed

disable omz update command setting #12298

oskarirauta opened this issue Mar 23, 2024 · 1 comment
Assignees
Labels
Area: updater Update subsystem Bug Something isn't working

Comments

@oskarirauta
Copy link

oskarirauta commented Mar 23, 2024

If the feature request is for a plugin or theme, specify it here.

No response

If the feature solves a problem you have, specify it here.

I have installed oh-my-zsh system-wide, by cloning repository to /usr/share/oh-my-zsh
there I added file functions.sh with following content:

oh-my-zsh() {

	[ -n "$ZSH" ] && {

		[ "$TERM" = "screen" ] ||
			echo oh-my-zsh is already enabled

	} || {

		[ -n "$SSH_TTY" ] && [ "$TERM" = "screen" -o "$TERM" = "xterm-256color" ] && {

			export ZSH="/usr/share/oh-my-zsh"
			[ -z "$ZSH_THEME" ] &&
				ZSH_THEME="robbyrussell"
			[ -z "$plugins" ] &&
				plugins=()

			zstyle ':omz:update' mode disabled

			source $ZSH/oh-my-zsh.sh
		}
	}

	unset -f oh-my-zsh
}

see what I did there; all my ssh connections to host from my apple and windows computers use xterm-256color - so it is tested if requirements are met. This way, if I make a connection or login from console; oh-my-zsh will be ignored, because console cannot take advantage of nerd fonts, or anything to solve icon problem. These machines also are not running any kind of graphical user interface, such as X- so this will work perfectly in my case. It won't for everyone, but might be useful for some people..

automatic update is disabled also. Warning message of oh-my-zsh already running, is suppressed for screen; if user wants to run screen with oh-my-zsh, following command works: ZSH= screen but otherwise, oh-my-zsh is disabled for screen.

and in my system-wide zshrc (/etc/zshrc) I have this:

[ -f /etc/profile ] && \
	emulate sh -c 'source /etc/profile'

setopt noautomenu

PS1="%n@%m:%~# "

HISTFILE=~/.zsh_history
HISTSIZE=250
SAVEHIST=250
bindkey -e

. /usr/share/oh-my-zsh/functions.sh

zstyle :compinstall filename ~/.zshrc

autoload -Uz compinit
compinit

so, now- if user wants to use oh-my-zsh, all that is needed, is to execute one-time-function oh-my-zsh, and to make it permanent, this is .zshrc of user:

ZSH_THEME="agnoster"
plugins=(git)
oh-my-zsh

All settings should be added before oh-my-zsh

Okay, I am all set. Just one thing there bugs me; command omz update - I could make my own local changes to lib/cli.zsh - but if it will be updated, there will be a conflict. I could also make that file ignored; but I really do want to be able to update oh-my-zsh fully, so wouldn't want to do that..

Issue is not a crucial one, it's more that it looks ugly.. now if normal user attempts to update oh-my-zsh, nothing bad really happens, just bunch of error messages are thrown because normal user doesn't have permissions to write to cloned repository.

So I'd really love a setting which could disable update argument for omz command, just for making it more pretty 😄
or maybe it could report that user doesn't have permissions to update oh-my-zsh.

On most systems $USER contains login name, so this could be used to decide if user can or cannot update, if it's not root - disable..

Describe the proposed feature.

Setting to disable update argument from omz command.

Describe alternatives you've considered

No response

Additional context

 dev@media  ~  omz update
fatal: detected dubious ownership in repository at '/usr/share/oh-my-zsh'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/share/oh-my-zsh
fatal: detected dubious ownership in repository at '/usr/share/oh-my-zsh'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/share/oh-my-zsh
fatal: not in a git directory
fatal: not in a git directory
fatal: not in a git directory
fatal: not in a git directory
fatal: not in a git directory
fatal: not in a git directory
fatal: --local can only be used inside a git repository
fatal: --local can only be used inside a git repository
fatal: detected dubious ownership in repository at '/usr/share/oh-my-zsh'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/share/oh-my-zsh
fatal: detected dubious ownership in repository at '/usr/share/oh-my-zsh'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/share/oh-my-zsh
fatal: detected dubious ownership in repository at '/usr/share/oh-my-zsh'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/share/oh-my-zsh
 ✘ dev@media  ~  

Related Issues

No response

@oskarirauta oskarirauta added the Feature New feature or request label Mar 23, 2024
@mcornella mcornella added Bug Something isn't working Area: updater Update subsystem and removed Feature New feature or request labels Apr 9, 2024
@mcornella mcornella self-assigned this Apr 9, 2024
@mcornella
Copy link
Member

Should be fixed in recent versions.

cschuyle pushed a commit to cschuyle/ohmyzsh that referenced this issue Apr 18, 2024
bean5 pushed a commit to bean5/ohmyzsh that referenced this issue Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: updater Update subsystem Bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants