summaryrefslogtreecommitdiffstats
path: root/pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh
diff options
context:
space:
mode:
authorMichael <mr.michael.racz@gmail.com>2011-05-15 18:31:34 +0200
committerMichael <mr.michael.racz@gmail.com>2011-05-15 18:31:34 +0200
commita1a9f4f1b9f837d71cbe871925437bd7fd2db7ec (patch)
treec608a09cf1b2e52f49eb0df62646779d15ada620 /pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh
parentb0d63dc95ab5ed4496e0c4b888af06edace456d4 (diff)
downloadfoop-a1a9f4f1b9f837d71cbe871925437bd7fd2db7ec.tar.gz
foop-a1a9f4f1b9f837d71cbe871925437bd7fd2db7ec.tar.bz2
foop-a1a9f4f1b9f837d71cbe871925437bd7fd2db7ec.zip
smalltalk pacman added
Diffstat (limited to 'pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh')
-rwxr-xr-xpacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh101
1 files changed, 101 insertions, 0 deletions
diff --git a/pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh b/pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh
new file mode 100755
index 0000000..64a8114
--- /dev/null
+++ b/pacman-smalltalk/Squeak 4.1 All-in-One.app/Contents/Linux-i686/bin/squeak.sh
@@ -0,0 +1,101 @@
1#!/bin/sh
2#
3# Launch squeak from a menu, prompting for and/or installing an image
4#
5# Last edited: 2010-04-09 04:35:35 by piumarta on ubuntu
6
7PATH=/usr/bin:/bin
8
9if pwd -P 2>/dev/null 1>&2; then pwd="pwd -P"; else pwd="pwd"; fi
10
11me=`basename $0`
12bindir=`dirname $0`
13bindir=`cd ${bindir}; ${pwd}`
14prefix=`dirname ${bindir}`
15libdir="${prefix}/lib/squeak"
16vm="squeak"
17
18# find a way to display dialogues
19
20if test -n "$DISPLAY" -a -x "`which kdialog 2>/dev/null`"; then
21 error () { kdialog --error "${me}: $*"; exit 1; }
22 confirm () { if kdialog --yesno "${1} ${2}?"; then result="${2}"; else result=""; fi; }
23 chooseItem () { title="$1"; shift; result=`kdialog --combobox "${title}" $*`; }
24 findFile () { result=`kdialog --title "$1" --getopenfilename . '*.image'`; }
25 findDirectory () { result=`kdialog --title "$1" --getexistingdirectory .`; }
26elif [ -n "$DISPLAY" -a -x "`which zenity 2>/dev/null`" ]; then
27 error () { zenity --error --text "${me}: $*"; exit 1; }
28 confirm () { if zenity --question --text="${1} ${2}?"; then result="${2}"; else result=""; fi; }
29 chooseItem () { title="$1"; shift; result=`zenity --title "${title}" --list --column Images $*`; }
30 findFile () { result=`zenity --title "$1" --file-selection --file-filter='*.image'`; }
31 findDirectory () { result=`zenity --title "$1" --file-selection --directory`; }
32else
33 error () { echo "${me}: $*" >&2; exit 1; }
34 confirm () { error "this cannot happen"; }
35 chooseItem () { error "this cannot happen"; }
36 findFile () { error "no image name specified"; }
37 findDirectory () { error "this cannot happen"; }
38fi
39
40# succeed if there are two or more arguments
41
42plural () { test -n "$2"; }
43
44# find the VM
45
46if test -x "${bindir}/${vm}"; then
47 vm="${bindir}/${vm}"
48elif test -x "`which ${vm} 2>/dev/null`"; then
49 vm="`which ${vm} 2>/dev/null`"
50else
51 error "Cannot find ${vm}"
52fi
53
54# if we have arguments then assume an image name was given or we came
55# from a command line
56
57if test $# -gt 0; then
58 exec "${vm}" "$@"
59fi
60
61findFile "Choose a saved image to resume or cancel to install a new one"
62
63if test -z "${result}"; then
64 images=""
65 if test -d "${libdir}"; then
66 images=`cd "${libdir}"; ls *.image 2>/dev/null`
67 fi
68 if test -z "${images}"; then
69 error "no image name specified and no images found in ${libdir}"
70 exit 1
71 fi
72 if plural ${images}; then
73 chooseItem "Choose an image to install" ${images}
74 else
75 confirm "Install image" ${images}
76 fi
77 if test -z "${result}"; then
78 exit 0
79 fi
80 image=${result}
81 changes=`basename ${image} .image`.changes
82 findDirectory "Choose a destination directory for the image"
83 if test -z "${result}"; then
84 exit 0
85 fi
86 if test -e "${result}/${image}"; then
87 confirm "Overwrite existing ${image} in" "${result}"
88 if test -z "${result}"; then
89 exit 0;
90 fi
91 fi
92 cp -p "${libdir}/${image}" "${result}/."
93 cp -p "${libdir}/${changes}" "${result}/."
94 ln -s "${libdir}"/*.sources "${result}/."
95 image="${result}/${image}"
96else
97 image="${result}"
98fi
99
100cd "`dirname ${image}`"
101exec "${vm}" "`basename ${image}`"