+ DESIRED_PATH='PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"'
+ if ! grep -qs "$DESIRED_PATH" /etc/environment ; then
+ echo $DESIRED_PATH > /etc/environment
This will unconditionally add a new PATH line to /etc/environment unless that exact path is already present. A little bit more finessing is wanted here. We want to:
- add the PATH variable on new installs
- on upgrades from versions of the package earlier than 1.1.3-7ubuntu2, *insert* /usr/local/games into the path - don't clobber the path, because if the local admin has modified the path, we don't want to override that setting.
I think the command to use for inserting the added path would be something like:
sed -i -e'/^PATH / s,\(:/usr/games\),:/usr/local/games\1,' /etc/environment
And then the version number check needs to be fixed up as well, since currently the code only runs on new installs or when upgrading from a very, very ancient version of libpam-modules.
+ DESIRED_ PATH='PATH= "/usr/local/ sbin:/usr/ local/bin: /usr/sbin: /usr/bin: /sbin:/ bin:/usr/ games:/ usr/local/ games"'
+ if ! grep -qs "$DESIRED_PATH" /etc/environment ; then
+ echo $DESIRED_PATH > /etc/environment
This will unconditionally add a new PATH line to /etc/environment unless that exact path is already present. A little bit more finessing is wanted here. We want to:
- add the PATH variable on new installs
- on upgrades from versions of the package earlier than 1.1.3-7ubuntu2, *insert* /usr/local/games into the path - don't clobber the path, because if the local admin has modified the path, we don't want to override that setting.
I think the command to use for inserting the added path would be something like:
sed -i -e'/^PATH / s,\(:/usr/ games\) ,:/usr/ local/games\ 1,' /etc/environment
And then the version number check needs to be fixed up as well, since currently the code only runs on new installs or when upgrading from a very, very ancient version of libpam-modules.