You are not logged in.
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
Offline
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
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
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
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.
//github/
Offline
Yes, this one is definitely the cleanest solution
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
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)
Website: andrwe.org
Offline
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
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 .
//github/
Offline
Offline
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
I installed the git version and now i can't log in
bash cdm:command not found
then I'm back to login.
Offline
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
Offline
I'll give that a go. Thanks
Offline
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
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
Offline
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.
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
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.
Website: andrwe.org
Offline
Offline
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?
Website: andrwe.org
Offline
^^
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.
Website: andrwe.org
Offline
!!!!ATTENTION!!!!
The following content can cause heavy aggressions.
Hey,
I've finished my theme.
It is called ed and here is a screenshot of it:
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)
Website: andrwe.org
Offline