| # Copyright 2014 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 "Privet protocol handler daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| start on starting system-services |
| stop on stopping system-services |
| |
| env PRIVETD_LOG_LEVEL=0 |
| env PRIVETD_ENABLE_PING=false |
| env PRIVETD_DISABLE_SECURITY=false |
| env PRIVETD_STATE_PATH= |
| env PRIVETD_CONFIG_PATH= |
| env PRIVETD_DEVICE_WHITELIST= |
| |
| pre-start script |
| # privetd runs as its own user, and can't create files on the filesystem. |
| # Create appropriate workspaces accordingly. |
| mkdir -m 0755 -p /var/lib/privetd |
| chown -R privetd:privetd /var/lib/privetd |
| end script |
| |
| # Minijail actually forks off our desired process |
| expect fork |
| |
| exec minijail0 -i -g privetd -u privetd /usr/bin/privetd \ |
| --v="${PRIVETD_LOG_LEVEL}" \ |
| --disable_security="${PRIVETD_DISABLE_SECURITY}" \ |
| --enable_ping="${PRIVETD_ENABLE_PING}" \ |
| --config_path="${PRIVETD_CONFIG_PATH}" \ |
| --state_path="${PRIVETD_STATE_PATH}" \ |
| --device_whitelist="${PRIVETD_DEVICE_WHITELIST}" |