On Mon March 3 2008 11:37, Tobias Gablunsky wrote:
> > On Mon March 3 2008 09:18, Tobias Gablunsky wrote:
> > > > -----Original Message-----
> > > > From: Larry Smith [mailto:lesmith (at mark) ecsis.net]
> > > > Sent: Monday, March 03, 2008 2:04 PM
> > > > To: coba-e (at mark) bluequartz.org
> > > > Subject: [coba-e:12168] Re: AW: Provisioning
> > > >
> > > > On Mon March 3 2008 05:50, Tobias Gablunsky wrote:
> > > > > > Believe the BQ system still uses the /etc/skel structure
> > > >
> > > > (according to
> > > >
> > > > > > the programs anyway) so you should be able to create
> >
> > the structure
> >
> > > > > > or template of what you want in an user account in
> > > > > > /etc/skel/user/<lang>
> > > > > > directory and it will "recreate" that for each user you add
> > > > > > to the system.
> > > > > > (where <lang> is the two letter language abbreviation).
> > > > > >
> > > > > > --
> > > > > > Larry Smith
> > > > > > lesmith (at mark) ecsis.net
> > > > >
> > > > > Thanks for your hint!
> > > > >
> > > > > This works perfectly for files and folders I put into
> >
> > the /etc/skel
> >
> > > > > structure - but not if they are hidden.
> > > > >
> > > > > As there are hidden files that are copied into a new users
> > > >
> > > > home (e.g.
> > > >
> > > > > /etc/skel/.bashrc) it cannot just be the hidden type of the
> > > >
> > > > file. Any more
> > > >
> > > > > ideas?
> > > >
> > > > Appears the "hidden" files are directly referenced
> > > > in /usr/sausalito/perl/Base/User.pm, so you may have to
> > > > modify that file
> > > > to get your hidden files to copy, but reading the
> >
> > program(s), it uses
> >
> > > > "cp -r /etc/skel/user/<lang>" to copy the files which
> >
> > should also get
> >
> > > > any hidden (leading dot) files. Check the mode and
> >
> > ownership of any
> >
> > > This is right but you are wrong ;)
> > >
> > > The above syntax is as you said, exactly on my system it is:
> > >
> > > system("/bin/cp -r $user->{skel}/*
> > > $user->{homedir}");
> > > system("/bin/cp /etc/skel/.bash*
> >
> > $user->{homedir}");
> >
> > > And on the second line one can see that "cp -r" does not
> >
> > copy the hidden
> >
> > > files on the first directory (the problem is the shell-expansion of
> > > "<path>/*"). So when I change the second line of the code above to
> > >
> > > system("/bin/cp /etc/skel/.* $user->{homedir}");
> > >
> > > (I remove the word "bash") then everything works as I want it to.
> > >
> > > Maybe someone on the list can say if it is of any risk to
> >
> > put this into
> >
> > > the original package ("base-user-glue").
> > >
> > > Because I now have to deal with the files of the original
> >
> > distribution
> >
> > > which is exactly what I tried to avoid.
> > >
> > > > files you have put under /etc/skel.
> > >
> > > Thanks for your help anyway,
> >
> > Tobias,
> >
> > My "command" was not meant to be "exact" but to relay what
> > the system was doing. In that context, add _your_ hidden files
> > under the appropriate directory (/etc/skel/user/<lang>) and the
> > cp -r should get them correctly without any modification to the
> > system area programs.
>
> But it doesn't!
> The command used in /usr/sausalito/perl/Base/User.pm is _exactly_:
>
> system("/bin/cp -r $user->{skel}/* $user->{homedir}");
> system("/bin/cp /etc/skel/.bash* $user->{homedir}");
>
> The first line doesn't copy hidden files in the first directory
> ($user->{skel} expands to /etc/skel/user/<lang>) because of the bash
> expansion of the "*" operator. It does not match on hidden files in this
> directory. This line copies hidden files in Subdirectories. But I need
> to copy a ".procmailrc" directly into every new users home.
> The second line does match on hidden files, but only on those beginning
> with ".bash".
> That's the reason why I have to edit the system area programs.
>
> > > Thanks for your help anyway,
> >
> > Not sure if I understand the context of the "anyway" in the above
> > statement, but I can most certainly stop answering any of your
> > questions if my assistance is not helpful in "anyway".
>
> Don't understand me wrong please.
> You helped me very much in understanding the way the system works in
> creating a user _but_ I'm afraid I have to change the User.pm above
> "anyway". - maybe "nevertheless" would be a better word but I'm afraid I
> dont feel that confident in writing in your language
>
Tobias,
Ok, water under the bridge as they say here.
I have done some testing and you are correct. It is interesting that
the commands run by hand (the cp -r) work just fine and copy everything
that is under the /etc/skel/user/<lang> directory. My test case was
> cp -r /etc/skel/user/en /home/sites/sitexx/user/testaccount
and it copied both the directories (web and Maildir) and the .procmailrc
I had created in that skel directory. But when run through the GUI
to add user, it only copies the directories and not the .procmailrc file.
It appears from reviewing the code, the mkpath command just before the
beginning of the if statement surrounding the copy command is the
culprit, but commenting that out and changing the copy line (cp -r) to
just the directory name (drop the trailing asterick (*)) did not work
either - in fact it results in a handler error and the account does not
get created. Other test changes resulted in strange things like copying
the entire /etc/skel structure into (under) the user account....
What we (the greater collective BQ list) need to figure out is the "right"
way to modify the GUI so that any files created under the appropriate
skeleton directory get copied to the user and/or site directory. Possibly
change from the mkpath command to using the system adduser command
with the -m flag (create home directory using the /etc/skel structure)
or something like that. I know of several situations where it would be
really nice to be able to "modify" the default install such as what you
are attempting to do with the procmailrc file, Maildir directory, robots.txt
files, etc, etc... I am just not good enough (and do not have enough
experience with the sausalito interface to do it without breaking other
things.
--
Larry Smith
lesmith (at mark) ecsis.net