Properly handle spaces in filenames along the path to the installer.
[ardour.git] / tools / linux_packaging / install.sh
1 #!/bin/sh
2
3 # Make sure we have a terminal for the user to see and then run
4 # the real install script.
5
6 # Some systems don't correctly set the PWD when a script is double-clicked,
7 # so go ahead and figure out our path and make sure we are in that directory.
8
9 SAVED_PWD=$PWD
10 PKG_PATH=$(dirname "$(readlink -f "$0")")
11 cd "${PKG_PATH}"
12
13 if [ -z "$TERM" ] || [ "$TERM" = "dumb" ]; then
14         if which xterm > /dev/null; then
15                 exec xterm -e "${PKG_PATH}/.stage2.run"
16         elif which gnome-terminal > /dev/null; then
17                 exec gnome-terminal -e "${PKG_PATH}/.stage2.run"
18         elif which konsole > /dev/null; then
19                 exec konsole -e "${PKG_PATH}/.stage2.run"
20         fi
21 else
22         "${PKG_PATH}/.stage2.run"
23 fi
24
25 cd "${SAVED_PWD}"