Hi Chris,
Chris Gianelloni wrote:
> I wouldn't see a
> problem with that considering I am about to add X resolution support to
> mkxf86config, and it gets that information from the command line.
I currently had a lot of trouble with mkxf86config (it didn't work with
my synaptics touchpad on my laptop) and came to a smaller (and hopefully
better maintainable) solution. It's in the attachment. Currently, one
should have fbset to use it, if /proc/cmdline gives no information. My
/etc/init.d/x-setup is in the attachment.
Another thing that is inspired by Paul is /etc/init.d/user that sets
user preferences. Currently, it requires gdm to work, but might easily
be adopted to kdm. I shortly looked at xdm, but found no auto-login
option for xdm, so probably it won't work with that.
Greetings,
Georg
#!/sbin/runscript
depend() {
before xdm local
use openca-setup
}
start() {
# USER is the desired user, as specified in Kernel args
USER=`cat /proc/cmdline | awk -F user= '{print $2}' | awk '{ print $1
}'`
if [ -z "$USER" ]
then
USER="root"
fi
#XSESSION sets the desired xsession. See /etc/X11/Sessions/
XSESSION=`cat /proc/cmdline | awk -F xsession= '{print $2}' | awk '{
print $1 }'`
if [ -z "$XSESSION" ]
then
XSESSION="Xfce-4"
fi
# EDITOR is the default editor on the system
EDITOR=`cat /proc/cmdline | awk -F editor= '{print $2}' | awk '{ print
$1 }'`
if [ -z "$EDITOR" ]
then
EDITOR="/usr/bin/vim"
fi
# Set up Directory on exchangeable medium (if needed)
if [ -z "$LOOP_MNT" ]
then
LOOP_MNT=/mnt/openca
mkdir -p $LOOP_MNT
fi
einfo "user is $USER"
if [ "$USER" = "root" ]
then
if [ ! -d $LOOP_MNT/$USER ]
then
cp -af /root $LOOP_MNT/
fi
mount -o bind $LOOP_MNT/$USER /root
# create symlinks from /root/* to / since / is $HOME for root
cd /
for i in `ls -A /root`
do
ln -s /root/"$i" .
done
cd -
else
if [ ! -d $LOOP_MNT/$USER ]
then
cp -af /root $LOOP_MNT/
mv $LOOP_MNT/root $LOOP_MNT/$USER
fi
mkdir -p /home/$USER
mount -o bind $LOOP_MNT/$USER /home/$USER
chown $USER\:users /home/$USER -R
if [ ! `grep -q $USER /etc/passwd` ]
then
/usr/sbin/useradd -d /home/$USER -g users \
-G wheel,audio,cdrom,games,usb \
-s /bin/bash
fi
fi
# This edits the /etc/rc.conf changing the default editor to $EDITOR
sed -i \
-e 's/EDITOR="\/bin\/nano"/#EDITOR="\/bin\/nano"/g' \
/etc/rc.conf
sed -i '/# Set EDITOR to your preferred editor./ a EDITOR=\"'`echo
$EDITOR`'\"
' /etc/rc.conf
# sets the display manager to gdm
sed -i \
-e 's/#DISPLAYMANAGER="xdm"/DISPLAYMANAGER="gdm"/g' \
/etc/rc.conf
# sets the session to $XSESSION
sed -i \
-e 's/#XSESSION="Gnome"/XSESSION="'`echo $XSESSION`'"/g' \
/etc/rc.conf
# This edits /etc/X11/gdm/gdm.conf and enables a timed login with a 1
# second delay for the $USER
sed -i \
-e 's/TimedLoginEnable=false/TimedLoginEnable=true/g' \
-e 's/TimedLogin=/TimedLogin='`echo $USER`'/g' \
-e 's/TimedLoginDelay=30/TimedLoginDelay=1/g' \
/etc/X11/gdm/gdm.conf
# fix sudo
# Stuff to get sudo setup right
chmod 755 /
sed -i -e '1,18 s/Defaults/# Defaults/' /etc/sudoers
sed -i -e '/# Defaults:%wheel/ s/# //' /etc/sudoers
}
#!/sbin/runscript
depend() {
before xdm local
}
start() {
XRES=`cat /proc/cmdline | awk -F xres= '{print $2}' | awk '{ print $1
}'`
# configure X
einfo "Configuring X, your display may flicker..."
sleep 3
X_OUTPUT="`X -configure 2>&1`"
X_CONFIG_FILE="`echo $X_OUTPUT | grep 'X -config /' | sed
s,"\([^']*\)'\([^']*\)'.*",'\2',g | awk '{ print $NF}'`"
# Detect current resolution with fbset if necessary
if [ -z "$XRES" ]
then
XRES=`fbset | grep mode | sed s,'\([^"]*\)"\([^-]*\).*','\2',g | grep
-v endmode`
fi
# Sometimes have errors with dri
# Insert DefaultDepth into Screen subsection
# Insert desired X resolution into Display subsections
# And then pass it to xorg.conf and set DefaultDepth to
# 24
cat $X_CONFIG_FILE | grep -v "\"dri\"" | \
sed '/Section "Screen"/ a DefaultDepth 24
' | \
sed '/SubSection "Display"/ a Modes \"'`echo $XRES`'\"
' > /etc/X11/xorg.conf
rm $X_CONFIG_FILE
# opengl-update xorg-x11
}
|