Share Pastebin
Guest
Public paste!

Lex Berchot

By: a guest | Oct 25th, 2008 | Syntax: None | Size: 2.20 KB | Hits: 372 | Expires: Never
Copy text to clipboard
  1. #!/bin/bash
  2.  
  3. # slperm - reset the permissions for files on SL Viewer
  4. # Copyright 2008 - Lex Berchot, Moraine, Second Life, United States.
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are
  9. # met:
  10. #
  11. # * Redistributions of source code must retain the above copyright
  12. #   notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  18. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25.  
  26. # set -ex # Turn debugging on
  27.  
  28. INSTDIR=${INSTDIR:-/usr/local/games}
  29. VIEWER=SecondLife-i686-1.21.6.99587
  30.  
  31. CWD=$(pwd)
  32.  
  33. if [[ $UID -ne 0 ]]; then
  34.     echo "sorry this script is intended to be run as root"
  35.     exit 1
  36. else
  37.     # Make sure the permission on the toplevel dir is right:
  38.     cd ${INSTDIR} || exit 1
  39.     chown -R root:root ${VIEWER}
  40.  
  41.     # Change to the viewer:
  42.     cd ${VIEWER} || exit 1
  43.  
  44.     # Set the directories permission to normal:
  45.     find . -type d -exec chmod 0755 {} \;
  46.  
  47.     # Set the permissions of files to normal defaults:
  48.     find . \
  49.     \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 700 -o -perm 555 -o -perm 511 \) \
  50.     -exec chmod 755 {} \;
  51.  
  52.     # Set the permissions of executables to normal defaults:
  53.     find . \
  54.     \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  55.     -exec chmod 644 {} \;
  56.  
  57.     # Return to the Dir we came from:
  58.     cd ${CWD}
  59.  
  60. fi
  61.  
  62. echo "All Done, enjoy!"
  63. echo ""
  64. exit 0
  65.  
  66. #EOF