wmgenmenu: Add French and Spanish translations
[wmaker-crm.git] / debian / upgrade-windowmaker-defaults
blob16b5f5a9fbdb27168e9252a4433a79a22ebf5ded
1 #! /bin/sh
2 # (c) 1998 Marcelo Magallon <mmagallo@debian.org>
3 # this script is distributed under the terms and conditions of the GPL.
5 # TODO:
7 # * Fix that ugly hack with fix*
8 # Is there something in the shell like Perl's hashes? It could be nice to
9 # do something like "foreach $var (keys %fixes)" to associate fixes with
10 # file names so I don't have to track things all over the place
12 # * Fix also the code that iterates over user directories to include system
13 # directories in one run
15 # upgrade-windowmaker-defaults (0.3)
17 # * Handles upgrade to Window Maker 0.19.0
18 # Logo.Clip -> Tile.Clip (crashing)
20 # upgrade-windowmaker-defaults (0.2)
22 # * Handles keyname changes between 0.16.1 and 0.17.2
24 # Tue Jul 21 08:05:00 CST 1998
26 # upgrade-windowmaker-defaults (0.1)
28 # * Initial release
29 # * Handles WindowPlaceOrigin syntax change
30 # * Handles name change Fiend -> Clip
32 # Sat Jun 13 16:18:36 CST 1998
34 # Fixes (these are not-optional changes)
35 # this one changes WindowPlaceOrigin = "..." to WindowPlaceOrigin = (...)
36 fix1='s/\(.*WindowPlaceOrigin = \)"\(.*\)";/\1(\2);/'
37 # and this one substitutes Fiend with Clip
38 fix2='s/\(.*\)Fiend\(.*\)=/\1Clip\2=/'
39 # this one applies to WMState
40 fix3='s/\( *\)Fiend\( *\)=/\1Clip\2=/'
41 fix4='s/\(.*\)Logo\.\(WMFiend\|WMClip\)\(.*\)=/\1Tile.WMClip\3=/'
42 # this one applies to Window Maker
43 fix5='s/\(.*\)NoSound\(.*\)=/\1DisableSound\2=/'
44 fix6='s/\(.*\)NoAutoWarp\(.*\)=/\1DontLinkWorspaces\2=/'
45 # this one is for WMWindowAttributes
47 # try to screen system accounts in the /etc/passwd file. If somebody
48 # has a better method for doing this, I'm open to suggestions. Please
49 # note that Debian Policy states accounts 0-99 are reserved for the
50 # Project, and 100 onwards *could* be used by the local sysadmin, but
51 # the default is 1000 and up
52 users='^[[:alnum:]]*:[[:alnum:]]*:[[:digit:]]\{4,\}:'
54 ask_n ()
56 echo -n $*'? [yN] '
57 read yn
58 test -n "$yn" || yn=n
59 case "$yn" in
60 [yY]*)
61 return 1
64 return 0
66 esac
69 apply_fix ()
71 file_to_fix=$1; shift
72 if [ -e $file_to_fix ] ; then
73 echo -n "Fixing $file_to_fix... "
74 while [ $# -gt 0 ] ; do
75 sed -e "$1" $file_to_fix > $tempfile
76 cat $tempfile > $file_to_fix
77 shift
78 done
79 echo done.
83 ask_permission ()
85 cat <<EOF
86 I can try to fix certain configuration parameters that have changed
87 between previous versions of Window Maker and this one, namely:
89 * WindowPlaceOrigin syntax change from "..." to (...)
90 * Name change of Fiend to Clip
91 * WMWindowAttributes: Logo.Clip -> Tile.Clip (crashing)
93 NOT fixing this could prevent Window Maker from starting. Please read
94 /usr/doc/wmaker/NEWS.gz and /usr/doc/wmaker/changelog.gz
96 I will fix *both* the system defaults and each user's files.
98 EOF
99 if ! ask_n "Do you want to proceed with the changes" ; then
100 return 0
101 else
102 return 1
106 set -e
108 gs_dir=GNUstep
109 [ $GNUSTEP_USER_ROOT ] && gs_dir=$GNUSTEP_USER_ROOT
110 gs_defaults=$gs_dir/Defaults
111 gs_system_defaults=/etc/GNUstep/Defaults
113 if [ "$1" = "--non-interactive" ] || ask_permission ; then
114 tempfile=`tempfile`
116 # fix users' files
117 for dir in `cut -d : -f 6 /etc/passwd | sort -u` ; do
118 apply_fix $dir/$gs_defaults/WindowMaker "$fix1" "$fix2" "$fix5" "$fix6"
119 apply_fix $dir/$gs_defaults/WMState "$fix3"
120 apply_fix $dir/$gs_defaults/WMWindowAttributes "$fix4"
121 done
123 # fix system files
124 apply_fix $gs_system_defaults/WindowMaker "$fix1" "$fix2" "$fix5" "$fix6"
125 apply_fix $gs_system_defaults/WMState "$fix3"
126 apply_fix $gs_system_defaults/WMWindowAttributes "$fix4"
128 rm $tempfile
130 cat <<EOF
132 Done fixing things. If you want to run this script again you can do so by
133 typing:
135 $ $0
138 else
139 cat <<EOF
141 Ok, leaving things as they are now... you can run this script again using:
143 $ $0
147 cat <<EOF
149 Press [ENTER] to continue...
152 read dummy
153 exit 0