Bug 217602 - It is desirable that dot files grow recursive functionality in pw, bsdinstall, etc
Summary: It is desirable that dot files grow recursive functionality in pw, bsdinstall...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: install
Depends on:
Blocks:
 
Reported: 2017-03-07 04:42 UTC by Warner Losh
Modified: 2022-10-13 17:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Warner Losh freebsd_committer freebsd_triage 2017-03-07 04:42:45 UTC
As discussed on IRC with imp, Allan Jude, John Baldwin, and myself...

bsdconfig mirrors the actions of pw(8) with respect to skel (please see the pw(8) manual with respect to skeleton files and the effect the `-m' parameter has on copying of skel files).

At the very least, the suggested change here has to be accompanied by a corresponding change to several other tools, including but not limited to pw(8), adduser(8), and their respective manuals.

A patch that implements the bsdinstall part of the change can be found at https://github.com/freebsd/freebsd/pull/98 and it still applies, included inline for your convenience since it is so simple. Also noted in the code review the -R -n should be -Rn (or maybe that was in the IRC conversation).

Since this isn't a code snippet ready to commit, redirecting to bugzilla per project policy. This should be assigned to dteske@.

usr.sbin/bsdconfig/usermgmt/share/user.subr
 @@ -145,12 +145,12 @@ f_user_copy_dotfiles()
  		[ -e "$file" ] || continue # no-match
  
  		f_shell_escape "$file" "_file"
 -		f_eval_catch $funcname cp "cp -n '%s' '%s'" \
 +		f_eval_catch $funcname cp "cp -R -n '%s' '%s'" \
  			"$_file" "$_user_home_dir/${_file#dot}"
  		retval=$?
  		[ $retval -eq $SUCCESS ] || break
  		f_eval_catch $funcname chown \
 -			"chown -h '%i:%i' '%s'" \
 +			"chown -R -h '%i:%i' '%s'" \
  			"$_user_uid" "$_user_gid" \
  			"$_user_home_dir/${_file#dot}"
  		retval=$?
Comment 1 Serge Volkov 2017-03-07 07:21:35 UTC
I tested the 'adduser' and it copies files from the skeleton directory with subdirectories normally. No further development is required. That's why I proposed a patch #98 for 'bsdconfig'. I think that the 'bsdconfig' should work with user accounts just like 'adduser'.