From b30e0066176d8dc0eefdd27e5ee4035760199b8b Mon Sep 17 00:00:00 2001 From: Soekarmana Date: Tue, 8 Nov 2011 20:18:47 +0800 Subject: [PATCH] First Commit --- README | 0 easyLAMPP | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 README create mode 100755 easyLAMPP diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/easyLAMPP b/easyLAMPP new file mode 100755 index 0000000..36a75b9 --- /dev/null +++ b/easyLAMPP @@ -0,0 +1,58 @@ +#!/bin/bash +set -e + +sudotool=gksu +tmpScript=/tmp/easylampp.$RANDOM +CpanelLauncher="$HOME/.local/share/applications/XAMPP Control Panel.desktop" +HtdocsFolder="$HOME/.local/share/applications/XAMPP htdocs folder.desktop" +XAMPPtarball=`zenity --file-selection --file-filter=*.tar.gz --title="Select XAMPP for Linux tarball"` + +#create new temporary script +#so we can ask user for password just once +touch $tmpScript +(cat <<'EOF' +#!/bin/bash +set -e + +if [ -d /opt/lampp ]; then + mv /opt/lampp /opt/lampp.bak.$RANDOM + mkdir /opt/lampp && $sudotool file-roller $1 -e /opt + chown -R $2 /opt/lampp/htdocs +else + file-roller $1 -e /opt + chown -R $2 /opt/lampp/htdocs +fi +EOF +) > $tmpScript +chmod +x $tmpScript + +#ask user for password +#pass variable form parent script to temporay script with arguments +$sudotool --description="Installing XAMPP" $tmpScript "$XAMPPtarball" $USER + +#create Htdocs & Control panel launcher +touch "$CpanelLauncher" +(cat <<'EOF' +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Exec=gksu /opt/lampp/share/xampp-control-panel/xampp-control-panel +Name=XAMPP Control Panel +Icon=gnome-control-center +EOF +) > "$CpanelLauncher" +chmod +x "$CpanelLauncher" + +touch "$HtdocsFolder" +(cat <<'EOF' +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Exec=nautilus /opt/lampp/htdocs +Name=XAMPP htdocs +Icon=folder-remote +EOF +) > "$HtdocsFolder" +chmod +x "$HtdocsFolder"