Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 109 lines (86 sloc) 2.606 kb
03ebc6e up
root authored
1 #!/bin/bash
cffcc98 added config for live cd
root authored
2 . /etc/webc/webc.conf
3
845006c logging to daemon vs syslog.debug
root authored
4 cmdline_has debug && set -x
5
4fa10bb replace sed
root authored
6 sub_literal() {
7 awk -v str="$1" -v rep="$2" '
8 BEGIN {
9 len = length(str);
10 }
11
12 (i = index($0, str)) {
13 $0 = substr($0, 1, i-1) rep substr($0, i + len);
14 }
15
16 1'
17 }
18
cffb14c @kaihendry hide printing dialog unless cups is installed
kaihendry authored
19 # If printing support is installed, delete lines that prevent print dialog
20 dpkg -s cups 2>/dev/null >/dev/null && sed -i '/print/d' /etc/iceweasel/pref/iceweasel.js
21
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
22 fix_chrome()
3f89839 added all extensions, logging to live-config
root authored
23 {
6b6584b added webcchrome support for live-config
root authored
24 link="/usr/lib/iceweasel/extensions/webconverger"
25
b703c63 @kaihendry have an X by default
kaihendry authored
26 # Make sure we use a default closeicon, because the default does not have X on the last tab
8aab8c4 @kaihendry change default to activefix, where a X is always shown
kaihendry authored
27 cmdline | grep -qs "closeicon=" || /etc/webc/iwcloseconfig.sh activefix
b703c63 @kaihendry have an X by default
kaihendry authored
28
6b6584b added webcchrome support for live-config
root authored
29 for x in $( cmdline ); do
30 case $x in
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
31
3327e8b @kaihendry remove sudo script from live-config and bugfix/test debug
kaihendry authored
32 debug)
33 echo "webc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
34 ;;
35
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
36 chrome=*)
80911be changed chrome API again and updated wiki
root authored
37 chrome=${x#chrome=}
279faeb fix for type-o webc chromes
root authored
38 dir="/etc/webc/iceweasel/extensions/${chrome}"
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
39 test -d $dir && {
40 test -e $link && rm -f $link
279faeb fix for type-o webc chromes
root authored
41 logs "switching chrome to ${chrome}"
42 ln -s $dir $link
43 }
6b6584b added webcchrome support for live-config
root authored
44 ;;
9f7910a Enable bootlog
root authored
45
fd6d918 drop matchOS and simplify locale handling
root authored
46 locale=*)
47 locale=${x#locale=}
71eda42 @kaihendry Apply locale setting on all extensions so that it will be present whenev...
kaihendry authored
48 for i in /etc/webc/iceweasel/extensions/webc*/defaults/preferences/prefs.js
49 do
09e7d48 Wasted 4 hours of life working out it needed user_ prefix from some crue...
root authored
50 echo "user_pref(\"general.useragent.locale\", \"${locale}\");" >> $i
51 echo "user_pref(\"intl.accept_languages\", \"${locale}, en\");" >> $i
fd6d918 drop matchOS and simplify locale handling
root authored
52 done
9f7910a Enable bootlog
root authored
53 ;;
54
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
55 closeicon=*) # For toggling the close icons in iceweasel (bit OTT tbh)
b703c63 @kaihendry have an X by default
kaihendry authored
56 /etc/webc/iwcloseconfig.sh ${x#closeicon=}
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
57 ;;
58
2c56489 fixed sed about.xhmtl
root authored
59 homepage=*)
cca2451 @kaihendry Since removing locales, I don't think we handle utf8 safely in shell.
kaihendry authored
60 homepage="$( echo ${x#homepage=} | sed 's,%20, ,g' )"
2c56489 fixed sed about.xhmtl
root authored
61 prefs="/etc/iceweasel/profile/prefs.js"
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
62 if test -e $prefs
63 then
3af4c7c @kaihendry introduce bgurl=
kaihendry authored
64 echo "user_pref(\"browser.startup.homepage\", \"$(echo $homepage | awk '{print $1}')\");" >> $prefs
2c56489 fixed sed about.xhmtl
root authored
65 fi
66 ;;
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
67
6b6584b added webcchrome support for live-config
root authored
68 esac
69 done
7cd0093 added about.xhtml
root authored
70
3af4c7c @kaihendry introduce bgurl=
kaihendry authored
71 stamp=$( git show $webc_version | grep '^Date')
4fa10bb replace sed
root authored
72
1afc39d Fix for ampersands and about: page
root authored
73 test -f ${link}/content/about.xhtml.bak || cp ${link}/content/about.xhtml ${link}/content/about.xhtml.bak
4fa10bb replace sed
root authored
74 cat ${link}/content/about.xhtml.bak |
1e076d6 Merge branch 'master' of git://github.com/Webconverger/webc
root authored
75 sub_literal 'OS not running' "${webc_version} ${stamp}" |
4c4055a simpler cmdline to xhtml args mapping
root authored
76 sub_literal 'var aboutwebc = "";' "var aboutwebc = \"$(echo ${install_qa_url} | sed 's,&,&,g')\";" > ${link}/content/about.xhtml
3f89839 added all extensions, logging to live-config
root authored
77 }
78
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
79 update_cmdline() {
058d99b added retries
root authored
80 SECONDS=0
e49b220 reduced fail page timeout to 10 seconds
root authored
81 while true
87e53fb @kaihendry Fix bug whereby 12.0 causes a DoS when it can't find it's configuration
kaihendry authored
82 do
e49b220 reduced fail page timeout to 10 seconds
root authored
83 wget --timeout=5 -t 1 -q -O /etc/webc/cmdline.tmp "$config_url" && break
87e53fb @kaihendry Fix bug whereby 12.0 causes a DoS when it can't find it's configuration
kaihendry authored
84 test $? = 8 && break # 404
4f1429d Tested updates script used for supporting customers
root authored
85 test $SECONDS -gt 15 && break
87e53fb @kaihendry Fix bug whereby 12.0 causes a DoS when it can't find it's configuration
kaihendry authored
86 sleep 1
058d99b added retries
root authored
87 done
87e53fb @kaihendry Fix bug whereby 12.0 causes a DoS when it can't find it's configuration
kaihendry authored
88
89 # A configuration file always has a homepage
54879d4 live_config_update now blocks
root authored
90 grep -qs homepage /etc/webc/cmdline.tmp && mv /etc/webc/cmdline.tmp /etc/webc/cmdline
9601a65 xinit + live-config now synchronous, we need a bg.png "configuring"
root authored
91 touch /etc/webc/cmdline
02833c5 added IPC for live-config
root authored
92 }
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
93
02833c5 added IPC for live-config
root authored
94 test -e $live_config_pipe && rm -f $live_config_pipe
f711dee @kaihendry make homepage work again without about:home
kaihendry authored
95 mknod $live_config_pipe p
02833c5 added IPC for live-config
root authored
96 chmod 666 $live_config_pipe
3f89839 added all extensions, logging to live-config
root authored
97
0cf12b3 show no-net.png until net comes up
root authored
98 fix_chrome
b643bf1 @kaihendry apply /proc/cmdline setup before looking for a config
kaihendry authored
99 update_cmdline
71eda42 @kaihendry Apply locale setting on all extensions so that it will be present whenev...
kaihendry authored
100 fix_chrome
3f89839 added all extensions, logging to live-config
root authored
101
02833c5 added IPC for live-config
root authored
102 while true; do
103 cat $live_config_pipe | while read flag; do
104 update_cmdline
105 fix_chrome
106 done
107 done
108
Something went wrong with that request. Please try again.