Refracta Development, Scripts, etc.
Post a reply
fsmithred

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

## Re: change-username and kde4

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.
meandean

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

## Re: change-username and kde4

Tue Jul 03, 2012 2:37 am

gnome shell on wheezy
not using a login manager

Code:
  `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

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

## Re: change-username and kde4

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.
fsmithred

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

## Re: change-username and kde4

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:
  `# 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:
  `# 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.
Post a reply
Jump to:

Powered by phpBB © phpBB Group.

phpBB Mobile / SEO by Artodia.