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.

65 lines
1.5 KiB

12 years ago
  1. #!/bin/bash
  2. set -e
  3. sudotool=gksu
  4. tmpScript=/tmp/easylampp.$RANDOM
  5. CpanelLauncher="$HOME/.local/share/applications/XAMPP Control Panel.desktop"
  6. HtdocsFolder="$HOME/.local/share/applications/XAMPP htdocs folder.desktop"
  7. XAMPPtarball=`zenity --file-selection --file-filter=*.tar.gz --title="Select XAMPP for Linux tarball"`
  8. #create new temporary script
  9. #so we can ask user for password just once
  10. touch $tmpScript
  11. (cat <<'EOF'
  12. #!/bin/bash
  13. set -e
  14. if [ -d /opt/lampp ]; then
  15. mv /opt/lampp /opt/lampp.bak.$RANDOM
  16. mkdir /opt/lampp && $sudotool file-roller $1 -e /opt
  17. chown -R $2 /opt/lampp/htdocs
  18. else
  19. file-roller $1 -e /opt
  20. chown -R $2 /opt/lampp/htdocs
  21. fi
  22. EOF
  23. ) > $tmpScript
  24. chmod +x $tmpScript
  25. #ask user for password
  26. #pass variable form parent script to temporay script with arguments
  27. $sudotool --description="Installing XAMPP" $tmpScript "$XAMPPtarball" $USER
  28. #create Htdocs & Control panel launcher
  29. touch "$CpanelLauncher"
  30. (cat <<'EOF'
  31. [Desktop Entry]
  32. Version=1.0
  33. Type=Application
  34. Terminal=false
  35. Exec=gksu /opt/lampp/share/xampp-control-panel/xampp-control-panel
  36. Name=XAMPP Control Panel
  37. Icon=gnome-control-center
  38. EOF
  39. ) > "$CpanelLauncher"
  40. chmod +x "$CpanelLauncher"
  41. touch "$HtdocsFolder"
  42. (cat <<'EOF'
  43. [Desktop Entry]
  44. Version=1.0
  45. Type=Application
  46. Terminal=false
  47. Exec=nautilus /opt/lampp/htdocs
  48. Name=XAMPP htdocs
  49. Icon=folder-remote
  50. EOF
  51. ) > "$HtdocsFolder"
  52. chmod +x "$HtdocsFolder"
  53. if zenity --question --text="Do you want to launch XAMPP now ?" --title="Installation Finished" == 0
  54. then
  55. $sudotool /opt/lampp/share/xampp-control-panel/xampp-control-panel
  56. fi
  57. exit 0