You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fll 1001B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh -e
  2. # Copyright: (C) 2008 Kel Modderman <kel@otaku42.de>
  3. # License: GPLv2 or any later version
  4. # By default we execute this as root user
  5. ROOTEXEC=yes
  6. # Locate directory we are called from
  7. THIS_DIR=$(dirname $(readlink -f ${0}))
  8. DEFAULTD="/usr/share/fll"
  9. # Locate the real program
  10. if [ -f ${THIS_DIR}/pyfll ]; then
  11. FLL="${THIS_DIR}/pyfll --share ${THIS_DIR}"
  12. elif [ -f /usr/share/fll/pyfll ]; then
  13. FLL="${DEFAULTD}/pyfll --share ${DEFAULTD}"
  14. else
  15. echo "Error locating pyfll.py, aborting." >&2
  16. exit 1
  17. fi
  18. # Get callers uid and gid for permission adjustment
  19. USER_UID=$(getent passwd ${USER} | cut -d\: -f3)
  20. USER_GID=$(getent passwd ${USER} | cut -d\: -f4)
  21. for arg in "${@}"; do
  22. case "${arg}" in
  23. -h*|--help|-n*|--non-root)
  24. ROOTEXEC=no
  25. break
  26. ;;
  27. esac
  28. done
  29. if [ "${ROOTEXEC}" = yes ]; then
  30. echo "Requires root!"
  31. ROOT_CMD="/usr/bin/python ${FLL} --uid ${USER_UID} --gid ${USER_GID} ${@}"
  32. exec sudo su root --command "${ROOT_CMD}"
  33. else
  34. exec /usr/bin/python ${FLL} ${@}
  35. fi