home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / bin / run-admin < prev    next >
Text File  |  2012-08-08  |  516b  |  30 lines

  1. #!/bin/bash
  2.  
  3. function showError
  4. {
  5.     echo $1 >/dev/stderr
  6.     zenity --error --text="$1"
  7. }
  8.  
  9. if test -z $1; then
  10.     echo "No command specified."
  11.     exit 1
  12. fi
  13.  
  14. if test `id -u` != "0"; then
  15.     showError "You do not have administrator privileges."
  16.     exit 1
  17. fi
  18.  
  19. app=`which $1`
  20.  
  21. for link in `find /etc/userlevel/admin-apps.d -type l 2>/dev/null`; do
  22.     target=`readlink $link`
  23.     if test "$target" = "$app"; then
  24.         exec "$@"
  25.     fi
  26. done
  27.  
  28. showError "You do not have permission to run application '$1'"
  29. exit 1
  30.