install-scripts.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # Install Dune Weaver Touch scripts to system locations
  3. set -e
  4. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  5. # Check if running as root
  6. if [ "$EUID" -ne 0 ]; then
  7. echo "❌ This script must be run as root (use sudo)"
  8. echo " These scripts need to be installed in /usr/local/bin/ with proper permissions"
  9. exit 1
  10. fi
  11. echo "🔧 Installing Dune Weaver Touch system scripts..."
  12. echo ""
  13. # Function to install a script
  14. install_script() {
  15. local script_name="$1"
  16. local source_path="$SCRIPT_DIR/$script_name"
  17. local target_path="/usr/local/bin/$script_name"
  18. if [ ! -f "$source_path" ]; then
  19. echo "❌ Source script not found: $source_path"
  20. return 1
  21. fi
  22. echo "📄 Installing $script_name..."
  23. # Copy script
  24. cp "$source_path" "$target_path"
  25. # Set proper permissions (executable by root, readable by all)
  26. chmod 755 "$target_path"
  27. chown root:root "$target_path"
  28. echo " ✅ Installed: $target_path"
  29. }
  30. # Install all scripts
  31. install_script "screen-on"
  32. install_script "screen-off"
  33. install_script "touch-monitor"
  34. echo ""
  35. echo "🎯 All scripts installed successfully!"
  36. echo ""
  37. echo "Installed scripts:"
  38. echo " /usr/local/bin/screen-on - Turn display on"
  39. echo " /usr/local/bin/screen-off - Turn display off"
  40. echo " /usr/local/bin/touch-monitor - Monitor touch input"
  41. echo ""
  42. echo "Test the scripts:"
  43. echo " sudo /usr/local/bin/screen-off"
  44. echo " sudo /usr/local/bin/screen-on"
  45. echo ""
  46. echo "⚠️ Note: The touch-monitor script is disabled by default in the app"
  47. echo " due to sensitivity issues. Direct touch monitoring is used instead."