-Amélioré fonctions de download des packages
[hvlinux.git] / stage4 / configure-xorg
index 2ed5f33..0bbb39c 100755 (executable)
-#!/bin/sh
-set -o errexit
-
-# First argument of this script is the package name.
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Many package are still trying to find X in /usr/X11R6.
-# Until then, you can create a symbolic link to satisfy the /usr/X11R6
-# requirement so that you won't be inconvenienced with a package build
-# failure due to this known issue.
-#ln -scfT ${XORG_PREFIX} /usr/X11R6
-
-# Packages in Xorg store their configuration files in $XORG_PREFIX/lib/X11
-# by default. This is strictly against FHS guidelines. Correct the
-# installation /etc/X11 and create symlinks in the original location:
-mkdir -p /etc/X11
-for file in ${XORG_PREFIX}/{lib/X11/xinit,share/X11/{app-defaults,twm}}; do
-     mv -v $file /etc/X11/ 2> /dev/null
-     ln -v -s /etc/X11/$(basename $file) $file
-done
-
-
-
-exit 1
-
-
-
-
-cat > /etc/X11/xorg.conf << "EOF"
-# xorg.conf
-#
-# **********************************************************************
-#  Files section.
-# **********************************************************************
-Section "Files"
-       RgbPath      "/usr/X11R6/lib/X11/rgb"
-       ModulePath   "/usr/X11R6/lib/modules"      # Module search path
-       FontPath     "_HV_FONTS_PATH_/TrueType"
-
-        # Standard XFree86 Fonts
-       FontPath     "/usr/X11R6/lib/X11/fonts/TTF"
-       FontPath     "/usr/X11R6/lib/X11/fonts/Type1"
-       FontPath     "/usr/X11R6/lib/X11/fonts/misc/:unscaled"
-       FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
-       FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
-       FontPath     "/usr/X11R6/lib/X11/fonts/local"
-       FontPath     "/usr/X11R6/lib/X11/fonts/Speedo"
-       FontPath     "/usr/X11R6/lib/X11/fonts/misc/"
-       FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/"
-       FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/"
-EndSection
-
-# **********************************************************************
-#  Dynamically loadable modules section.
-# **********************************************************************
-Section "Module"
-   Load "dbe" # Double buffer extension
-
-   # This loads the miscellaneous extensions module, and disables
-   # initialisation of the XFree86-DGA extension within that module.
-   SubSection  "extmod"
-      Option    "omit xfree86-dga"   # don't initialise the DGA extension
-   EndSubSection
-
-   # This loads the Type1 and FreeType font modules
-   Load "type1"
-   Load "speedo"
-   Load "freetype"
-
-   Load  "glx"
-   Load  "dri"
-EndSection
-
-# **********************************************************************
-#  Input devices.
-# **********************************************************************
-Section "InputDevice"
-       Identifier  "Keyboard1"
-       Driver      "keyboard"
-       Option      "XkbRules"   "xfree86"
-       Option      "XkbModel"   "pc105"
-       Option      "XkbLayout"  "_XF86_KEYBOARD_LAYOUT_"
-       Option      "XkbVariant" "_XF86_KEYBOARD_VARIANT_"
-       Option      "XkbOptions" "_XF86_KEYBOARD_OPTIONS_"
-       Option      "AutoRepeat" "500 30"
-EndSection
-
-Section "InputDevice"
-       Identifier  "Mouse1"
-       Driver      "mouse"
-       Option      "Emulate3Buttons"
-       Option      "Protocol" "auto"
-       Option      "Device" "/dev/input/mice"
-       Option      "ZAxisMapping" "4 5"
-       Option      "Buttons"      "5"
-EndSection
-
-# **********************************************************************
-#  Monitor section
-#  No need to specify VertRefresh and HorizSync, as DDC2 data will
-#  be used (if monitor is recent and supports it).
-# **********************************************************************
-Section "Monitor"
-    Identifier "Monitor1"
-    VendorName "Unknown"
-    ModelName  "Unknown"
-EndSection
-
-# **********************************************************************
-#  Device (video card) section
-# **********************************************************************
-Section "Device"
-    Identifier         "VideoCard1"
-    Driver             "_VIDEO_CARD_DRIVER_"
-EndSection
-
-# **********************************************************************
-#  Screen section
-# **********************************************************************
-Section "Screen"
-    Identifier  "Screen1"
-    Device      "VideoCard1"
-    Monitor     "Monitor1"
-    DefaultColorDepth 24
-    Subsection "Display"
-        Depth       24
-        Modes       "1024x768" "800x600" 
-        ViewPort    0 0
-    EndSubsection
-EndSection
-
-# **********************************************************************
-#  Layout(s) section
-# **********************************************************************
-Section "ServerLayout"
-    Identifier  "Default"
-    Screen      "Screen1"
-    InputDevice "Mouse1"    "CorePointer"
-    InputDevice "Keyboard1" "CoreKeyboard"
-EndSection
+#!/bin/bash
 
-EOF
-
-# The ! character is the SED delimiter
-sed -i -e "s!_HV_FONTS_PATH_!${HV_FONTS_PATH}!g" /etc/X11/xorg.conf
-sed -i -e "s!_VIDEO_CARD_DRIVER_!${XF86_CARD_DRIVER}!g" /etc/X11/xorg.conf
-sed -i -e "s!_XF86_KEYBOARD_LAYOUT_!${HV_XF86_KEYBOARD_LAYOUT}!g" /etc/X11/xorg.conf
-sed -i -e "s!_XF86_KEYBOARD_VARIANT_!${HV_XF86_KEYBOARD_VARIANT}!g" /etc/X11/xorg.conf
-sed -i -e "s!_XF86_KEYBOARD_OPTIONS_!${HV_XF86_KEYBOARD_OPTIONS}!g" /etc/X11/xorg.conf
+source ../functions/main
 
+# Used by startx
 cat > /etc/skel/.xinitrc << "EOF"
 # ~/.xinitrc
 
-exec wmaker
+dbus-launch --exit-with-session wmaker
 EOF
 
 cat > /etc/skel/.Xdefaults << "EOF"
@@ -189,8 +40,8 @@ cat > /etc/skel/.xsession << "EOF"
 
 userresources=$HOME/.Xresources
 usermodmap=$HOME/.Xmodmap
-sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
-sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
+sysresources=/usr/lib/X11/xinit/.Xresources
+sysmodmap=/usr/lib/X11/xinit/.Xmodmap
 
 # merge in defaults and keymaps
 
@@ -202,12 +53,12 @@ if [ -f $sysmodmap ]; then
     xmodmap $sysmodmap
 fi
 
-if [ -f $userresources ]; then
-    xrdb -merge $userresources
+if [ -f "$userresources" ]; then
+    xrdb -merge "$userresources"
 fi
 
-if [ -f $usermodmap ]; then
-    xmodmap $usermodmap
+if [ -f "$usermodmap" ]; then
+    xmodmap "$usermodmap"
 fi
 
 # now, we see if xdm/gdm/kdm has asked for a specific environment
@@ -215,17 +66,6 @@ fi
 case $# in
     1)
        case $1 in
-           kde)
-               exec dbus-launch --exit-with-session startkde
-               ;;
-           twm)
-               xsetroot -solid rgb:33/33/55 &
-               xclock -digital -update 1 -geometry 180x23-5+5 &
-               opera -geometry 1100x950+150+10 -iconic -title "Opera 6.0 TP3" &
-               emacs -geometry 140x60-5+100 -iconic -title "Emacs" &
-               xterm -ls -geometry 160x60+25-25 -title "xterm" &
-               exec dbus-launch --exit-with-session twm
-               ;;
            wmaker)
                exec dbus-launch --exit-with-session wmaker
                ;;
@@ -253,14 +93,27 @@ chmod 755 /etc/skel/.xsession
 cp /etc/skel/.{xinitrc,Xdefaults,xsession} /root
 cp /etc/skel/.{xinitrc,Xdefaults,xsession} /home/${REGUSER}
 
-##var_add_path "PATH" /etc/profile "/usr/X11R6/bin"
-#var_add_path "PKG_CONFIG_PATH" /etc/profile "/usr/X11R6/lib/pkgconfig"
-#var_export   "PKG_CONFIG_PATH" /etc/profile
-#var_add_path "MANPATH" /etc/profile "/usr/X11R6/man"
-#var_export   "MANPATH" /etc/profile
-#var_add_shadow "ENV_SUPATH" /etc/login.defs "/usr/X11R6/bin"
-#string_add "/usr/X11R6/lib" /etc/ld.so.conf
+# When needed, the X Window System creates the directory /tmp/.ICE-unix if it
+# does not exist. If this directory is not owned by root, the X Window System
+# delays startup by a few seconds and also appends a warning to the logfile.
+# This also affects startup of other applications. To improve performance, it
+# is advisable to manually create the directory before the X Window System uses
+# it.
+cat >> /etc/sysconfig/createfiles << "EOF"
+/tmp/.ICE-unix dir 1777 root root
+EOF
+
+# Packages in Xorg store their configuration files in /usr/lib/X11
+# by default. This is strictly against FHS guidelines. Correct the
+# installation /etc/X11 and create symlinks in the original location:
+mkdir -v -p /etc/X11
 
+for file in /usr/{lib/X11/{xinit,xdm},share/X11/app-defaults}; do
+    if [ -f ${file} -a ! -h ${file} ]; then
+        mv -v ${file} /etc/X11/ 2> /dev/null
+        ln -svfT /etc/X11/$(basename $file) $file
+    fi
+done
 
 if [ "x${INST_TYPE}" = "xltsp-server" ]; then
     # Enable remote xdm login for LTSP clients
@@ -270,10 +123,89 @@ if [ "x${INST_TYPE}" = "xltsp-server" ]; then
     chmod 444 /etc/X11/xdm/Xaccess
 fi
 
- When needed, the X Window System creates the directory /tmp/.ICE-unix if it does not exist. If this directory is not owned by root, the X Window System delays startup by a few seconds and also appends a warning to the logfile. This also affects startup of other applications. To improve performance, it is advisable to manually create the directory before the X Window System uses it. Add the file creation to /etc/sysconfig/createfiles that is sourced by the /etc/rc.d/init.d/cleanfs startup script.
+# Many package are still trying to find X in /usr/X11R6.
+# Until then, you can create a symbolic link to satisfy the /usr/X11R6
+# requirement so that you won't be inconvenienced with a package build
+# failure due to this known issue.
+#ln -scfT /usr /usr/X11R6
+
+cat > /etc/X11/xorg.conf.template << "EOF"
+# xorg.conf
+#
+# **********************************************************************
+#  Input devices.
+# **********************************************************************
+Section "InputDevice"
+       Identifier  "Keyboard1"
+       Driver      "keyboard"
+       Option      "XkbRules"   "xfree86"
+       Option      "XkbModel"   "pc105"
+       Option      "XkbLayout"  "_XF86_KEYBOARD_LAYOUT_"
+       Option      "XkbVariant" "_XF86_KEYBOARD_VARIANT_"
+       Option      "XkbOptions" "_XF86_KEYBOARD_OPTIONS_"
+       Option      "AutoRepeat" "500 30"
+EndSection
+
+Section "InputDevice"
+       Identifier  "Mouse1"
+       Driver      "mouse"
+       Option      "Emulate3Buttons"
+       Option      "Protocol" "auto"
+       Option      "Device" "/dev/input/mice"
+       Option      "ZAxisMapping" "4 5"
+       Option      "Buttons"      "5"
+EndSection
+
+# **********************************************************************
+#  Monitor section
+#  No need to specify VertRefresh and HorizSync, as DDC2 data will
+#  be used (if monitor is recent and supports it).
+# **********************************************************************
+Section "Monitor"
+    Identifier "Monitor1"
+    VendorName "Unknown"
+    ModelName  "Unknown"
+EndSection
+
+# **********************************************************************
+#  Device (video card) section
+# **********************************************************************
+Section "Device"
+    Identifier         "VideoCard1"
+    Driver             "_VIDEO_CARD_DRIVER_"
+EndSection
+
+# **********************************************************************
+#  Screen section
+# **********************************************************************
+Section "Screen"
+    Identifier  "Screen1"
+    Device      "VideoCard1"
+    Monitor     "Monitor1"
+    DefaultColorDepth 24
+    Subsection "Display"
+        Depth       24
+        Modes       "1024x768" "800x600"
+        ViewPort    0 0
+    EndSubsection
+EndSection
+
+# **********************************************************************
+#  Layout(s) section
+# **********************************************************************
+Section "ServerLayout"
+    Identifier  "Default"
+    Screen      "Screen1"
+    InputDevice "Mouse1"    "CorePointer"
+    InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
 
-cat >> /etc/sysconfig/createfiles << "EOF"
-/tmp/.ICE-unix dir 1777 root root
 EOF
 
+sed -i -e "s!_HV_FONTS_PATH_!${HV_FONTS_PATH}!g" /etc/X11/xorg.conf.template
+sed -i -e "s!_VIDEO_CARD_DRIVER_!${XORG_VIDEO_DRIVER}!g" /etc/X11/xorg.conf.template
+sed -i -e "s!_XF86_KEYBOARD_LAYOUT_!${HV_XF86_KEYBOARD_LAYOUT}!g" /etc/X11/xorg.conf.template
+sed -i -e "s!_XF86_KEYBOARD_VARIANT_!${HV_XF86_KEYBOARD_VARIANT}!g" /etc/X11/xorg.conf.template
+sed -i -e "s!_XF86_KEYBOARD_OPTIONS_!${HV_XF86_KEYBOARD_OPTIONS}!g" /etc/X11/xorg.conf.template
+
 exit $?