blob: 55ad3f2f7e3db7c5873b327985f82f70265a5c67 [file] [log] [blame]
# Copyright 2016 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 "Remove stale ARC directories."
author "chromium-os-dev@chromium.org"
start on started arc-remove-data or arc-booted
# Stop the job on 'stopping ui' because once ui is stopped, ARC data files
# in the user's home directory will not be accessible anyway.
stop on stopping ui
import CHROMEOS_USER
# This job cleans up in the background not to block the user.
nice 10
# Note: This job is used by both ARC and ARCVM.
script
CHROMEOS_USER_HOME=$(cryptohome-path system "${CHROMEOS_USER}")
if [ ! -d "${CHROMEOS_USER_HOME}" ]; then
logger -t "${UPSTART_JOB}" \
"User home ${CHROMEOS_USER_HOME} does not exist"
exit 1
fi
exec /sbin/minijail0 \
-c 'cap_dac_override,cap_fowner,cap_dac_read_search+eip' \
--profile=minimalistic-mountns --uts -e -l -p -N \
-b /home \
-k "${CHROMEOS_USER_HOME},${CHROMEOS_USER_HOME},none,MS_BIND|MS_REC" \
-- /usr/sbin/arc-remove-stale-data
end script