Home | History | Annotate | Download | only in src
      1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 die () {
      6   echo "$@"
      7   exit 1
      8 }
      9 
     10 needuid () {
     11   uid=$(id -ru)
     12   [ "$uid" != "$1" ] && die "uid $uid != $1"
     13 }
     14 
     15 needeuid () {
     16   euid=$(id -u)
     17   [ "$euid" != "$1" ] && die "euid $euid != $1"
     18 }
     19 
     20 needgid () {
     21   gid=$(id -rg)
     22   [ "$gid" != "$1" ] && die "gid $gid != $1"
     23 }
     24 
     25 
     26 needegid () {
     27   egid=$(id -g)
     28   [ "$egid" != "$1" ] && die "egid $egid != $1"
     29 }
     30 
     31 needreuid () {
     32   needuid "$1"
     33   needeuid "$1"
     34 }
     35 
     36 needregid () {
     37   needgid "$1"
     38   needegid "$1"
     39 }
     40