Re: Setting default $PATH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I forgot to CC the list when I wrote these messages:

First message:

I found something weird and I wonder if I should report a bug in the setup package or not.
I've created /etc/profile.d/custom.sh, where I redefine PATH in order to have /usr/local after /usr for all users.
But the files in /etc/profile.d/ are executed twice (in /etc/bashrc and /etc/profile), and if a user sets PATH to PATH=$PATH:$HOME/bin, it won't be taken into account.

Here is what happens when I start my KDE session + open Konsole:

/etc/profile is called by login
/etc/profile.d/custom.sh is called by /etc/profile
~/.bash_profile is called
/etc/profile.d/custom.sh is called (by ~/.bashrc which calls /etc/bashrc)

As a result, the user will have the PATH I've defined in custom.sh, but he can't append something to it.

Second message:

I've added a test at the beginning of /etc/profile.d/custom.sh so that it is executed only once:

if shopt -q login_shell ; then
    unset PATH

    if [ "$EUID" = "0" ]; then
        PATH=/sbin:/bin:/usr/sbin:/
usr/bin:/usr/local/sbin:/usr/local/bin
    else
        PATH=/usr/bin:/bin:/usr/games:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
    fi

    export PATH
fi

That's way I don't need to change anything user side.
But it's a bit ugly and I don't think others distributions have this problem.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux