Changeset 512

Show
Ignore:
Timestamp:
05/12/08 08:25:55 (4 months ago)
Author:
free
Message:

Idempotent touchscreen

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cdd-utils/trunk/debian/changelog

    r511 r512  
    55  * Splitted functions in library files 
    66  * Code cleanup 
    7   * Idempotent ldap, nfs, monit and apt scripts 
     7  * Idempotent ldap, nfs, monit, touchscreen and apt scripts 
    88  * Instruct dhclient to send host-name 
    99  * Enable spamassassin cron update 
  • cdd-utils/trunk/lib/desktop.sh

    r499 r512  
    151151 
    152152    cfg=/etc/X11/xorg.conf 
    153     if ! exists $cfg; then warning "$cfg not found"; return; fi     
    154     if ! grep -q evtouch $cfg; then 
    155         sed -i -e 's/Section "ServerLayout"/Section "ServerLayout"\n\tInputDevice\t"touchscreen"/g' $cfg 
    156         cat <<EOF >> $cfg 
     153    if ! exists $cfg; then warning "$cfg not found"; return; fi 
     154    del_key "[[:blank:]]*InputDevice[[:blank:]]\+\"touchscreen\"" $cfg 
     155    set_key "Section \"ServerLayout" "\"" "\n\tInputDevice\t\"touchscreen\"" $cfg 
     156 
     157    perl -e 'open(FILE, "/etc/X11/xorg.conf"); while ($line = <FILE>) {if ($line =~ /^Section "InputDevice"/) {$buffer = $line;$flag = 0;until ($line =~ /^EndSection/) {$line = <FILE>; $buffer .= $line; if ($line =~ /^.*Identifier "touchscreen"/) {$flag = 1;};}; if ($flag == 0) {print $buffer;};} else {print "$line";};};close(FILE);'> $cfg.tmp 
     158    mv $cfg.tmp $cfg 
     159    if [ -z "$(tail -1 $cfg)" ]; then 
     160        sed '$d' < $cfg > $cfg.tmp 
     161        mv $cfg.tmp $cfg 
     162    fi 
     163 
     164    cat <<EOF >> $cfg 
    157165 
    158166Section "InputDevice" 
     
    179187EndSection 
    180188EOF 
    181     fi 
    182189}