-
Notifications
You must be signed in to change notification settings - Fork 14
/
kano-sentry-startup
executable file
·45 lines (39 loc) · 1.48 KB
/
kano-sentry-startup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# kano-sentry-startup
#
# Copyright (C) 2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# Starts the sentry server depending on Parental control settings.
# This script is executed from the dhcpcd-hook scripts when a DHCP lease is obtained.
#
. /usr/share/kano-toolset/logging.sh
SERVER_CONFIG='/usr/bin/start-sentry-server'
# First check that server config file exists.
if [ -x $SERVER_CONFIG ]; then
# Run the script that switches on the parental control if the config is set
# Will return 1 if it doesn't launch the server
logger_info "The sentry server script $SERVER_CONFIG exists"
$SERVER_CONFIG
server_rv=$?
logger_info "Run script $SERVER_CONFIG, return value is $server_rv"
parental_control_on=$server_rv
else
# The ultimate parental control was not turned on
logger_info "The sentry server script $SERVER_CONFIG does not exist"
parental_control_on=1
fi
# If the parental control was not switched on, go through the other options
if [ $parental_control_on -eq 1 ]; then
logger_info "Ultimate parental control is NOT switched on"
if [ -x /sbin/resolvconf ]; then
echo -n "$R" | resolvconf -a "${interface}.udhcpc"
else
echo -n "$R" > "$RESOLV_CONF"
# Add a fallback DNS server to the end of the list, including a new line
echo "nameserver 8.8.8.8" >> "$RESOLV_CONF"
fi
else
logger_info "Ultimate parental control IS switched on"
fi