slitaz-tools rev 870
tazx: update fo last Xorg
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Apr 30 20:04:24 2014 +0200 (2014-04-30) |
parents | 95727d7587e7 |
children | b1ce98240dff |
files | tinyutils/tazx |
line diff
1.1 --- a/tinyutils/tazx Wed Apr 30 18:43:43 2014 +0100 1.2 +++ b/tinyutils/tazx Wed Apr 30 20:04:24 2014 +0200 1.3 @@ -41,32 +41,8 @@ 1.4 $xorg_config/$1.conf 1.5 } 1.6 1.7 -# Populate xorg.conf.d. 1.8 -xorg_conf_d() { 1.9 - # Define the xorg.conf.d (can be /etc/X11/xorg.conf.d or /usr/share/X11/xorg.conf.d) 1.10 - xorg_config=/etc/X11/xorg.conf.d 1.11 - 1.12 - # Define the xorg.conf.new place. 1.13 - xorg_template=/root/xorg.conf.new 1.14 - 1.15 - # Obtain a default configuration file from Xorg. 1.16 - Xorg -configure :2 1.17 - 1.18 - # Backup existing config. 1.19 - tar -cf $xorg_config/../Previous_xorg.conf.d.tar $xorg_config/ &> /dev/null 1.20 - 1.21 - # Put the different sections in separate files in the config directory. 1.22 - save_chunk 10-ServerLayout 1.23 - sed -i '/Core/d' $xorg_config/10-ServerLayout.conf 1.24 - save_chunk 20-Files 1.25 - save_chunk 30-Module 1.26 - save_chunk 50-Monitor 1.27 - save_chunk 60-Device 1.28 - save_chunk 70-Screen 1.29 - 1.30 - # Remove the template. 1.31 - rm $xorg_template 1.32 - 1.33 +# Generate or regenerate 40-Keyboard.conf 1.34 +keyboard_conf() { 1.35 # Configure the keyboard with the right keymap. 1.36 keymap=$(cat /etc/keymap.conf) 1.37 keyboard_config=$xorg_config/40-Keyboard.conf 1.38 @@ -111,6 +87,36 @@ 1.39 EndSection 1.40 EOC 1.41 [ x$variant == x ] && sed -i '/XkbVariant/d' $keyboard_config 1.42 +} 1.43 + 1.44 +# Populate xorg.conf.d. 1.45 +xorg_conf_d() { 1.46 + # Define the xorg.conf.d (can be /etc/X11/xorg.conf.d or /usr/share/X11/xorg.conf.d) 1.47 + xorg_config=/etc/X11/xorg.conf.d 1.48 + 1.49 + # Define the xorg.conf.new place. 1.50 + xorg_template=/root/xorg.conf.new 1.51 + 1.52 + # Obtain a default configuration file from Xorg. 1.53 + Xorg -configure :2 1.54 + 1.55 + # Backup existing config. 1.56 + tar -cf $xorg_config/../Previous_xorg.conf.d.tar $xorg_config/ &> /dev/null 1.57 + 1.58 + # Put the different sections in separate files in the config directory. 1.59 + save_chunk 10-ServerLayout 1.60 + sed -i '/Core/d' $xorg_config/10-ServerLayout.conf 1.61 + save_chunk 20-Files 1.62 + save_chunk 30-Module 1.63 + save_chunk 50-Monitor 1.64 + save_chunk 60-Device 1.65 + save_chunk 70-Screen 1.66 + 1.67 + # Remove the template. 1.68 + rm $xorg_template 1.69 + 1.70 + # Keyboard 1.71 + keyboard_conf 1.72 1.73 # Create a xorg.conf if needed. 1.74 if [ ! -f /etc/X11/xorg.conf ]; then 1.75 @@ -190,52 +196,22 @@ 1.76 esac 1.77 } 1.78 1.79 -# ~/.xinitrc for X login from a DM. 1.80 -creat_xinitrc() { 1.81 +# ~/.config/slitaz/applications.conf: Missing = failed to login 1.82 +slitaz_apps_conf() { 1.83 apps_conf=/etc/slitaz/applications.conf 1.84 user_conf="$HOME/.config/slitaz/applications.conf" 1.85 - xinitrc="$HOME/.xinitrc" 1.86 - if [ ! -f "$user_conf" ]; then 1.87 - mkdir -p $(dirname $user_conf); cp ${apps_conf} ${user_conf} 1.88 - fi 1.89 - if [ ! -f "$xinitrc" ]; then 1.90 - cp /etc/skel/.xinitrc ${xinitrc} 1.91 - fi 1.92 1.93 - # Make .xinitrc and config for /etc/skel so new added user will get 1.94 + # Make users applications.conf in /etc/skel so new added user will get 1.95 # a working X session. 1.96 if test $(id -u) = 0; then 1.97 user_conf="/etc/skel/.config/slitaz/applications.conf" 1.98 mkdir -p $(dirname $user_conf); cp -f ${apps_conf} ${user_conf} 1.99 fi 1.100 - 1.101 - # In Live mode default user needs a xinitrc, since tazx is executed 1.102 - # only by root. 1.103 - user_conf="/home/$USER/.config/slitaz/applications.conf" 1.104 - xinitrc="/home/$USER/.xinitrc" 1.105 + 1.106 + # If started by: startx and with boot opts screen=text 1.107 if [ ! -f "$user_conf" ]; then 1.108 mkdir -p $(dirname $user_conf); cp ${apps_conf} ${user_conf} 1.109 - chown -R $USER.users $(dirname $user_conf) 1.110 fi 1.111 - if [ ! -f "$xinitrc" ]; then 1.112 - cp -f /etc/skel/.xinitrc ${xinitrc} 1.113 - chown $USER.users ${xinitrc} 1.114 - fi 1.115 -} 1.116 - 1.117 -# Create ~/.xsession to keep the configuration selected (used 1.118 -# only by startx, Slim login manager uses .xinitrc). 1.119 -creat_xsession() { 1.120 - local xsession=$HOME/.xsession 1.121 - [ -f "$xsession" ] && cp -f ${xsession} ${xsession}.bak 1.122 - cat > ${xsession} << EOT 1.123 -# ~/.xsession: Start X session manually on your system with: startx 1.124 -# 1.125 -Xorg & 1.126 -#xterm & 1.127 -exec $WM 1.128 -EOT 1.129 - chmod 700 ${xsession} 1.130 } 1.131 1.132 # Commands 1.133 @@ -244,29 +220,38 @@ 1.134 install-xorg) 1.135 check_root 1.136 install_xorg 1.137 - creat_xinitrc 1.138 - creat_xsession ;; 1.139 + slitaz_apps_conf ;; 1.140 1.141 config-xorg) 1.142 check_root 1.143 - creat_xinitrc 1.144 - creat_xsession 1.145 + slitaz_apps_conf 1.146 xorg_conf_d 1.147 # Handle live option: screen= 1.148 - if grep -qs screen= /proc/cmdline ; then 1.149 + if grep -qs 'screen=' /proc/cmdline ; then 1.150 MODE="$(sed 's/.*screen=\([0-9]*x[0-9]*\).*/\1/' < /proc/cmdline)" 1.151 sed -i "s/.*EndSubSection.*/\\t\\tModes\\t\"$MODE\"\\n&/" \ 1.152 /etc/X11/xorg.conf.d/70-Screen.conf 1.153 fi ;; 1.154 1.155 + init) 1.156 + # We dont need much config files with last Xorg verrsion, So just 1.157 + # gest files for start a X session and config the keyboard. 1.158 + check_root 1.159 + slitaz_apps_conf 1.160 + keyboard_conf ;; 1.161 + 1.162 + keybard) 1.163 + echo "Generating: 40-Keyboard.conf" 1.164 + keyboard_conf ;; 1.165 + 1.166 *help) 1.167 - echo "Usage: $(basename $0) [install-xorg|config-xorg|]" ;; 1.168 + echo "Usage: $(basename $0) [install-xorg|config-xorg|init|keyboard]" ;; 1.169 1.170 *) 1.171 # User can get a new .xinitrc with tazx from cmdline. 1.172 [ $(id -u) == 0 ] && config_dialog 1.173 - creat_xinitrc 1.174 - creat_xsession ;; 1.175 + slitaz_apps_conf 1.176 + gen_xsession ;; 1.177 esac 1.178 1.179 exit 0