| # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Monitor the proxy settings used to access the date server" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started system-services |
| stop on stopping system-services |
| respawn |
| |
| script |
| restart_timeout=15 |
| proxy_file=/var/run/proxy |
| dir=$(mktemp -d /tmp/date-proxy.$$.XXXXXXXXXXXX) |
| trap "rm -rf $dir" EXIT TERM |
| fifo="$dir/fifo" |
| mkfifo -m 420 "$fifo" |
| chgrp proxystate "$fifo" |
| chgrp proxystate "$dir" |
| chmod 770 "$dir" |
| minijail0 -u proxystate -g proxystate /sbin/date-proxy-watcher "$dir" & |
| trap "kill -TERM $!" EXIT TERM |
| while read x; do |
| echo "$x" > $proxy_file |
| restart tlsdate |
| sleep $restart_timeout |
| done < "$fifo" |
| end script |