[Ubuntu-x-swat] [Bug 1922414] Re: ssh-agent fails to start (has_option: command not found)

2022-09-01 Thread Boris Steiner
This issue is caused by lightdm running /usr/sbin/lightdm-session
instead of /etc/X11/Xsession.

The simplest workaround for me was:
- introduce has_option functon as 1st step in Xsession.d sourced scripts
- as root create file /etc/X11/Xsession.d/01custom-has-option with following 
content:

#check if has_option is already defined; if not, define

has_option 2>1 > /dev/null || has_option() {
  # Ensure that a later no-foo overrides an earlier foo
  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
return 0
  else
return 1
  fi
}

- logout and login

Details:
- /etc/X11/Xsession introduces has_option shell function that check if 
Xsession.options contains predefined option
- /etc/X11/Xsession sources all files under /etc/X11/Xsession.d in alphabetic 
order
- as the scripts are sourced they maintain the same environemnt and definitions 
of variables or functions as Xsession
- however, lightdm uses lightdm-session that also sources /etc/X11/Xsession.d/* 
BUT does NOT define has_option function
- provided script checks if the function has_option already exists (Xsession is 
in play) and if not (lightdm-session's game) it defines it the same way as is 
in /etc/X11/Xsession

Alternative solutions:
- modify lightdm-session to contain has_option the same way as /etc/X11/Xsession
- modify (create) /etc/lightdm/lightdm.conf containing:
[Seat:*]
session-wrapper=/etc/X11/Xsession

- requires reboot; it did not work ok for 100% as my .profile env vars
were not correctly propagated

-- 
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xorg in Ubuntu.
https://bugs.launchpad.net/bugs/1922414

Title:
  ssh-agent fails to start (has_option: command not found)

To manage notifications about this bug go to:
https://bugs.launchpad.net/lightdm/+bug/1922414/+subscriptions


___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp


[Ubuntu-x-swat] [Bug 1955135] Re: multiple issues with /etc/X11/Xsession.d/ - "has_option: command not found"

2022-09-01 Thread Boris Steiner
*** This bug is a duplicate of bug 1922414 ***
https://bugs.launchpad.net/bugs/1922414

This issue is caused by lightdm running /usr/sbin/lightdm-session
instead of /etc/X11/Xsession.


The simplest workaround for me was:
- introduce has_option functon as 1st step in Xsession.d sourced scripts
- as root create file /etc/X11/Xsession.d/01custom-has-option with following 
content:

#check if has_option is already defined; if not, define

has_option 2>1 > /dev/null || has_option() {
  # Ensure that a later no-foo overrides an earlier foo
  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
return 0
  else
return 1
  fi
}


- logout and login

Details:
- /etc/X11/Xsession introduces has_option shell function that check if 
Xsession.options contains predefined option
- /etc/X11/Xsession sources all files under /etc/X11/Xsession.d in alphabetic 
order
- as the scripts are sourced they maintain the same environemnt and definitions 
of variables or functions as Xsession
- however, lightdm uses lightdm-session that also sources /etc/X11/Xsession.d/* 
BUT does NOT define has_option function
- provided script checks if the function has_option already exists (Xsession is 
in play) and if not  (lightdm-session's game) it defines it the same way as is 
in /etc/X11/Xsession

Alternative solutions:
- modify lightdm-session to contain has_option the same way as /etc/X11/Xsession
- modify (create) /etc/lightdm/lightdm.conf containing:
[Seat:*]
session-wrapper=/etc/X11/Xsession

- requires reboot; it did not work ok for 100% as my .profile env vars
were not correctly propagated

-- 
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xorg in Ubuntu.
https://bugs.launchpad.net/bugs/1955135

Title:
  multiple issues with /etc/X11/Xsession.d/ - "has_option: command not
  found"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1955135/+subscriptions


___
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to : ubuntu-x-swat@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp