You are not logged in.

#51 2009-11-18 10:41:14

Splex
Member
Registered: 2009-03-09
Posts: 33

Re: The Console Display Manager

I was wondering why all the /etc/profile.d/* scripts were not being loaded when using cdm...  i finally realized that the /etc/profile.d scripts are probably executed in alphabetical order and that all scripts after /etc/profile.d/cdm-profile.sh would not get loaded until the /usr/bin/cdm script is ended.

Is there a way to ensure cdm doesn't block all of the login scripts from being loaded? maybe somehow detach the process or have it get called at the end?

Last edited by Splex (2009-11-18 10:42:03)

Offline

#52 2009-11-18 12:49:59

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

Just pushed an update that (may) fix the incrementation issue based on moljac024's code... if that works, i'll start working on the profile issue.


.:[My Blog] || [My GitHub]:.

Offline

#53 2009-11-18 16:13:51

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: The Console Display Manager

I don't think this will work:

if [[ `xdpyinfo -display :${display}.0 &> /dev/null` != "1" ]]; then

You're confusing a command's output with the commands exit status. I think that this way it will never equal anything else than an empty string since you're also redirecting it's output into /dev/null. Perhaps this is the best solution for now:

xdpyinfo -display :$display.0 &> /dev/null
X_RUNNING=$?

Then you just check the value of X_RUNNING.


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#54 2009-11-18 16:40:53

choubi
Member
Registered: 2009-10-08
Posts: 15

Re: The Console Display Manager

In that case this should do it

xdpyinfo -display :${display}.0 &> /dev/null && echo "X is running on display ${display}

or better

xdpyinfo -display :${tmp_display}.0 &> /dev/null || display=$tmp_display

Last edited by choubi (2009-11-18 16:46:00)

Offline

#55 2009-11-18 16:45:02

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: The Console Display Manager

Actually we're just being silly. In bash if tests for an exit status of a command.
Just remove the brackets and backticks, e.g. :

if xdpyinfo -display :$display.0 &> /dev/null; then
   echo "Switching to X..."
else
   echo "Starting X..."
fi

The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#56 2009-11-18 18:35:52

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

Do we have multiple verifications for any of the posted solutions? I'm at work and can't test it until I get home tonight.


.:[My Blog] || [My GitHub]:.

Offline

#57 2009-11-18 18:55:32

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: The Console Display Manager

Ghost1227 wrote:

I'm at work and ...

Ghost! that's great news!

oh, and i can confirm that

if some_command; then
  # do this if successful
fi

# or even

if ! some_command; then
  # do this if failed
fi

are valid [and my preferred] bashisms for this case.  dunno if they solve whatever your issue at hand was though.

personally, i do 'if ! grep -q 'something' ./somefile; then ...' all the time.

Offline

#58 2009-11-18 19:23:12

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: The Console Display Manager

Yes, this one is definitely the cleanest solution wink

if xdpyinfo -display :$display.0 &> /dev/null; then
   echo "Switching to X..."
else
   echo "Starting X..."
fi

The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#59 2009-11-18 20:07:25

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: The Console Display Manager

So I solved it now you had some mistakes in your code:

if [ "${locktty}" == "yes" ]; then
    # Verify display exists
    if `echo ""${display}"" | grep [^0-9] &> /dev/null`; then
        display=0
    fi
    # Activate existing X session
    if xdpyinfo -display :${display}.0 &> /dev/null; then
        let tty=${display}+${xtty}
        chvt ${tty}
        exit 0
    fi
else
    # Get the first empty display
    display=0
    while [ ${display} -lt 7 ]; do
        if xdpyinfo -display :${display}.0 &> /dev/null; then
            let display=${display}+1
        else
            break
        fi
    done
fi

There was a mistake in you while condition there are [] needed to mark the condition and if you want to compare numbers just use -lt -eq -le and so on (man test for all of them).

xstart() {
    # Start X
    if [ "${loginshell}" == "yes" ]; then
        if [ "${wm_bin}" == "gnome-session" ]; then
            exec bash --login -c "startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null" &
        else
            exec ck-launch-session bash --login -c "startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null" &
        fi
    else
        if [ "${wm_bin}" == "gnome-session" ]; then
            exec startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null &
        else
            exec ck-launch-session startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null &
        fi
    fi
}

If you just compare strings only use [] one time because double brackets start regular expression since bash 3.2 although if you want regex never enclose it with "" (see http://tldp.org/LDP/abs/html/bashver3.h … EXMATCHREF) and the option -c of bash needs the command which should be started to be in "".

For me the change of this both works so I think you just need to use it in your code and it should work.

And also congratulation.

Last edited by Andrwe (2009-11-18 20:16:00)

Offline

#60 2009-11-18 20:28:22

kjon
Member
From: Temuco, Chile
Registered: 2008-04-16
Posts: 398

Re: The Console Display Manager

off-topic: Seems I have a long way to follow, before I can improve my bash-fu skills.

ghost1227 & gang. This stuff is impressive... xD.


They say that if you play a Win cd backward you hear satanic messages. That's nothing! 'cause if you play it forwards, it installs windows.

Offline

#61 2009-11-18 20:38:17

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: The Console Display Manager

just a little nitpicking...

good

if `echo ""${display}"" | grep [^0-9] &> /dev/null`; then
  display=0
fi

better

if echo ""${display}"" | grep -q [^0-9]; then
  display=0
fi

best

if [ -n "${display//[0-9]/}" ]; then
  display=0
fi

<3 bash smile.

Offline

#62 2009-11-19 04:13:12

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

@Andrwe: Thanks, that works perfectly! That's what I get for coding on no sleep.
@kjon: I'm glad you like it!
@brisbin33: As usual, I'll secede to your superior bash-fu... thanks for the tip!


.:[My Blog] || [My GitHub]:.

Offline

#63 2009-11-19 05:29:54

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

Several minor (and one or two major) bugfixes later, another release of CDM is ready. Come and get it!


.:[My Blog] || [My GitHub]:.

Offline

#64 2009-11-19 10:30:07

KimTjik
Member
From: Sweden
Registered: 2007-08-22
Posts: 715

Re: The Console Display Manager

I just yesterday noticed you archish contribution. Thanks a lot!

The loginshell option made my keyboard layouts work as well. I'm really happy about this simpler solution.

Offline

#65 2009-11-19 16:43:57

ArryRoberts
Member
Registered: 2008-07-21
Posts: 7

Re: The Console Display Manager

I installed the git version and now i can't log in

bash cdm:command not found

then I'm back to login.

Offline

#66 2009-11-19 17:06:10

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

That's my fault, the git version doesn't properly install the cdm executable (i accidentally referenced it as cdm-git instead of cdm in the PKGBUILD). At the moment, cdm and cdm-git are identical. Unfortunately there's no way to bypass the cdm executable at the moment... I'll have to fix the startup script to drop to console on error or something when I get home from work. My best advice is to boot into a live cd and replace the -git version with the stable version, which is tested to work.

NOTE TO SELF: FIX CDM-GIT PKGBUILD AND ADD FAILSAFE FOR STARTUP SCRIPT


.:[My Blog] || [My GitHub]:.

Offline

#67 2009-11-19 17:36:32

ArryRoberts
Member
Registered: 2008-07-21
Posts: 7

Re: The Console Display Manager

I'll give that a go. Thanks

Offline

#68 2009-11-19 21:06:46

gajo
Member
Registered: 2008-04-01
Posts: 93
Website

Re: The Console Display Manager

i'm about to try this on gentoo, but i don't have consolekit installed so ill try removing it from the lines it's mentioned; will that have any severe consequences?
edit: hm, gave it a try, i got a message "bash : no job control" and got direct root privileges without needing to login, and the rest of my init scripts stopped loading, which is somethnig i didn't really want tongue
but it was my first attempt at making a new init script, something might've gone wrong there,  ill check it again in the coming days and give you an update, if you're interested, i do look forward to an easy console login that goes to X without needing to hassle with startx and such;

Last edited by gajo (2009-11-19 21:33:40)

Offline

#69 2009-11-20 00:18:08

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

I do intend on providing support for other distributions. I'd be more than willing to take a look at the gentoo initscripts and see what we'd have to do to provide support to you.


.:[My Blog] || [My GitHub]:.

Offline

#70 2009-11-20 07:38:42

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: The Console Display Manager

gajo wrote:

i'm about to try this on gentoo, but i don't have consolekit installed so ill try removing it from the lines it's mentioned; will that have any severe consequences?

It shouldn't be a problem.

galo wrote:

edit: hm, gave it a try, i got a message "bash : no job control" and got direct root privileges without needing to login, and the rest of my init scripts stopped loading, which is somethnig i didn't really want tongue
but it was my first attempt at making a new init script, something might've gone wrong there,  ill check it again in the coming days and give you an update, if you're interested, i do look forward to an easy console login that goes to X without needing to hassle with startx and such;

CDM is no login manager like slim or quingy so do NOT start it using init script.
It just give an interface to choose the things which follow after the login which should be done by other progs like agetty.
CDM itself should be started by a profile specific file like these in /etc/profile.d/.

It's been some time since I'd changed to Arch from Gentoo so I don't really know where the files are located which are executed after login on Gentoo.

Offline

#71 2009-11-20 12:07:36

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

By 'init scripts' I believe he was speaking generally about files such as those in /etc/profile.d that are sourced/executed during the init process... although I could be way off here. that was just my impression


.:[My Blog] || [My GitHub]:.

Offline

#72 2009-11-20 12:18:11

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: The Console Display Manager

k, I got the impression that he'd called cdm by something like inittab instead of agetty because he "got direct root privileges without needing to login" and that would be the case if cdm is called by root e.g. instead of getty.
Or am I wrong?

Offline

#73 2009-11-20 12:52:01

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: The Console Display Manager

that'd be an odd scenario... cdm would get called by inittab, then after they selected their wm it would resource cdm from /etc/profile.d.....


.:[My Blog] || [My GitHub]:.

Offline

#74 2009-11-20 13:14:21

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: The Console Display Manager

^^
I know it is odd but hey there are users in front of a computer who doesn't know how to turn it on/off.
So there can also be users who use this scenario.

Offline

#75 2009-11-20 15:16:09

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: The Console Display Manager

!!!!ATTENTION!!!!
The following content can cause heavy aggressions.


Hey,
I've finished my theme. smile
It is called ed and here is a screenshot of it:
tMnRieQ

and here is the config of it:

# Set aspect-ration.
aspect = 0

# Shadow dialog boxes? This also turns on color.
use_shadow = ON

# Turn color support ON or OFF
use_colors = ON

# Screen color
screen_color = (WHITE,GREEN,ON)

# Shadow color
shadow_color = (GREEN,WHITE,ON)

# Dialog box color
dialog_color = (WHITE,GREEN,ON)

# Dialog box title color
title_color = (BLUE,GREEN,ON)

# Dialog box border color
border_color = (WHITE,GREEN,ON)

# Active button color
button_active_color = (GREEN,WHITE,OFF)

# Inactive button color
button_inactive_color = (WHITE,GREEN,OFF)

# Active button key color
button_key_active_color = (RED,WHITE,ON)

# Inactive button key color
button_key_inactive_color = (BLACK,GREEN,OFF)

# Active button label color
button_label_active_color = (BLACK,WHITE,ON)

# Inactive button label color
button_label_inactive_color = (RED,GREEN,OFF)

# File position indicator color
position_indicator_color = (BLACK,WHITE,ON)

# Menu box color
menubox_color = (WHITE,GREEN,ON)

# Menu box border color
menubox_border_color = (WHITE,GREEN,ON)

# Item color
item_color = (BLACK,GREEN,OFF)

# Selected item color
item_selected_color = (BLACK,WHITE,ON)

# Tag key color
tag_key_color = (RED,GREEN,OFF)

# Selected tag key color
tag_key_selected_color = (RED,WHITE,ON)

# Up arrow color
uarrow_color = (WHITE,GREEN,ON)

# Down arrow color
darrow_color = (WHITE,GREEN,ON)

Last edited by Andrwe (2009-11-20 15:18:01)

Offline

Board footer

Powered by FluxBB