On Thu, Jul 11, 2013 at 09:55:20AM +0300, Andrei POPESCU wrote: > On Jo, 11 iul 13, 07:12:35, Wilko Fokken wrote: > > > > The following lines explain, what should be done in order to get the dot > > files out of the way into a subdirectory. > > You included lots of unrelated customizations, see below. > > > The dot files of root go into subdir "/root/" > > Err, aren't they already there by default? > You are right; I overlooked this, since I didn't work with an unmofified system.
The improvement, from my point of view, is that a 'cd' w/out params puts the user 'root' into the top directory. > > The dot files of users go into subdir "/home/$HOME/.rc/" > > I'd go for /home/$user/.config (the default XDG directory). This can easyly be accomplished: alter the subdirs in '/etc/skel'. > > HowTo get Dot Files into separate Subdirs at Installation Time > > ============================================================== > > wfok...@web.de July 11 2013 > > > > ( set tabwidth = 4 to view this file ) > > > > > > 1. Modify /etc/skel > > ================ > > > > [from]: > > -rw-r--r-- 1 root root 220 Jan 1 2013 .bash_logout > > -rw-r--r-- 1 root root 3392 Jan 1 2013 .bashrc > > -rw-r--r-- 1 root root 675 Jan 1 2013 .profile > > > > [to]: > > -rw-r--r-- 1 root root 220 Jan 1 2013 .rc/.bash_logout > > -rw-r--r-- 1 root root 3392 Jan 1 2013 .rc/.bashrc > > -rw-r--r-- 1 root root 675 Jan 1 2013 .rc/.profile > > Ok, but this only affects new users. For existing accounts one has to > move the files by hand. -> cp -a '/etc/skel' to '/home/<user>'. (I am used to save my original files into subdir '/ORIG/' before.) > > > [ these three files in .rc/ need to be edited ] : > > ------------------------------------------------- > > > > a) .bash_logout: > > ------------- > > # ~/.bash_logout: executed by bash(1) on logout: > > # clear screen (here = max. 24 virtual text consoles) > > # [ enhance ## of text consoles: add entries in /etc/inittab ] > > > > case "`tty`" in > > /dev/tty[1-9] | /dev/tty1[0-9] | /dev/tty2[0-4] ) clear > > esac > > This is not necessary for the task at hand and the default .bash_logout > already does similar (and better, it doesn't clear *all* consoles, just > because I logged out of one). This example only clears the actual console being left - even with more than six consoles - for me an essential plus when working with text consoles; I easily use compilers, source files and various documents in parallel. > > > b) .bashrc: > > -------- > > # ~/.bashrc: executed by bash(1) for non-login shells. > > # see /usr/share/doc/bash/examples/startup-files > > > > . /etc/profile > > See bash(1) for why this is not needed. As a private user, I log in under more than one user id. This assures that the basic configuration remains identical and can be altered for all users at one location: '/etc/profile.local', even for the graphic modus. Besides any user configuration can eindividually be altered within "$HOME". > > > c) .profile: > > --------- > > > > # ~/.profile, at login autoread by all Bourne-compatible shells (after > > /etc/profile) > > # ~/.profile is *NOT* executed by bash shell if ~/.bash_profile exists > > # All 2nd level bash shells will read ~/.bashrc > > > > # add wanted user owned subdirs, > > # (e.g. sh = shell, pl = perl, py = python scripts) : > > > > for DIR in /home/$LOGNAME/bin /home/$LOGNAME/sh /home/$LOGNAME/pl \ > > /home/$LOGNAME/py; do > > [ -d $DIR ] && PATH=$PATH:$DIR > > done > > These seem to be your own customizations and don't seem to apply to the > task at hand. Only indirect. This example shows that customizations can be simply done as under a standard configuration. > > > PATH=$PATH:. > > Are you sure this is a good idea? This is only added to user's ".profile", not for root. > > export PATH PS1 PS2 > > > > # mesg y > > > > # 'cd' command (below) moves login `pwd` to $HOME/.. ! > > # ----------------------------------------------------- > > # (applies new bash function 'cd ()') > > # (defined in /etc/profile/profile.local) > > > > cd > > > > > > 2. Within /root, modify .bashrc, .profile : > > ======================================== > > > > prepend command: "./etc/profile" to .bashrc > > Are you missing a space here? Yes. > > append command: "cd" to .profile > > > > > > 3. Modify /etc/passwd: login_dir ==> /home/<user>/.rc > > ================================================== > > > > example: > > wwf:x:1001:1001:Wilko Fokken,,,:/home/wwf/.rc:/bin/bash > > So basically you're setting $HOME to be /home/$user/.rc Yes. > > 4. /etc/profile Add call to homebrew /etc/profile.local: > > ======================================================== > > (keeps original condition of /etc/profile) > > > > # ---------------------------------------------------- > > test -f /etc/profile.local && . /etc/profile.local > > test -f ~/.alias.sh && . ~/.alias.sh > > # ---------------------------------------------------- > > > > > > 5. # /etc/profile.local: Modifications to login process > > # ================================================== > > > > # umask 022 > > > > # Unclutter root's and user's HOME_dir: > > # ------------------------------------- > > # root: $HOME => /root $CDHOME => / > > # users: $HOME => /home/<user>/.rc; $CDHOME => /home/<user> > > > > # cutting off {/root | /.rc} from "LOGIN_dir" : > > > > CDHOME=`dirname $HOME` > > > > # "cd" (no params): Go to "LOGIN_dir", NOT to "LOGIN_dir"/.rc : > > > > cd () { > > [ $1 ] && builtin cd $1 || builtin cd ${CDHOME} > > } > > And you are customizing 'cd' to take you to /home/$user/ instead of > /home/$user/.rc .. and to take root to the top '/'. > > > export PATH CDHOME HOME HISTFILE > > > > # ================================================= # > > # End of functions supporting displaced dot files ! # > > ====================================================================== > > > > # (The following lines are NOT directly related to dot files) : > > Why include them then? My '/etc/profile.local' calls '/etc/alias.sh' after the command "unalias *", in order to prevent any (untested) Debian-aliases possibly interfering with my new dot file configuration, as this could confuse a new user. I indicated that this additional procedure is not essential. > Kind regards, > Andrei > Offtopic discussions among Debian users and developers: > http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic Thanks for Your comments, and for this offtopic hint. Wilko -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20130711121256.ga4...@fok01.laje.edewe.de