| # Copyright 2020 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Chrome OS Optical Character Recognition (OCR) Service" |
| author "chromium-os-dev@chromium.org" |
| |
| # This service is started by D-Bus service activation through |
| # org.chromium.OpticalCharacterRecognition.service |
| stop on stopping ui |
| |
| # Minijail forks off the desired process and exits after forking. |
| expect fork |
| |
| pre-start script |
| # Check if UI is still running before starting ocr_service. |
| # This is to prevent new dbus-activated instances from getting |
| # started once the system is beginning to shut down. |
| if ! initctl status ui | grep -q running; then |
| stop |
| exit 0 |
| fi |
| end script |
| |
| exec minijail0 --config /usr/share/minijail/ocr.conf \ |
| -- /usr/bin/ocr_service |
| |
| post-start exec minijail0 -u ocr_service -g ocr_service /usr/bin/gdbus \ |
| wait --system --timeout 15 org.chromium.OpticalCharacterRecognition |