Code

Apply fix for #6890
[gosa.git] / trunk / gosa-core / contrib / gosa
1 #!/bin/sh
2 # Start script for GOsa to be started via gecko based browsers
4 [ -r /etc/gosa/desktoprc ] && . /etc/gosa/desktoprc
5 [ -r $HOME/.gosa-desktop ] && . $HOME/.gosa-desktop
7 url=""
8 if [ $# -ne 1 -a -z "$URL" ]; then
9         echo "Usage: $(basename $0) <URL>"
10         exit 1
11 fi
13 if [ $# -ne 1 ]; then
14         url="$URL"
15 else
16         url="$1"
17 fi
19 # What browser are we using?
20 result=""
21 echo -n "Looking for browser: "
22 for browser in iceweasel firefox mozilla; do
23         if which $browser 2> /dev/null; then
24                 result=$browser
25                 break
26         fi
27 done
28 if [ -z "$result" ]; then
29         echo "none found. You'll need iceweasel, firefox or mozilla in your PATH!"
30         exit 1
31 fi
32 browser=$result
33 dbrowser=$browser
35 # Workaround for debian
36 if [ "$browser" = "iceweasel" ]; then
37         dbrowser=firefox
38 fi
40 # Check for presence of gosa profile
41 if [ ! -d $HOME/.mozilla/$dbrowser/*.gosa ]; then
42         echo "No browser profile found for GOsa - creating one..."
43         $browser -CreateProfile gosa
44         if [ "$browser" = "iceweasel" ]; then
45                 config=`echo $HOME/.mozilla/firefox/*.gosa/`
46         else
47                 config=`echo $HOME/.mozilla/$dbrowser/*.gosa/`
48         fi
50         # Catch resolution
51         width=1024
52         height=768
53         if which xrandr > /dev/null; then
54                 if xrandr 1> /dev/null 2> /dev/null; then
55                         resolution=$(xrandr | sed -n '/current/s/^.*current \([0-9]*\)[^0-9]*\([0-9]*\).*$/\1 \2/p')
56                         width=${resolution%% *}
57                         height=${resolution##* }
59                         [ $width -gt 1050 ] && width=1050
60                         [ $height -gt 850 ] && height=850
61                 fi
62         fi
64         cat << EOF > $config/prefs.js
65 # Mozilla User Preferences
67 /* Do not edit this file.
68  *
69  * If you make changes to this file while the browser is running,
70  * the changes will be overwritten when the browser exits.
71  *
72  * To make a manual change to preferences, you can visit the URL about:config
73  * For more information, see http://www.mozilla.org/unix/customizing.html#prefs
74  */
76 user_pref("app.update.autoUpdateEnabled", false);
77 user_pref("app.update.enabled", false);
78 user_pref("browser.download.folderList", 2);
79 user_pref("browser.download.manager.showWhenStarting", false);
80 user_pref("browser.formfill.enable", false);
81 user_pref("browser.preferences.lastpanel", 1);
82 user_pref("browser.search.selectedEngine", "Damnfresh");
83 user_pref("browser.startup.homepage", "$url");
84 user_pref("browser.startup.homepage_override.mstone", "rv:1.8.1.1");
85 user_pref("extensions.disabledObsolete", true);
86 user_pref("extensions.lastAppVersion", "2.0.0.1");
87 user_pref("extensions.update.autoUpdateEnabled", false);
88 user_pref("intl.charsetmenu.browser.cache", "ISO-8859-1");
89 user_pref("network.cookie.prefsMigrated", true);
90 user_pref("security.OCSP.URL", "");
91 user_pref("security.OCSP.signingCA", "Builtin Object Token:IPS CLASE1 root");
92 user_pref("security.warn_entering_secure", false);
93 user_pref("security.warn_leaving_secure", false);
94 user_pref("security.warn_submit_insecure", false);
95 user_pref("security.warn_viewing_mixed", false);
96 user_pref("signon.rememberSignons", false);
97 user_pref("security.warn_submit_insecure", false);
98 EOF
100         cat << EOF > $config/84795799.s
101 #2c
102 http://vserver-02
104 EOF
106         [ ! -d $config/chrome ] && mkdir -p $config/chrome
107         cat << EOF > $config/chrome/userChrome.css
108 #main-menubar {
109         display: none;
111 #navigator-throbber {
112         display: none;
114 EOF
116 cat << EOF > $config/localstore.rdf
117 <?xml version="1.0"?>
118 <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
119          xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
120   <RDF:Description RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul#unknownContentType"
121                    screenX="267"
122                    screenY="304" />
123   <RDF:Description RDF:about="chrome://browser/content/browser.xul#PersonalToolbar"
124                    currentset="__empty"
125                    collapsed="true" />
126   <RDF:Description RDF:about="chrome://browser/content/browser.xul#toolbar-menubar"
127                    currentset="__empty"
128                    collapsed="true" />
129   <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-box"
130                    collapsed="true"
131                    sidebarcommand=""
132                    width=""
133                    src="" />
134   <RDF:Description RDF:about="chrome://browser/content/browser.xul#status-bar"
135                    hidden="true" />
136   <RDF:Description RDF:about="chrome://browser/content/browser.xul">
137     <NC:persist RDF:resource="chrome://browser/content/browser.xul#main-window"/>
138     <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-box"/>
139     <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-title"/>
140     <NC:persist RDF:resource="chrome://browser/content/browser.xul#nav-bar"/>
141     <NC:persist RDF:resource="chrome://browser/content/browser.xul#PersonalToolbar"/>
142     <NC:persist RDF:resource="chrome://browser/content/browser.xul#toolbar-menubar"/>
143   </RDF:Description>
144   <RDF:Description RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul">
145     <NC:persist RDF:resource="chrome://mozapps/content/downloads/unknownContentType.xul#unknownContentType"/>
146   </RDF:Description>
147   <RDF:Description RDF:about="chrome://global/content/customizeToolbar.xul">
148     <NC:persist RDF:resource="chrome://global/content/customizeToolbar.xul#CustomizeToolbarWindow"/>
149   </RDF:Description>
150   <RDF:Description RDF:about="chrome://help/content/help.xul#help"
151                    screenX="350"
152                    screenY="225"
153                    width="700"
154                    height="550" />
155   <RDF:Description RDF:about="chrome://browser/content/browser.xul#main-window"
156                    screenX="50"
157                    screenY="25"
158                    sizemode="normal"
159                    width="$width"
160                    height="$height" />
161   <RDF:Description RDF:about="chrome://help/content/help.xul">
162     <NC:persist RDF:resource="chrome://help/content/help.xul#help"/>
163   </RDF:Description>
164   <RDF:Description RDF:about="chrome://browser/content/browser.xul#nav-bar"
165                    currentset="__empty"
166                    collapsed="true" />
167 </RDF:RDF>
171 EOF
172 fi
175 # Start mozilla with GOsa profile
176 $browser -P gosa $url