View RSS Feed

tsu2

/etc/profile

Rate this Entry
Quote Originally Posted by eng-int View Post
Quote Originally Posted by dcurtisfra View Post
Or, even better, fo rcibly re-install the package which provides "/etc/profile":-- aaa_base-13.2+git20140911.61c1681-27.2.x86_64
Unfortunately although aaa_base may provide /etc/profile it does not seem to actually write it.

(@nrickert -- I did check for the presence of a .rpmnew or .rpmsav before copying from profile.)

This is what I just did:
Code:
ns3:/etc # lh -d prof*
-rw-r--r--   1 root root    9.0K Jul  7  2017 profile
drwxr-xr-x   2 root root    1.2K Mar 31 15:09 profile.d

ns3:/etc # cp -a profile profile.good
ns3:/etc # echo "## ray" >>  profile
ns3:/etc # grep "^##" profile
## ray
ns3:/etc # 

ns3:/etc # zypper install --force aaa_base
Loading repository data...
Reading installed packages...
Forcing installation of 'aaa_base-13.2+git20140911.61c1681-27.2.x86_64' from repository '42.3-Repo-oss'.
Resolving package dependencies...

The following package is going to be reinstalled:
  aaa_base

1 package to reinstall.
Overall download size: 132.5 KiB. Already cached: 0 B. No additional space will be
used or freed after the operation.
Continue? [y/n/...? shows all options] (y): 
Retrieving package aaa_base-13.2+git20140911.61c1681-27.2.x86_64
                                               (1/1), 132.5 KiB (262.2 KiB unpacked)
Retrieving: aaa_base-13.2+git20140911.61c1681-27.2.x86_64.rpm ..[done (164.8 KiB/s)]
Checking for file conflicts: .................................................[done]
(1/1) Installing: aaa_base-13.2+git20140911.61c1681-27.2.x86_64 ..............[done]
Additional rpm output:
Updating /etc/sysconfig/language...                                                 
Updating /etc/sysconfig/backup...                                                   
Updating /etc/sysconfig/proxy...                                                    
Updating /etc/sysconfig/windowmanager...                                            
Updating /etc/sysconfig/news...                                                     
Updating etc/passwd...unchanged                                                     
Updating etc/group...unchanged                                                      
Updating etc/shadow...unchanged                                                     


ns3:/etc # lh -d prof*
-rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
-rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good

ns3:/etc # grep "^##" profile
## ray
 
ns3:/etc # lh -d prof*
-rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
-rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good
ns3:/etc #
Could someone please either confirm this or tell me where I have gone wrong.
I can verify.
So, after the testing I'll describe my solution (skip to end of this post)

On one of my machines, it somehow had escaped my attention and was still 42.1.
So, taking advantage of the situation, I inspected /etc/profile and found that the trailing back-slashes were there (not missing),
Then to test the perserverance of edits to this file I added a comment to the end of this file and then
Upgraded the machine (from 42.1 to 42.3).
The test comment inserted into /etc/profile survived the upgrade.

I then tested for replacing /etc/profile with a forced re-install.
First, to determine and verify the package which contains the file I ran
Code:
zypper se -x --provides /etc/profile
Verifying the package is aaa_base, I then ran
Code:
zypper in -f aaa_base
Inspecting the file /etc/profile again, I still found the inserted test comment.

So, apparently someone has gone out of its way to make sure that the /etc/profile is not over-written.
This may be useful in some cases (I remember a Forum thread which discussed where the official documentation for some app instructed direct edits to /etc/profile) but as we can see in this thread that the behavior is unexpected.

My solution:
Code:
# rm /etc/profile
# zypper in -f aaa_base
Verified this installs a default /etc/profile.

HTH,
TSU

Submit "/etc/profile" to Digg Submit "/etc/profile" to del.icio.us Submit "/etc/profile" to StumbleUpon Submit "/etc/profile" to Google Submit "/etc/profile" to Facebook Submit "/etc/profile" to Twitter

Categories
Uncategorized

Comments