# refracta.freeforums.org

place to talk about refracta

Skip to content

Welcome
Welcome to refracta You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

## change-username and kde4

Refracta Development, Scripts, etc.
Post a reply
14 posts • Page 2 of 2 • 1, 2

### Re: change-username and kde4

by fsmithred » Sun Jul 01, 2012 4:05 pm

Was just reading the block of code regarding gdm3 and autologin. That code is not active, but I think I'll need to account for autologin, in case anyone is using this script with a live distro that has it enabled. Otherwise, the display manager may hang while trying to log in the non-existent user.
Oh, it gets worse...
If console autologin is enabled, the script will die with a usermod error if you're running it from a console in which you used 'su' to get root. Dropping to runlevel 1 gets around this. That's how I dealt with the problem when I wrote an earlier version of this script for debian-live. The other way to fix this is to include the code in the cli refractainstaller, just as it is in the gui version, and make the changes in chroot.

fsmithred
  Posts: 1987
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: change-username and kde4

by meandean » Tue Jul 03, 2012 2:37 am

gnome shell on wheezy
not using a login manager

Code: Select all
  `sed: can't read ^home^minnow^.gconf^apps^gksu^%gconf.xml: No such file or directory
  `

^==/
I also noticed another error. If you cat ^etc^passwd you will see that the $newname is added to a number of accounts.
Oh, and I do not use gnome-keyring so I reckon that is why I never run into the error you mentioned earlier.

meandean
  Posts: 392
  Joined: Wed Mar 09, 2011 5:16 am

Top

### Re: change-username and kde4

by meandean » Tue Jul 03, 2012 3:53 am

If you want me to test with certain software installed, certain configuration, certain usernames, or whatever then just let me know otherwise I will just keep playing around with whatever I happen to have installed at the time.

meandean
  Posts: 392
  Joined: Wed Mar 09, 2011 5:16 am

Top

### Re: change-username and kde4

by fsmithred » Tue Jul 03, 2012 11:10 am

> meandean wrote:I also noticed another error. If you cat ^etc^passwd you will see that the $newname is added to a number of accounts.

Yikes! I think that happened because the primary user's name (user) appears in other lines of ^etc^passwd, and the code to change the user's real name will find those lines and change them. OK, I think I got the fix. Starting at line 162 or so, this:

Code: Select all
  `# Change user's real name
  live_user=$(awk -v pattern="$newname" -F: '$0 ~ pattern { print $5 }' ^etc^passwd) # (using your nomenclature: ^==/)
  echo -n "
  The user's real name is currently $live_user.
  Enter the real name you want to use (without the trailing commas.)
  "
  read real_name
  sed -i~ "s^$live_user^$real_name,,,^" ^etc^passwd`

should be changed to:

Code: Select all
  `# Change user's real name
  live_user=$(awk -v pattern="$newname" -F: '$1 ~ pattern { print $5 }' ^etc^passwd)
  echo -n "
  The user's real name is currently $live_user.
  Enter the real name you want to use (without the trailing commas.)
  "
  read real_name
  sed -i~ "s^$live_user^$real_name,,,^" ^etc^passwd`

Change $0 to $1, so awk only looks for the pattern in the first field. Here's a little test script -
https://gist.github.com/3039075
Thanks for testing, and please keep testing whatever you want. You're finding stuff that I didn't think of, and I don't want to limit that.
Edit: Same code needs to be changed at line 1026 or so of refractainstaller-gui.

fsmithred
  Posts: 1987
  Joined: Wed Mar 09, 2011 9:13 pm

Top

Previous Display posts from previous:
Sort by

Post a reply
14 posts • Page 2 of 2 • 1, 2

Return to Discuss

Jump to:

### Who is online

Users browsing this forum: No registered users and 0 guests

Donate Now
ProNight Style by ModphpBB3
Hosted by © 2017 FreeForums.org | Create a free forum | Powered by phpBB
A Member of the Crowdgather Forum Community
About FreeForums | Legal | Advertise Here | Investors | Contact FreeForums.org
Report Violation
suspicion-preferred