PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/root.sh

http://github.com/joshua-redfield/lauf
Shell | 31 lines | 16 code | 0 blank | 15 comment | 1 complexity | 7dbce97cb4c27e08e412daea689dceea MD5 | raw file
  1. ########################################################
  2. # root v0.3.0 #
  3. # (c) 2010 joshua.redfield(AT)gmail.com & hunterm.haxxr@gmail.com #
  4. # Summary: #
  5. # Run something as root ################################
  6. # Usage: #
  7. # root, or root APPLICATION_NAME #######################
  8. # Dependencies: #
  9. # gksu, or gksudo ######################################
  10. _sudo_command=gksudo
  11. ########################################################
  12. # Arguements for skipping GUI #
  13. ########################################################
  14. if [ ! ${lauf_exec2:=unset} = "unset" ]; then
  15. _sudo=$lauf_exec2
  16. lauf_notify "Root" "Running $_sudo as root"
  17. ${_sudo_command} ${_sudo}
  18. return
  19. fi
  20. ########################################################
  21. # GUI Code #
  22. ########################################################
  23. _sudo=$(zenity --entry --width=${lauf_width} --window-icon=$lauf_app_icon --title="${lauf_app_name}" --text="What are we running as root?\nTip: Caution when running things as root!")
  24. case $? in
  25. 0)
  26. lauf_notify "Root" "Running $_sudo as root"
  27. ${sudo_command} ${_sudo}
  28. return;;
  29. 1)
  30. lauf_cancel;;
  31. esac