Permalink
Browse files

Move functions from webc.conf to the (new) functions.sh

  • Loading branch information...
1 parent cffb69f commit b6b2ef04f6621ed96396f2f1d1a0c0d90f6245e6 @matthijskooijman matthijskooijman committed Sep 24, 2012
View
@@ -1,5 +1,6 @@
#!/bin/bash
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
Configure_tzdata ()
@@ -21,6 +21,7 @@ set Master 100% unmute
set Master Front 100% unmute
END
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
for x in $(cmdline)
@@ -14,6 +14,7 @@ wait_until_network() {
return 0
}
+. "/etc/webc/functions.sh"
. "/etc/webc/webc.conf"
for i in /etc/webc/network-up.d/*; do
View
@@ -1,4 +1,5 @@
#!/bin/bash
+. "/etc/webc/functions.sh"
. "/etc/webc/webc.conf"
cmdline_has debug && {
View
@@ -0,0 +1,62 @@
+# installed config trumps boot cmdline
+cmdline()
+{
+ test -e /proc/cmdline && cat /proc/cmdline
+ test -e /etc/webc/cmdline && cat /etc/webc/cmdline
+}
+
+logs ()
+{
+ logger -t $0 -p daemon.info "$@"
+}
+
+cmdline_has()
+{
+ for i in `cmdline`
+ do
+ test "$1" = "${i%%=*}" && return 0
+ done
+ return 1
+}
+
+cmdline_get()
+{
+ for i in `cmdline`
+ do
+ test ${i/=*} = $1 && { echo "${i#$1=}"; return 0; }
+ done
+ return 1
+}
+
+mac_address()
+{
+ for i in /sys/class/net/*/address
+ do
+ tr -d ":" < $i
+ return
+ done
+}
+
+# # http://stackoverflow.com/questions/11827252
+wait_for()
+{
+ np=$(mktemp -u)
+ mkfifo $np
+ inotifywait -m -e create "$(dirname $1)" > $np 2>&1 & ipid=$!
+ while read output
+ do
+ if test -p "$1"
+ then
+ kill $ipid
+ break
+ fi
+ done < $np
+ rm -f $np
+}
+
+has_network()
+{
+ netstat -rn | grep -qs '^0.0.0.0'
+}
+
+# vim: set sw=8 sts=8 noexpandtab:
@@ -1,4 +1,5 @@
#!/bin/bash
+. "/etc/webc/functions.sh"
. "/etc/webc/webc.conf"
# Set up:
@@ -1,5 +1,6 @@
#!/bin/bash
# Setting up Webconverger system as root user
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
cmdline_has debug && set -x
View
@@ -1,4 +1,5 @@
#!/bin/bash
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
! cmdline_has debug && { "$@"; exit 0; }
@@ -1,5 +1,6 @@
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
if cmdline_has timezone; then
@@ -1,4 +1,5 @@
#!/bin/bash
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
server="http://ping.webconverger.org/"
sleeping=5
@@ -1,5 +1,6 @@
#!/bin/bash
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
while ! test -e /etc/webc/cmdline; do
sleep 1
@@ -1,5 +1,6 @@
#!/bin/bash
# save the webc id to disk
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
set -e
View
@@ -1,5 +1,6 @@
#!/bin/bash
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
cmdline_has debug || cat /etc/webc/xorg.conf >> /etc/X11/xorg.conf
View
57 etc/webc/webc.conf 100755 → 100644
@@ -1,4 +1,3 @@
-#!/bin/bash
#
# webconverger configuration file
#
@@ -12,65 +11,9 @@ prefs=/opt/firefox/defaults/preferences/webc-boot.js
# Default location for Webconverger extension
link='/opt/firefox/extensions/kiosk@webconverger.com'
-# installed config trumps boot cmdline
-cmdline()
-{
-test -e /proc/cmdline && cat /proc/cmdline
-test -e /etc/webc/cmdline && cat /etc/webc/cmdline
-}
-
install_base_url="http://config.webconverger.com/clients"
install_qa_url="${install_base_url}/?v=${webc_version}&id=${webc_id}&$(cmdline | /usr/bin/tr -s '[:space:]' '&')"
config_url="${install_base_url}/install-config/${webc_id}"
# triggers live-config.sh - this gets config from config.webconverger.com
live_config_pipe="/tmp/live-config.pipe" # needs to be writable by xinitrc
-
-logs ()
-{
-logger -t $0 -p daemon.info "$@"
-}
-
-cmdline_has()
-{
-for i in `cmdline`
-do
- test "$1" = "${i%%=*}" && return 0
-done
-return 1
-}
-
-cmdline_get()
-{
-for i in `cmdline`; do
- test ${i/=*} = $1 && { echo "${i#$1=}"; return 0; }
-done
-return 1
-}
-
-mac_address()
-{
-for i in /sys/class/net/*/address; do
- tr -d ":" < $i
- return
-done
-}
-
-wait_for () # # http://stackoverflow.com/questions/11827252
-{
- np=$(mktemp -u);
- mkfifo $np;
- inotifywait -m -e create "$(dirname $1)" > $np 2>&1 & ipid=$!;
- while read output; do
- if test -p "$1"; then
- kill $ipid;
- break;
- fi;
- done < $np;
- rm -f $np
-}
-
-has_network()
-{
-netstat -rn | grep -qs '^0.0.0.0'
-}
View
@@ -1,3 +1,4 @@
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
if cmdline_has debug
View
@@ -1,5 +1,6 @@
# Keep the browser running and clean between sessions in /home/webc
# hendry@webconverger.com
+. "/etc/webc/functions.sh"
. "/etc/webc/webc.conf"
cp /home/webc/bg-orig.png /home/webc/bg.png
@@ -28,6 +28,7 @@
#EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# only show errors
+. /etc/webc/functions.sh
. /etc/webc/webc.conf
cmdline | grep -qs quiet && exec >/dev/null
@@ -5,6 +5,7 @@
# * Dependent on Iceweasel
# * Changes on a form / scroll position on the homepage, won't reset kiosk since we are only working from homepage title
# Perhaps look into a layer utilising https://developer.mozilla.org/en/nsIIdleService
+source "/etc/webc/functions.sh"
source "/etc/webc/webc.conf"
set -e
_exit() {

0 comments on commit b6b2ef0

Please sign in to comment.