You are not logged in.

#1 2025-02-23 07:16:18

jronald
Member
Registered: 2022-05-09
Posts: 213

[SOLVED] can't define env var without value in user environment.d

$ cat ~/.config/environment.d/cmake.conf
CMAKE_BUILD_PARALLEL_LEVEL=

$ sudo reboot
$ env | grep CMAKE
# nothing

while with a value, it works:

$ cat ~/.config/environment.d/cmake.conf
CMAKE_BUILD_PARALLEL_LEVEL=8

$ sudo reboot
$ env | grep CMAKE
CMAKE_BUILD_PARALLEL_LEVEL=8

Last edited by jronald (2025-02-23 16:44:40)

Offline

#2 2025-02-23 08:55:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [SOLVED] can't define env var without value in user environment.d

Did you try actually setting an empty string?

CMAKE_BUILD_PARALLEL_LEVEL=""

"CMAKE_BUILD_PARALLEL_LEVEL=" would also unset that variable in most shells (bash etc)

Offline

#3 2025-02-23 10:31:14

jronald
Member
Registered: 2022-05-09
Posts: 213

Re: [SOLVED] can't define env var without value in user environment.d

seth wrote:

Did you try actually setting an empty string?

CMAKE_BUILD_PARALLEL_LEVEL=""

not work
using bash

Offline

#4 2025-02-23 14:38:03

astralc
Member
Registered: 2022-09-17
Posts: 126

Re: [SOLVED] can't define env var without value in user environment.d

seth wrote:

"CMAKE_BUILD_PARALLEL_LEVEL=" would also unset that variable in most shells (bash etc)

The only shell I know removing var with "VAR=" is windows cmd (set VAR=).
In zsh and bash I do "unset VAR", VAR= just set it to empty string (but does not remove it).

Offline

#5 2025-02-23 15:41:14

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,774

Re: [SOLVED] can't define env var without value in user environment.d

True indeed. I've too much custom stuff around wink

The syntax only accepts "foo=bar".
If an empty "bar" is treated as "foo=" and that is ignored, you'll have to export CMAKE_BUILD_PARALLEL_LEVEL= from etc/profile.

Offline

#6 2025-02-23 16:43:58

jronald
Member
Registered: 2022-05-09
Posts: 213

Re: [SOLVED] can't define env var without value in user environment.d

seth wrote:

True indeed. I've too much custom stuff around wink

The syntax only accepts "foo=bar".
If an empty "bar" is treated as "foo=" and that is ignored, you'll have to export CMAKE_BUILD_PARALLEL_LEVEL= from etc/profile.

It works, thanks.

/etc/profile.d/cmake.sh

export CMAKE_BUILD_PARALLEL_LEVEL=

Last edited by jronald (2025-02-23 16:44:20)

Offline

Board footer

Powered by FluxBB