blob: fb873e16335ad122a81a2c94f1f70d7872585307 [file] [log] [blame]
#!/bin/sh
# Copyright (c) 2013 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.
#
# A script which translates sudo calls to su.
# Handle defines and sudo options.
while [ $# -ne 0 ]; do
case "$1" in
-K)
exit 0;;
-*)
echo "sudo_wrapper: don't know how to handle option: $1" 1>&2
exit 1;;
*=*)
export "$1"
shift;;
*)
break;;
esac
done
if [ $(id -u) -ne 0 ]; then
# Clarify to user that its the root password we want.
echo "Please enter the root password to proceed."
exec su -c '"$@"' root - "$@"
else
exec "$@"
fi