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 script needs to know display manager

Refracta Development, Scripts, etc.

Re: change-username script needs to know display manager

Postby dzz » Sun Nov 03, 2013 5:51 pm

(current release 3.5.13): Won't work because ps -C output is "kdm" whether it's trinity or kde4

The actual initscript is etc/init.d/kdm-trinity {start|stop|restart|reload|force-reload} (Irritatingly, no "status" option).. sysv-rc-conf --list is just a way to identify it properly and if it's active in any runlevel

EDIT: Another way:
Code: Select all
if ls (/)etc/rc*.d|grep kdm-trinity|grep ^S ; then
   dm="kdm-trinity"
   else
   # is official kde (4x) KDM
     dm="kdm"
   fi

(R14 testing versions): ps -C output is "tdm"

The actual initscript is etc/init.d/tdm-trinity {start|stop|restart|reload|force-reload}
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: change-username script needs to know display manager

Postby raymerjacque » Sun Nov 03, 2013 7:36 pm

fsmithred wrote:@raymerjacque: Could you post the ouput of this command for me, please? That way, I can see what processes are actually running when you're on the desktop.
Code: Select all
ps ax |grep mdm
Thanks.

@dzz: Thanks, that looks much better.


here you go :

[email protected]:~$ ps ax |grep mdm
3176 ? Ss 0:00 /usr/sbin/mdm
3177 ? S 0:02 /usr/sbin/mdm
3200 tty7 Ss+ 341:15 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt7
7570 pts/0 S+ 0:00 grep mdm
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

Re: change-username script needs to know display manager

Postby fsmithred » Mon Nov 04, 2013 2:06 pm

@raymerjacque: Thanks. I'll add mdm to the list. I assume the init script for it is (/)etc/init.d/mdm. Let me know if that's wrong.

@dzz: Just to be clear - there is no (/)etc/init.d/tdm? I like the 'sysv-rc-conf --list' but I'd rather avoid it so the script works in cases where that's not installed. The change-username script can be used at any time to change any user's name and home, not just for installation.
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: change-username script needs to know display manager

Postby dzz » Mon Nov 04, 2013 9:09 pm

Just to be clear - there is no (/)etc/init.d/tdm? I like the 'sysv-rc-conf --list' but I'd rather avoid it so the script works in cases where that's not installed. The change-username script can be used at any time to change any user's name and home, not just for installation

Depending if "release" or "testing" version:

The actual initscript is named (/)etc/init.d/kdm-trinity or (/)etc/init.d/tdm-trinity

The actual executable is /opt/trinity/bin/kdm or /opt/trinity/bin/tdm

The process detected by ps is "kdm" or "tdm" so (if kdm) an extra check is needed to see if it's not kde4

True, sysv-rc-conf might not be installed so that's not the best way. Some alternatives:

Code: Select all
ps ax|grep -v grep|grep /opt/trinity/bin/kdm

ls (/)etc/rc*.d|grep kdm-trinity|grep ^S

pgrep -lf "/opt/trinity/bin/kdm"
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: change-username script needs to know display manager

Postby fsmithred » Tue Nov 05, 2013 3:49 am

Here's another option I'm considering:
Code: Select all
init 1
Then it won't matter what dm is used. Kinda reminds me of Monty Python hunting mosquitoes with rocket launchers.

Something like this might work, too:
Code: Select all
# This one gives error message for each missing file.
dm_list=$(ls (/)etc/init.d/{gdm,kdm,lightdm,gdm3} 2>/dev/null)

select display_manager in "$dm_list"; do
   #"$display_manager" restart
   echo "$display_manager"
   break
done
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: change-username script needs to know display manager

Postby fsmithred » Tue Nov 05, 2013 4:27 am

Still missing:
cdm, lxdm, qingy, sddm, entrance, enter, orthos, and maybe others.
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: change-username script needs to know display manager

Postby fsmithred » Tue Nov 05, 2013 4:50 am

Even better, I think - remove that whole section. All it does is make it so you don't have to hit ctrl-alt-F7. (It's code that I borrowed from display-savior, where it really is needed.)
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Previous

Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

cron
suspicion-preferred