Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Gconf Optimizer
- # Copyright 2006 Joel Bryan T. Juliano <[email protected]>
- # GNU Public License
- gconf_share_dir="/usr/share/gconf"
- gconf_etc_dir="/etc/gconf"
- gconf_home_gnome_dir="$HOME/.gnome2"
- gconf_home_gconf_dir="$HOME/.gconf"
- action_share="`find $gconf_share_dir -type f -exec file '{}' \; | grep "XML document text"`"
- action_etc="`find $gconf_etc_dir -type f -exec file '{}' \; | grep "XML document text"`"
- action_home_gnome="`find $gconf_home_gnome_dir -type f -exec file '{}' \; | grep "XML document text"`"
- action_home_gconf="`find $gconf_home_gconf_dir -type f -exec file '{}' \; | grep "XML document text"`"
- gconf_file_list_share="`echo $action_share | sed 's/: XML document text//g'`"
- gconf_file_list_etc="`echo $action_etc | sed 's/: XML document text//g'`"
- gconf_file_list_home_gnome="`echo $action_home_gnome | sed 's/: XML document text//g'`"
- gconf_file_list_home_gconf="`echo $action_home_gconf | sed 's/: XML document text//g'`"
- gconf_share_directories="`find $gconf_share_dir -type d`"
- gconf_etc_directories="`find $gconf_etc_dir -type d`"
- gconf_home_gnome_directories="`find $gconf_home_gnome_dir -type d`"
- home_gconf_directories="`find $gconf_home_gconf_dir -type d`"
- tmpdir="/tmp"
- tmp_suffix="_tmp"
- for a in $gconf_share_directories
- do
- mkdir -p "$tmpdir$a"
- done
- for b in $gconf_etc_directories
- do
- mkdir -p "$tmpdir$b"
- done
- for c in $gconf_home_gnome_directories
- do
- mkdir -p "$tmpdir$c"
- done
- for d in $home_gconf_directories
- do
- mkdir -p "$tmpdir$d"
- done
- counter=0
- rounds=2
- while [ $counter -ne $rounds ]
- do
- for f in $gconf_file_list_share
- do
- cat $f | sed -e '/^[ \t]*$/d;s,^[ \t]*,,;s,>[ \t]*<,><,g;s,[ \t]*$,,' > "$tmpdir$f$tmp_suffix"
- cat "$tmpdir$f$tmp_suffix" | tr '\012' ' ' > "$tmpdir$f" 2> /dev/null
- sudo cp "$tmpdir$f" "$f" 2> /dev/null
- rm -rf "$tmpdir$f$tmp_suffix"
- done
- for g in $gconf_file_list_etc
- do
- cat $g | sed -e '/^[ \t]*$/d;s,^[ \t]*,,;s,>[ \t]*<,><,g;s,[ \t]*$,,' > "$tmpdir$g$tmp_suffix"
- cat "$tmpdir$g$tmp_suffix" | tr '\012' ' ' > "$tmpdir$g" 2> /dev/null
- sudo cp "$tmpdir$g" "$g" 2> /dev/null
- rm -rf "$tmpdir$g$tmp_suffix"
- done
- for h in $gconf_file_list_home_gnome
- do
- cat $h | sed -e '/^[ \t]*$/d;s,^[ \t]*,,;s,>[ \t]*<,><,g;s,[ \t]*$,,' > "$tmpdir$h$tmp_suffix"
- cat "$tmpdir$h$tmp_suffix" | tr '\012' ' ' > "$tmpdir$h" 2> /dev/null
- sudo cp "$tmpdir$h" "$h" 2> /dev/null
- rm -rf "$tmpdir$h$tmp_suffix"
- done
- for i in $gconf_file_list_home_gconf
- do
- cat $i | sed -e '/^[ \t]*$/d;s,^[ \t]*,,;s,>[ \t]*<,><,g;s,[ \t]*$,,' > "$tmpdir$i$tmp_suffix"
- cat "$tmpdir$i$tmp_suffix" | tr '\012' ' ' > "$tmpdir$i" 2> /dev/null
- sudo cp "$tmpdir$i" "$i" 2> /dev/null
- rm -rf "$tmpdir$i$tmp_suffix"
- done
- counter=$(( $counter + 1 ))
- done
Advertisement
Add Comment
Please, Sign In to add comment