Page MenuHomeSolus

add zprofile to fix snap packages when using sddm

Authored by Harvey on Feb 20 2020, 10:32 AM.



Packaging fix addressing snap packages being broken when using both zsh and sddm
Depends D8315
Resolves T8750

Test Plan
  • Run some commands on Budgie and Plasma
  • Test git and wd plugins with ohmyzsh on Budgie and Plasma
  • Make sure existing user zprofiles will be respected

Diff Detail

R3329 zsh
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Harvey created this revision.Feb 20 2020, 10:32 AM
Harvey requested review of this revision.Feb 20 2020, 10:32 AM
Girtablulu requested changes to this revision.Feb 20 2020, 10:48 AM
Girtablulu added a subscriber: Girtablulu.

can you add stack Dep?


can you make it stateless?

This revision now requires changes to proceed.Feb 20 2020, 10:48 AM

and I'd like to have the okay from core as well

Having a little bit of trouble making it stateless:
Added this to zsh:

--enable-etcdir=/usr/share/defaults/etc/zsh \
--enable-zprofile=/usr/share/defaults/etc/zsh/zprofile \

install -Dm00644 $pkgfiles/zprofile $installdir/usr/share/defaults/etc/zsh/zprofile

But menu items are missing now. I even added this to the fix-zsh-for-solus.patch for sddm

|| zdir=/usr/share/defaults/etc/zsh

Ideas? Not sure if its zsh not loading zprofile or something else plasma needs patching.

*sighs* I still can't managed to figure it out

Adding additional information in case I made an obvious mistake.

sddm patch was:

From dceea3f8b880c4eaefdb9647fe7755ac5a658ee5 Mon Sep 17 00:00:00 2001
From: Troy Harvey <>
Date: Thu, 20 Feb 2020 22:26:39 +1100
Subject: [PATCH] Fix zsh for solus

 data/scripts/Xsession | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/scripts/Xsession b/data/scripts/Xsession
index c7fa214..658c3a9 100755
--- a/data/scripts/Xsession
+++ b/data/scripts/Xsession
@@ -21,7 +21,7 @@ case $SHELL in
     [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
-    [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
+    [ -d /etc/zsh ] || [ -d /usr/share/zsh ] || [ -d /usr/share/defaults/etc/zsh ] && zdir=/etc/zsh || zdir=/etc || zdir=/usr/share/zsh || zdir=/usr/share/defaults/etc/zsh
     # zshenv is always sourced automatically.
     [ -f $zdir/zprofile ] && . $zdir/zprofile

zsh package set file locations according to zsh documentation:

--enable-etcdir=/usr/share/defaults/etc/zsh \
--enable-zprofile=/usr/share/defaults/etc/zsh/zprofile \

install -Dm00644 $pkgfiles/zprofile $installdir/usr/share/defaults/etc/zsh/zprofile
  • Setting --enable-etcdir without zsh sub dir in case it was looking at /usr/share/defaults/etc/zsh/zsh
  • Installing zprofile to /usr/share/defaults/etc/
  • Applying stateless patches from clearlinux.

Nothing seems to work. snap packages will run from the terminal but will not appear in app menu if I try and make zsh stateless. I'm out of ideas.

Harvey updated this revision to Diff 19931.Feb 23 2020, 2:22 AM
Harvey edited the summary of this revision. (Show Details)
Harvey edited the test plan for this revision. (Show Details)

Make zprofile stateless

Harvey updated this revision to Diff 19980.Feb 25 2020, 2:03 AM

Make all zsh startup/shutdown files stateless

JoshStrobl accepted this revision.Mar 8 2020, 4:42 PM
JoshStrobl added a subscriber: JoshStrobl.

LGTM, nice work ๐Ÿ‘

This revision was not accepted when it landed; it landed in state Needs Review.Mar 8 2020, 5:26 PM
This revision was automatically updated to reflect the committed changes.

@Harvey Every time I open a new session with zsh now it spits out:

/usr/share/defaults/etc/profile.d/ command not found: shopt

It has to do with the emulate sh -c 'source /etc/profile' you added in zprofile. This is due to the fact our has shopt -s checkwinsize, where shopt isn't a thing in zsh but rather it is setopt. See$19

We need to update to actually check if shopt exists (so bash), otherwise use setopt, or find a different solution.


I never got the error in my testing, But I just logged in via TTY just then and noticed it. Now I can reproduce I'll start testing possible solutions.