Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit 865bd7d

Browse files
author
Cédric Verstraeten
committed
Merge branch 'develop'
2 parents 296fd68 + 6ec849b commit 865bd7d

37 files changed

+452
-738
lines changed

board/common/overlay/etc/init.d/S35wifi

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ iface=wlan0
99
driver=wext
1010

1111
sys_watch_conf="/etc/watch.conf"
12-
watch_conf="/etc/watch.conf"
12+
watch_conf="/data/etc/watch.conf"
1313

1414
link_watch=no
1515
link_watch_timeout=20
@@ -66,7 +66,7 @@ start() {
6666
return 1
6767
fi
6868
done
69-
69+
7070
module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null)
7171

7272
iwconfig $iface power off &> /dev/null
@@ -105,21 +105,21 @@ case "$1" in
105105
start)
106106
start
107107
;;
108-
108+
109109
stop)
110110
stop
111111
;;
112-
112+
113113
restart)
114114
stop
115115
start
116116
;;
117-
117+
118118
*)
119119
echo "Usage: $0 {start|stop|restart}"
120120
exit 1
121121
esac
122122

123123
# continue after an unsuccessfull wifi start
124124
# as we may still have an ethernet connection available
125-
exit 0
125+
exit 0

board/common/overlay/etc/init.d/S41netwatch

+20-9
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,44 @@ netwatch_interval=20
77

88
test -f $watch_conf && source $watch_conf || exit 0
99

10-
test -z "$netwatch_host" || -z "$netwatch_port" && exit 0
11-
12-
test -n "$os_version" || source /etc/init.d/base
10+
if [ -z "$netwatch_host" ] || [ -z "$netwatch_port" ]; then
11+
exit 0
12+
fi
1313

1414
watch() {
1515
count=0
1616
netwatch_retries=$(($netwatch_retries - 1))
1717
while true; do
18-
if nc -z -w $netwatch_timeout $netwatch_host $netwatch_port </dev/null >/dev/null 2>&1; then
18+
sleep $netwatch_interval
19+
20+
haveInternet=true
21+
case "$(curl -s --max-time 2 -I $netwatch_host | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in
22+
[23]) haveInternet=true;;
23+
5) haveInternet=true;;
24+
*) haveInternet=false;;
25+
esac
26+
27+
if [ "$haveInternet" = "true" ] ; then
1928
count=0
2029
else
2130
if [ $count -lt $netwatch_retries ]; then
31+
logger -t netwatch -s "cannot connect to $netwatch_host"
2232
count=$(($count + 1))
2333
continue
2434
else
25-
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, rebooting"
35+
logger -t netwatch -s "cannot connect to $netwatch_host, rebooting"
36+
reboot
2637
fi
2738
fi
28-
sleep $netwatch_interval
2939
done
3040
}
3141

3242
case "$1" in
3343
start)
3444
msg_begin "Starting netwatch"
35-
watch &
45+
if [ "$netwatch_enable" == "yes" ]; then
46+
watch &
47+
fi
3648
msg_done
3749
;;
3850

@@ -46,11 +58,10 @@ case "$1" in
4658
stop
4759
start
4860
;;
49-
61+
5062
*)
5163
echo "Usage: $0 {start|stop|restart}"
5264
exit 1
5365
esac
5466

5567
exit $?
56-

board/common/overlay/etc/init.d/S85machinery

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
sys_conf="/etc/opt/kerberosio/config/config.xml"
44
conf="/data/machinery/config/config.xml"
5+
watch_conf="/data/etc/watch.conf"
56

67
if [ -f $sys_conf ] && ! [ -f $conf ]; then
78
mkdir -p /data/machinery/config
@@ -14,20 +15,30 @@ if [ -f $sys_conf ] && ! [ -f $conf ]; then
1415
chmod -R 777 /data/machinery/logs
1516
mkdir -p /data/machinery/capture
1617
chmod -R 777 /data/machinery/capture
18+
mkdir -p /data/machinery/h264
19+
chmod -R 777 /data/machinery/h264
1720
fi
1821

22+
test -f $watch_conf && source $watch_conf || exit 0
23+
1924
watch() {
2025
while true; do
2126
sleep 3
22-
27+
2328
pid=$(pgrep -l kerberosio | cut -d ' ' -f 1)
2429
if [ "$pid" = "" ]; then
2530
echo "Starting kerberos.io machinery"
2631
sleep 1
2732
pkill -f kerberosio
2833
kerberosio --config $conf &
2934
fi
30-
35+
done
36+
}
37+
38+
autoremoval() {
39+
while true; do
40+
sleep 60
41+
3142
if [[ $(df -h | grep /dev/mmcblk0p3 | head -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]];
3243
then
3344
echo "Cleaning disk"
@@ -39,6 +50,10 @@ watch() {
3950
start() {
4051
echo "Starting kerberos.io machinery"
4152
watch &
53+
54+
if [ "$autoremoval" == "yes" ]; then
55+
autoremoval &
56+
fi
4257
}
4358

4459
stop() {

board/common/overlay/etc/init.d/S86web

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
#!/bin/bash
22

33
sys_conf="/var/www/web"
4-
conf="/data/web/app"
4+
conf="/data/web/storage"
55

66
start() {
77
echo "Configuring kerberos.io web"
8-
8+
99
if [ -d $sys_conf ] && ! [ -d $conf ]; then
10-
mkdir -p /data/web/app
11-
cp -R /var/www/web/app/storage /data/web/app
12-
cp -R /var/www/web/app/config /data/web/app
13-
sed -i "s#__DIR__.'/../views'#'/var/www/web/app/views'#g" /data/web/app/config/view.php
14-
chmod -R 777 /data/web/app
10+
11+
cp -R /var/www/web/storage /data/web/
12+
chmod -R 777 /data/web/storage
13+
14+
cp -R /var/www/web/config /data/web/
15+
chmod -R 777 /data/web/config/kerberos.php
16+
17+
cp -R /var/www/web/bootstrap /data/web/
18+
chmod -R 777 /data/web/bootstrap/cache
1519
fi
1620
}
1721

board/common/overlay/etc/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
os_name="Kerberos.io OS"
22
os_short_name="kios"
33
os_prefix="kios"
4-
os_version="2.3.1"
4+
os_version="2.4.0"

board/common/overlay/etc/watch.conf

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ link_watch_timeout=20
44
ip_watch=no
55
ip_watch_timeout=40
66

7-
#netwatch_host=www.google.com
8-
#netwatch_port=80
9-
netwatch_retries=3
7+
netwatch_host=www.google.com
8+
netwatch_port=80
9+
netwatch_retries=10
1010
netwatch_timeout=5
11-
netwatch_interval=20
11+
netwatch_interval=30
12+
netwatch_enable=no
13+
14+
autoremoval=yes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
##########################################
4+
#
5+
# Update configuration files for machinery
6+
#
7+
8+
KERBEROS_CONFIG_DIR="/etc/opt/kerberosio/config"
9+
DATA_CONFIG_DIR="/data/machinery/config"
10+
TEMP_CONFIG_DIR="/tmp/config"
11+
12+
# Copy files to tmp folder and overwrite data config files
13+
14+
rm -rf $TEMP_CONFIG_DIR
15+
mkdir -p $TEMP_CONFIG_DIR
16+
cp -r $DATA_CONFIG_DIR/* $TEMP_CONFIG_DIR
17+
cp -r $KERBEROS_CONFIG_DIR/* $DATA_CONFIG_DIR
18+
19+
# Loop over old config files and adjust new configuration
20+
# with previous values.
21+
22+
for oldfile in $TEMP_CONFIG_DIR/*
23+
do
24+
for newfile in $DATA_CONFIG_DIR/*
25+
do
26+
if [ ${oldfile#$TEMP_CONFIG_DIR} == ${newfile#$DATA_CONFIG_DIR} ]
27+
then
28+
lineNumber=1
29+
30+
while read p
31+
do
32+
name=`echo $p | grep -E "\<(.*?)\>(.*?)<(.*?)\>" | cut -d ">" -f1 | cut -d "<" -f2 | cut -d " " -f1`
33+
value=`echo $p | grep -E "\<(.*?)\>(.*?)<(.*?)\>" | cut -d ">" -f2 | cut -d "<" -f1`
34+
35+
if [ -n "$name" ]
36+
then
37+
#echo "looking for " $name " in " $newfile " with old value " $value
38+
39+
while read -r line ; do
40+
number=`echo $line | cut -d ':' -f1`
41+
if [[ $lineNumber -le $number ]]
42+
then
43+
newvalue=`echo $line | sed -e "s/^$number:[ \t]*//"`
44+
if [[ "$p" != "$newvalue" ]]
45+
then
46+
sed $number"s#$newvalue#$p#" $newfile > $newfile"_"
47+
mv $newfile"_" $newfile
48+
fi
49+
lineNumber=$number
50+
break
51+
fi
52+
done <<< "$(grep -n "$name " $newfile)"
53+
fi
54+
55+
done < $oldfile
56+
fi
57+
done
58+
done
59+
60+
chmod -R 777 $DATA_CONFIG_DIR
61+
62+
mkdir -p /data/machinery/h264
63+
chmod -R 777 /data/machinery/h264
64+
65+
##########################################
66+
#
67+
# Update configuration files for web
68+
#
69+
70+
cp -R /var/www/web/storage /data/web/
71+
chmod -R 777 /data/web/storage
72+
73+
cp -R /var/www/web/config /data/web/
74+
mv /data/web/app/config/kerberos.php /data/web/config/kerberos.php
75+
chmod 777 /data/web/config/kerberos.php
76+
77+
cp -R /var/www/web/bootstrap /data/web/
78+
chmod -R 777 /data/web/bootstrap/cache
79+
80+
rm -rf /data/web/app

configs/raspberrypi2_defconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ BR2_PACKAGE_LIBCURL=y
8383
BR2_PACKAGE_CURL=y
8484
BR2_PACKAGE_LIBCAP=y
8585
BR2_PACKAGE_PCRE=y
86+
BR2_PACKAGE_PCRE_UTF=y
87+
BR2_PACKAGE_PCRE_UCP=y
8688
BR2_PACKAGE_CRDA=y
8789
BR2_PACKAGE_DHCP=y
8890
BR2_PACKAGE_DHCP_CLIENT=y
@@ -158,5 +160,3 @@ BR2_PACKAGE_EIGEN=y
158160
BR2_PACKAGE_KERBEROSIO_WEB=y
159161
BR2_PACKAGE_KERBEROSIO_MACHINERY=y
160162
BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y
161-
BR2_PACKAGE_GDB=y
162-
BR2_PACKAGE_GDB_DEBUGGER=y

configs/raspberrypi3_defconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ BR2_PACKAGE_LIBCURL=y
8484
BR2_PACKAGE_CURL=y
8585
BR2_PACKAGE_LIBCAP=y
8686
BR2_PACKAGE_PCRE=y
87+
BR2_PACKAGE_PCRE_UTF=y
88+
BR2_PACKAGE_PCRE_UCP=y
8789
BR2_PACKAGE_CRDA=y
8890
BR2_PACKAGE_DHCP=y
8991
BR2_PACKAGE_DHCP_CLIENT=y
@@ -159,5 +161,3 @@ BR2_PACKAGE_EIGEN=y
159161
BR2_PACKAGE_KERBEROSIO_WEB=y
160162
BR2_PACKAGE_KERBEROSIO_MACHINERY=y
161163
BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y
162-
BR2_PACKAGE_GDB=y
163-
BR2_PACKAGE_GDB_DEBUGGER=y

configs/raspberrypi_defconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ BR2_PACKAGE_LIBCURL=y
8383
BR2_PACKAGE_CURL=y
8484
BR2_PACKAGE_LIBCAP=y
8585
BR2_PACKAGE_PCRE=y
86+
BR2_PACKAGE_PCRE_UTF=y
87+
BR2_PACKAGE_PCRE_UCP=y
8688
BR2_PACKAGE_CRDA=y
8789
BR2_PACKAGE_DHCP=y
8890
BR2_PACKAGE_DHCP_CLIENT=y
@@ -158,5 +160,3 @@ BR2_PACKAGE_EIGEN=y
158160
BR2_PACKAGE_KERBEROSIO_WEB=y
159161
BR2_PACKAGE_KERBEROSIO_MACHINERY=y
160162
BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y
161-
BR2_PACKAGE_GDB=y
162-
BR2_PACKAGE_GDB_DEBUGGER=y

mkrelease.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,23 @@ echo "Preparing release for Raspberry Pi board"
2323
mkdir -p $DIR/releases/rpi/$DATE
2424
cp $DIR/kios-raspberrypi-* $DIR/releases/rpi/$DATE
2525
for file in $DIR/output/raspberrypi/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi/$DATE/rpi1-machinery-${file##*/}"; done
26-
cd $DIR/output/raspberrypi/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi/$DATE/web.tar.gz .
26+
cd $DIR/output/raspberrypi/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi/$DATE/web.tar.gz .
2727

2828
echo "Preparing release for Raspberry Pi2 board"
2929

3030
mkdir -p $DIR/releases/rpi2/$DATE
3131
cp $DIR/kios-raspberrypi2-* $DIR/releases/rpi2/$DATE
3232
for file in $DIR/output/raspberrypi2/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi2/$DATE/rpi2-machinery-${file##*/}"; done
33-
cd $DIR/output/raspberrypi2/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi2/$DATE/web.tar.gz .
33+
cd $DIR/output/raspberrypi2/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi2/$DATE/web.tar.gz .
3434

3535
echo "Preparing release for Raspberry Pi3 board"
3636

3737
mkdir -p $DIR/releases/rpi3/$DATE
3838
cp $DIR/kios-raspberrypi3-* $DIR/releases/rpi3/$DATE
3939
for file in $DIR/output/raspberrypi3/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi3/$DATE/rpi3-machinery-${file##*/}"; done
40-
cd $DIR/output/raspberrypi3/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi3/$DATE/web.tar.gz .
40+
cd $DIR/output/raspberrypi3/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi3/$DATE/web.tar.gz .
41+
42+
echo "Uploading last release to Github (cedricve/kios)"
43+
44+
cd $DIR
45+
python uploadrelease.py

0 commit comments

Comments
 (0)