#!/bin/sh # Copyright 1999, 2002, 2012 Patrick Volkerding, Moorhead, Minnesota USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # In the genuine installer we are possibly called by setup.xwmconfig so: # chroot $T_PX /bin/bash /usr/bin/xwmconfig. But this prevent access to the # installer from here. To avoid that now setup.xwmconfig calls us so: # /usr/lib64/config/xwmconfig $T_PX # But then, we need to to prefix most paths here with $T_PX. - Didier Spaier T_PX=$1 export TEXTDOMAIN=slint if [ -f /tmp/.SlintInstallationLANG ]; then LANG=$(> $TMP/tmpscript.sh gettext "SELECT DEFAULT WINDOW MANAGER FOR X" >> $TMP/tmpscript.sh echo -n "\" $PRESELECT --menu \"" >> $TMP/tmpscript.sh gettext "Please select the default window manager to use with the X Window \ System. This will define the style of graphical user interface \ the computer uses. KDE and GNOME provide the most features. People \ with Windows or MacOS experience will find either one easy to use. \ Other window managers are easier on system \ resources, or provide other unique features." >> $TMP/tmpscript.sh echo -n '" 12 80 0 ' >> $TMP/tmpscript.sh elif [ -r $T_PX/etc/X11/xinit/xinitrc.kde ]; then echo -n "#!/bin/sh dialog --visit-items $BACKTITLE --title \"" >> $TMP/tmpscript.sh gettext "SELECT DEFAULT WINDOW MANAGER FOR X" >> $TMP/tmpscript.sh echo -n "\" $PRESELECT --menu \"" >> $TMP/tmpscript.sh gettext "Please select the default window manager to use with the X Window \ System. This will define the style of graphical user interface \ the computer uses. KDE provides the most features, and people \ with Windows or MacOS experience will find it easy to use. \ Other window managers are easier on system \ resources, or provide other unique features." >> $TMP/tmpscript.sh echo -n '" 12 80 0 ' >> $TMP/tmpscript.sh elif [ -r $T_PX/etc/X11/xinit/xinitrc.xfce ]; then echo -n "#!/bin/sh dialog --visit-items $BACKTITLE --title \"" >> $TMP/tmpscript.sh gettext "SELECT DEFAULT WINDOW MANAGER FOR X" >> $TMP/tmpscript.sh echo -n "\" $PRESELECT --menu \"" >> $TMP/tmpscript.sh gettext "Please select the default window manager to use with the X Window \ System. This will define the style of graphical user interface \ the computer uses. XFce provides the most features, and people \ with Windows or MacOS experience will find it easy to use. \ Other window managers are easier on system \ resources, or provide other unique features." >> $TMP/tmpscript.sh echo -n '" 12 80 0 ' >> $TMP/tmpscript.sh else echo -n "#!/bin/sh dialog --visit-items --no-tags $BACKTITLE --title \"" >> $TMP/tmpscript.sh gettext "SELECT DEFAULT WINDOW MANAGER FOR X" >> $TMP/tmpscript.sh echo -n "\" $PRESELECT --menu \"" >> $TMP/tmpscript.sh gettext "Please select the default window manager to use with the X Window \ System. This will define the style of graphical user interface \ the computer uses." >> $TMP/tmpscript.sh echo -n '" 12 80 0 ' >> $TMP/tmpscript.sh fi # Add KDE as the first and default entry: if [ -r $T_PX/etc/X11/xinit/xinitrc.kde ]; then echo "\"xinitrc.kde\" \"`gettext "KDE: K Desktop Environment"`\" \\" >> $TMP/tmpscript.sh fi # Then, we add GNOME: if [ -r $T_PX/etc/X11/xinit/xinitrc.gnome ]; then echo "\"xinitrc.gnome\" \"`gettext "GNU Network Object Model Environment"`\" \\" >> $TMP/tmpscript.sh fi # Add XFce: if [ -r $T_PX/etc/X11/xinit/xinitrc.xfce ]; then echo "\"xinitrc.xfce\" \"`gettext "The Cholesterol Free Desktop Environment"`\" \\" >> $TMP/tmpscript.sh fi # Add LXDE: if [ -r $T_PX/etc/X11/xinit/xinitrc.lxde ]; then echo "\"xinitrc.lxde\" \"`gettext "Lightweight X11 Desktop Environment LXDE"`\" \\" >> $TMP/tmpscript.sh fi # Add Enlightenment16: if [ -r $T_PX/etc/X11/xinit/xinitrc.e16 ]; then echo "\"xinitrc.e16\" \"`gettext "The Enlightenment 16 window manager"`\" \\" >> $TMP/tmpscript.sh fi # Add Enlightenment17: if [ -r $T_PX/etc/X11/xinit/xinitrc.e16 ]; then echo "\"xinitrc.enlightenment17\" \"`gettext "The Enlightenment 17 window manager"`\" \\" >> $TMP/tmpscript.sh fi # Add Fluxbox: if [ -r $T_PX/etc/X11/xinit/xinitrc.fluxbox ]; then echo "\"xinitrc.fluxbox\" \"`gettext "The fluxbox window manager"`\" \\" >> $TMP/tmpscript.sh fi # Add Blackbox: if [ -r $T_PX/etc/X11/xinit/xinitrc.blackbox ]; then echo "\"xinitrc.blackbox\" \"`gettext "The blackbox window manager"`\" \\" >> $TMP/tmpscript.sh fi # Add WindowMaker: if [ -r $T_PX/etc/X11/xinit/xinitrc.wmaker ]; then echo "\"xinitrc.wmaker\" \"`gettext "WindowMaker"`\" \\" >> $TMP/tmpscript.sh fi # Add icewm: if [ -r $T_PX/etc/X11/xinit/xinitrc.icewm ]; then echo "\"xinitrc.icewm\" \"`gettext "ICE Window Manager"`\" \\" >> $TMP/tmpscript.sh fi # Add mate: if [ -r $T_PX/etc/X11/xinit/xinitrc.mate ]; then echo "\"xinitrc.mate\" \"`gettext "The Mate desktop"`\" \\" >> $TMP/tmpscript.sh fi # Add twm: if [ -r $T_PX/etc/X11/xinit/xinitrc.twm ]; then echo "\"xinitrc.twm\" \"`gettext "The Tab Window Manager"`\" \\" >> $TMP/tmpscript.sh fi # Add AfterStep: if [ -r $T_PX/etc/X11/xinit/xinitrc.afterstep ]; then echo "\"xinitrc.afterstep\" \"`gettext "The AfterStep Window Menager"`\" \\" >> $TMP/tmpscript.sh fi # Add Awesome: if [ -r $T_PX/etc/X11/xinit/xinitrc.awesome ]; then echo "\"xinitrc.awesome\" \"`gettext "The Awesome Window Manager"`\" \\" >> $TMP/tmpscript.sh fi # Now, add support for the other window managers: ( cd $T_PX/etc/X11/xinit for file in xinitrc.* ; do if [ ! "$file" = "xinitrc.kde" -a ! "$file" = "xinitrc.gnome" \ -a ! "$file" = "xinitrc.e16" -a ! "$file" = "xinitrc.wmaker" \ -a ! "$file" = "xinitrc.fvwm2" -a ! "$file" = "xinitrc.enlightenment"\ -a ! "$file" = "xinitrc.icewm" -a ! "$file" = "xinitrc.twm" \ -a ! "$file" = "xinitrc.xfce" -a ! "$file" = "xinitrc.awesome" \ -a ! "$file" = "xinitrc.blackbox" -a ! "$file" = "xinitrc.fluxbox" \ -a ! "$file" = "xinitrc.mate" -a ! "$file" = "xinitrc.afterstep" \ -a ! "$file" = "xinitrc.lxde" ]; then echo "\"$file\" \"$file\" \\" >> $TMP/tmpscript.sh fi done ) # Then, the tail end: cat << EOF >> $TMP/tmpscript.sh 2> $TMP/output if [ ! \$? = 0 ]; then rm -f $TMP/output gettext "Canceled." echo exit fi EOF sh $TMP/tmpscript.sh if [ ! -r $TMP/output ]; then rm -f $TMP/tmpscript.sh exit fi OUTPUT=`cat $TMP/output` case $OUTPUT in xinitrc.kde) session=/usr/bin/startkde;; xinitrc.gnome) session=/usr/bin/gnome-session;; xinitrc.xfce) session=/usr/bin/startxfce4;; xinitrc.icewm) session=/usr/bin/icewm-session;; xinitrc.mate) session=/usr/bin/mate-session;; xinitrc.wmaker) session=/usr/bin/startwmaker;; xinitrc.e16) session=/usr/share/e16/misc/starte16;; xinitrc.enlightenment) session=/usr/bin/enlightenment_start;; xinitrc.blackbox) session=/usr/bin/startblackbox;; xinitrc.fluxbox) session=/usr/bin/startfluxbox;; xinitrc.twm) session=/usr/bin/starttwm;; xinitrc.awesome) session=/usr/bin/awesome;; *) session=/usr/bin/lxsession;; esac # If xwmconfig is run by root, it changes the system-wide default, else # it overrides lightdm's current session if [ "$USER" = "root" ]; then if [ -r $T_PX/etc/X11/xinit/$OUTPUT ]; then ( cd $T_PX/etc/X11/xinit ; rm -f xinitrc ; ln -sf $OUTPUT xinitrc ) ( cd $T_PX/etc/lxdm sed /^session/s:.*:session=$session: lxdm.conf > lxdm.conf.other mv lxdm.conf.other lxdm.conf ) newsession=$(printf $OUTPUT|sed s/xinitrc.//) (cd /etc/lightdm sed "s/^user-session=.*/user-session=$newsession/" lightdm.conf > prov mv prov lightdm.conf ) fi else # Set the session chosen as default for the user in concern and # remove the indicator telling that xwmconfig has not yet been run # as regular user for this user case occurring. Do that only if # there is a matching .desktop session file. thissession=$(printf $OUTPUT|sed s/xinitrc.//) [ "$thissession" = "lxde" ] && thissession=LXDE [ "$thissession" = "kde" ] && thissession=kde-plasma # For lxdm if [ -f /usr/share/xsessions/${thissession}.desktop ]; then user_xsession.py --user-name $USER set $thissession echo '[Desktop]' > $HOME/.dmrc echo "Session=$thissession" >> $HOME/.dmrc fi # For xdm echo $session > $HOME/.xsession # Also set up a new $HOME/.xinitrc for startx if [ -r $HOME/.xinitrc ]; then rm -f $HOME/.xinitrc-backup mv $HOME/.xinitrc $HOME/.xinitrc-backup fi cat /etc/X11/xinit/$OUTPUT > $HOME/.xinitrc fi rm -f $TMP/tmpscript.sh $TMP/output