summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2002-10-14 21:58:41 (UTC)
committer umopapisdn <umopapisdn>2002-10-14 21:58:41 (UTC)
commit09ba6b7531801dde243469f05f5e5c31596cdd2d (patch) (side-by-side diff)
tree07531378e9a05ff777dfb151276075b233bcb4d8
parent14f450ead20011e5697bb36a4ad087cc648b439d (diff)
downloadopie-09ba6b7531801dde243469f05f5e5c31596cdd2d.zip
opie-09ba6b7531801dde243469f05f5e5c31596cdd2d.tar.gz
opie-09ba6b7531801dde243469f05f5e5c31596cdd2d.tar.bz2
Support for a skeleton homedirectory in /etc/skel.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/userdialog.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index c43b391..42a9144 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -111,6 +111,6 @@ void UserDialog::setupTab1() {
skelCheckBox=new QCheckBox(tabpage);
skelCheckBox->setChecked(true);
- skelLabel->setDisabled(true);
- skelCheckBox->setDisabled(true);
+// skelLabel->setDisabled(true);
+// skelCheckBox->setDisabled(true);
// Widget layout
@@ -244,4 +244,20 @@ bool UserDialog::addUser(int uid, int gid) {
adduserDialog->userImage.save(filename,"PNG");
}
+
+ // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory?
+ accounts->findUser(adduserDialog->loginLineEdit->text());
+ if(adduserDialog->skelCheckBox->isChecked()) {
+ QString command_cp;
+ QString command_chown;
+ command_cp.sprintf("cp -a /etc/skel/* %s/",accounts->pw_dir.latin1());
+ system(command_cp);
+
+ command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1()); // Bug in busybox, ".*" includes parent directory, does this work as a workaround?
+ system(command_cp);
+
+ command_chown.sprintf("chown -R %d:%d %s",accounts->pw_uid,accounts->pw_gid,accounts->pw_dir.latin1());
+ system(command_chown);
+ }
+
return true;
}