Explorar el Código

Move installers and launchers into modules/installer and rewrite build scripts.

Change-Id: I10ba0cdd82cad1bd33c76b6f2b90e87b9a00b483
Depends-On: I2d518110abbf37196d11c8110c54ad20f34a115e
Reviewed-on: http://gerrit.dmdirc.com/1737
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.6b1
Shane Mc Cormack hace 13 años
padre
commit
de53f38769
Se han modificado 69 ficheros con 19 adiciones y 8549 borrados
  1. 7
    10
      build-installer.xml
  2. 12
    1
      build-versioning.xml
  3. 0
    206
      installer/gcode/googlecode_upload.py
  4. 0
    62
      installer/gcode/uploads_release.sh
  5. 0
    184
      installer/jar/makeJar.sh
  6. 0
    139
      installer/linux/functions.sh
  7. 0
    166
      installer/linux/getjre.sh
  8. 0
    344
      installer/linux/installerstub.sh
  9. 0
    251
      installer/linux/installjre.sh
  10. 0
    437
      installer/linux/makeInstallerLinux.sh
  11. 0
    325
      installer/linux/progressbar.sh
  12. 0
    248
      installer/linux/setup.sh
  13. 0
    141
      installer/linux/uninstall.sh
  14. BIN
      installer/osx/.DS_Store
  15. 0
    121
      installer/osx/DMDirc-Apple.c
  16. BIN
      installer/osx/libDMDirc-Apple.jnilib
  17. 0
    455
      installer/osx/makeInstallerOSX.sh
  18. BIN
      installer/osx/res/Background.png
  19. BIN
      installer/osx/res/DMDircVolumeIcon.png
  20. BIN
      installer/osx/res/VolumeIcon.icns
  21. BIN
      installer/osx/res/VolumeIcon.png
  22. BIN
      installer/osx/res/dmdirc.icns
  23. BIN
      installer/osx/res/logo128.png
  24. BIN
      installer/osx/res/logo16.png
  25. BIN
      installer/osx/res/logo256.png
  26. BIN
      installer/osx/res/logo32.png
  27. BIN
      installer/osx/res/logo512.png
  28. 0
    223
      installer/release.sh
  29. 0
    6
      installer/signing/readme.txt
  30. 0
    124
      installer/windows/makeInstallerNSIS.sh
  31. 0
    70
      launcher/createUpdate.sh
  32. 0
    522
      launcher/unix/DMDirc.sh
  33. 0
    169
      launcher/windows/DMDirc.dpr
  34. 0
    131
      launcher/windows/DMDircUpdater.dpr
  35. 0
    10
      launcher/windows/comctl.manifest
  36. 0
    1
      launcher/windows/comctl.rc
  37. 0
    29
      launcher/windows/compile.sh
  38. 0
    1
      launcher/windows/icon.rc
  39. 0
    27
      launcher/windows/version.rc
  40. 0
    65
      src/com/dmdirc/installer/DefaultSettings.java
  41. 0
    257
      src/com/dmdirc/installer/Installer.java
  42. 0
    133
      src/com/dmdirc/installer/InstallerListener.java
  43. 0
    282
      src/com/dmdirc/installer/LinuxInstaller.java
  44. 0
    169
      src/com/dmdirc/installer/Main.java
  45. 0
    64
      src/com/dmdirc/installer/Settings.java
  46. 0
    53
      src/com/dmdirc/installer/Step.java
  47. 0
    44
      src/com/dmdirc/installer/StepListener.java
  48. 0
    117
      src/com/dmdirc/installer/StreamReader.java
  49. 0
    44
      src/com/dmdirc/installer/TextStep.java
  50. 0
    337
      src/com/dmdirc/installer/WindowsInstaller.java
  51. 0
    39
      src/com/dmdirc/installer/WizardListener.java
  52. 0
    93
      src/com/dmdirc/installer/cliparser/BooleanParam.java
  53. 0
    91
      src/com/dmdirc/installer/cliparser/CLIParam.java
  54. 0
    274
      src/com/dmdirc/installer/cliparser/CLIParser.java
  55. 0
    81
      src/com/dmdirc/installer/cliparser/IntegerParam.java
  56. 0
    72
      src/com/dmdirc/installer/cliparser/StringParam.java
  57. 0
    101
      src/com/dmdirc/installer/ui/EtchedLineBorder.java
  58. 0
    371
      src/com/dmdirc/installer/ui/InstallerDialog.java
  59. 0
    95
      src/com/dmdirc/installer/ui/StepConfirm.java
  60. 0
    75
      src/com/dmdirc/installer/ui/StepError.java
  61. 0
    104
      src/com/dmdirc/installer/ui/StepInstall.java
  62. 0
    417
      src/com/dmdirc/installer/ui/StepLayout.java
  63. 0
    168
      src/com/dmdirc/installer/ui/StepSettings.java
  64. 0
    77
      src/com/dmdirc/installer/ui/StepWelcome.java
  65. 0
    34
      src/com/dmdirc/installer/ui/SwingStep.java
  66. 0
    74
      src/com/dmdirc/installer/ui/TextLabel.java
  67. 0
    91
      src/com/dmdirc/installer/ui/TitlePanel.java
  68. 0
    143
      src/com/dmdirc/installer/ui/WizardControlPanel.java
  69. 0
    181
      src/com/dmdirc/installer/ui/WizardPanel.java

+ 7
- 10
build-installer.xml Ver fichero

@@ -8,9 +8,8 @@
8 8
 
9 9
     <target name="installer"
10 10
             description="Build the installer.">
11
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
12
-            <arg value="release.sh"/>
13
-            <arg value="this"/>
11
+        <exec executable="bash" dir="modules/installer" resultproperty="installer.result">
12
+            <arg value="makeAll.sh"/>
14 13
         </exec>
15 14
 
16 15
         <condition property="installer.success">
@@ -19,15 +18,14 @@
19 18
 
20 19
         <echo message="Installer build finished."/>
21 20
         <echo message="Completed build files can be found in:"/>
22
-        <echo message="    ${installer.output.dir}"/>
21
+        <echo message="    ./modules/installer/output"/>
23 22
         <echo message=""/>
24 23
     </target>
25 24
 
26 25
     <target name="installer-stable"
27 26
             description="Build the installer for a stable release.">
28
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
29
-            <arg value="release.sh"/>
30
-            <arg value="-t"/>
27
+        <exec executable="bash" dir="modules/installer" resultproperty="installer.result">
28
+            <arg value="makeAll.sh"/>
31 29
             <arg value="-c"/>
32 30
             <arg value="STABLE"/>
33 31
             <arg value="--upload"/>
@@ -45,9 +43,8 @@
45 43
 
46 44
     <target name="installer-unstable"
47 45
             description="Build the installer for an unstable release.">
48
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
46
+        <exec executable="bash" dir="modules/installer" resultproperty="installer.result">
49 47
             <arg value="release.sh"/>
50
-            <arg value="-t"/>
51 48
             <arg value="-c"/>
52 49
             <arg value="UNSTABLE"/>
53 50
         </exec>
@@ -58,7 +55,7 @@
58 55
 
59 56
         <echo message="Installer build finished."/>
60 57
         <echo message="Completed build files can be found in:"/>
61
-        <echo message="    ${installer.output.dir}"/>
58
+        <echo message="    ./modules/installer/output"/>
62 59
         <echo message=""/>
63 60
     </target>
64 61
 

+ 12
- 1
build-versioning.xml Ver fichero

@@ -10,7 +10,7 @@
10 10
 
11 11
     <available file=".git" property="is.git"/>
12 12
 
13
-    <target name="-write-version" depends="-write-version-header, -add-version, -write-updater, -write-identities"/>
13
+    <target name="-write-version" depends="-write-version-header, -add-version, -write-updater, -write-identities, -write-disable-updates"/>
14 14
 
15 15
     <target name="-write-version-header">
16 16
         <echo file="${version.config}"># This is a DMDirc configuration file automatically generated by
@@ -43,6 +43,17 @@ version:
43 43
         <property name="channel" value="NONE"/>
44 44
     </target>
45 45
 
46
+    <target name="with.disabled.updater">
47
+        <property name="disableupdates" value="true" />
48
+    </target>
49
+
50
+    <target name="-write-disable-updates" if="disableupdates">
51
+        <echo file="${version.config}" append="true">
52
+version:
53
+    noupdates=true
54
+</echo>
55
+    </target>
56
+
46 57
     <target name="-write-updater" depends="-init-channel, -read-identities">
47 58
         <echo file="${version.config}" append="true">
48 59
 updater:

+ 0
- 206
installer/gcode/googlecode_upload.py Ver fichero

@@ -1,206 +0,0 @@
1
-#!/usr/bin/env python
2
-#
3
-# Copyright 2006, 2007 Google Inc. All Rights Reserved.
4
-# Author: danderson@google.com (David Anderson)
5
-#
6
-# Script for uploading files to a Google Code project.
7
-#
8
-# This is intended to be both a useful script for people who want to
9
-# streamline project uploads and a reference implementation for
10
-# uploading files to Google Code projects.
11
-#
12
-# To upload a file to Google Code, you need to provide a path to the
13
-# file on your local machine, a small summary of what the file is, a
14
-# project name, and a valid account that is a member or owner of that
15
-# project.  You can optionally provide a list of labels that apply to
16
-# the file.  The file will be uploaded under the same name that it has
17
-# in your local filesystem (that is, the "basename" or last path
18
-# component).  Run the script with '--help' to get the exact syntax
19
-# and available options.
20
-#
21
-# Note that the upload script requests that you enter your
22
-# googlecode.com password.  This is NOT your Gmail account password!
23
-# This is the password you use on googlecode.com for committing to
24
-# Subversion and uploading files.  You can find your password by going
25
-# to http://code.google.com/hosting/settings when logged in with your
26
-# Gmail account. If you have already committed to your project's
27
-# Subversion repository, the script will automatically retrieve your
28
-# credentials from there (unless disabled, see the output of '--help'
29
-# for details).
30
-#
31
-# If you are looking at this script as a reference for implementing
32
-# your own Google Code file uploader, then you should take a look at
33
-# the upload() function, which is the meat of the uploader.  You
34
-# basically need to build a multipart/form-data POST request with the
35
-# right fields and send it to https://PROJECT.googlecode.com/files .
36
-# Authenticate the request using HTTP Basic authentication, as is
37
-# shown below.
38
-#
39
-# Licensed under the terms of the Apache Software License 2.0:
40
-#  http://www.apache.org/licenses/LICENSE-2.0
41
-#
42
-# Questions, comments, feature requests and patches are most welcome.
43
-# Please direct all of these to the Google Code users group:
44
-#  http://groups.google.com/group/google-code-hosting
45
-
46
-"""Google Code file uploader script.
47
-"""
48
-
49
-__author__ = 'danderson@google.com (David Anderson) [Modified for DMDirc by Shane McCormack: shane@dmdirc.com]'
50
-
51
-import httplib
52
-import os.path
53
-import optparse
54
-import getpass
55
-import base64
56
-import sys
57
-
58
-
59
-
60
-def upload(file, project_name, user_name, password, summary, labels=None):
61
-  """Upload a file to a Google Code project's file server.
62
-
63
-  Args:
64
-    file: The local path to the file.
65
-    project_name: The name of your project on Google Code.
66
-    user_name: Your Google account name.
67
-    password: The googlecode.com password for your account.
68
-              Note that this is NOT your global Google Account password!
69
-    summary: A small description for the file.
70
-    labels: an optional list of label strings with which to tag the file.
71
-
72
-  Returns: a tuple:
73
-    http_status: 201 if the upload succeeded, something else if an
74
-                 error occured.
75
-    http_reason: The human-readable string associated with http_status
76
-    file_url: If the upload succeeded, the URL of the file on Google
77
-              Code, None otherwise.
78
-  """
79
-  # The login is the user part of user@gmail.com. If the login provided
80
-  # is in the full user@domain form, strip it down.
81
-  if '@' in user_name:
82
-    user_name = user_name[:user_name.index('@')]
83
-
84
-  form_fields = [('summary', summary)]
85
-  if labels is not None:
86
-    form_fields.extend([('label', l.strip()) for l in labels])
87
-
88
-  content_type, body = encode_upload_request(form_fields, file)
89
-
90
-  upload_host = '%s.googlecode.com' % project_name
91
-  upload_uri = '/files'
92
-  auth_token = base64.b64encode('%s:%s'% (user_name, password))
93
-  headers = {
94
-    'Authorization': 'Basic %s' % auth_token,
95
-    'User-Agent': 'Googlecode.com uploader v0.9.4 (DMDirc)',
96
-    'Content-Type': content_type,
97
-    }
98
-
99
-  server = httplib.HTTPSConnection(upload_host)
100
-  server.request('POST', upload_uri, body, headers)
101
-  resp = server.getresponse()
102
-  server.close()
103
-
104
-  if resp.status == 201:
105
-    location = resp.getheader('Location', None)
106
-  else:
107
-    location = None
108
-  return resp.status, resp.reason, location
109
-
110
-
111
-def encode_upload_request(fields, file_path):
112
-  """Encode the given fields and file into a multipart form body.
113
-
114
-  fields is a sequence of (name, value) pairs. file is the path of
115
-  the file to upload. The file will be uploaded to Google Code with
116
-  the same file name.
117
-
118
-  Returns: (content_type, body) ready for httplib.HTTP instance
119
-  """
120
-  BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
121
-  CRLF = '\r\n'
122
-
123
-  body = []
124
-
125
-  # Add the metadata about the upload first
126
-  for key, value in fields:
127
-    body.extend(
128
-      ['--' + BOUNDARY,
129
-       'Content-Disposition: form-data; name="%s"' % key,
130
-       '',
131
-       value,
132
-       ])
133
-
134
-  # Now add the file itself
135
-  file_name = os.path.basename(file_path)
136
-  f = open(file_path, 'rb')
137
-  file_content = f.read()
138
-  f.close()
139
-
140
-  body.extend(
141
-    ['--' + BOUNDARY,
142
-     'Content-Disposition: form-data; name="filename"; filename="%s"'
143
-     % file_name,
144
-     # The upload server determines the mime-type, no need to set it.
145
-     'Content-Type: application/octet-stream',
146
-     '',
147
-     file_content,
148
-     ])
149
-
150
-  # Finalize the form body
151
-  body.extend(['--' + BOUNDARY + '--', ''])
152
-
153
-  return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
154
-
155
-
156
-
157
-def main():
158
-  parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
159
-                                 '[options] FILE')
160
-  parser.add_option('-s', '--summary', dest='summary',
161
-                    help='Short description of the file')
162
-  parser.add_option('-u', '--user', dest='user',
163
-                    help='Your Google Code username')
164
-  parser.add_option('--pass', dest='password',
165
-                    help='Your Google Code password')
166
-  parser.add_option('-l', '--labels', dest='labels',
167
-                    help='An optional list of labels to attach to the file')
168
-
169
-  options, args = parser.parse_args()
170
-
171
-  if not options.summary:
172
-    parser.error('File summary is missing.')
173
-  elif not options.user:
174
-    parser.error('Username is missing.')
175
-  elif not options.password:
176
-    parser.error('Password is missing.')
177
-  elif len(args) < 1:
178
-    parser.error('File to upload not provided.')
179
-  elif len(args) > 1:
180
-    parser.error('Only one file may be specified.')
181
-
182
-  file_path = args[0]
183
-
184
-  if options.labels:
185
-    labels = options.labels.split(',')
186
-  else:
187
-    labels = None
188
-
189
-#  print 'Summary: %s' % options.summary
190
-#  print 'Labels: %s' % options.labels
191
-#  print 'Path: %s' % file_path
192
-
193
-  status, reason, url = upload(file_path, 'dmdirc', options.user, options.password, options.summary, labels)
194
-
195
-  if url:
196
-    print 'The file was uploaded successfully.'
197
-    print 'URL: %s' % url
198
-    return 0
199
-  else:
200
-    print 'An error occurred. Your file was not uploaded.'
201
-    print 'Google Code upload server said: %s (%s)' % (reason, status)
202
-    return 1
203
-
204
-
205
-if __name__ == '__main__':
206
-  sys.exit(main())

+ 0
- 62
installer/gcode/uploads_release.sh Ver fichero

@@ -1,62 +0,0 @@
1
-#!/bin/sh
2
-
3
-# Leave blank here, loaded from config file.
4
-USERNAME=""
5
-PASSWORD=""
6
-
7
-# Load stored password.
8
-if [ -e "${HOME}/.GoogleCode" ]; then
9
-. ${HOME}/.GoogleCode
10
-fi;
11
-
12
-PYTHON=`which python`
13
-if [ "" = "${PYTHON}" ]; then
14
-	echo 'Python not found. Aborting.'
15
-	exit 1;
16
-fi;
17
-
18
-VERSION=""
19
-while test -n "$1"; do
20
-	LAST=${1}
21
-	case "$1" in
22
-		--version|-v)
23
-			shift
24
-			VERSION="${1}"
25
-			;;
26
-	esac
27
-	shift
28
-done
29
-
30
-if [ "" = "${VERSION}" ]; then
31
-	echo "Version not specified. Aborting"
32
-	exit 1;
33
-fi;
34
-
35
-if [ "" = "${USERNAME}" ]; then
36
-	echo "Username not found (Check: ${HOME}/.GoogleCode)"
37
-#	exit 1;
38
-fi;
39
-if [ "" = "${PASSWORD}" ]; then
40
-	echo "Password not found (Check: ${HOME}/.GoogleCode)"
41
-#	exit 1;
42
-fi;
43
-
44
-uploadFile() {
45
-	TYPE=${1}
46
-	LABELS=${2}
47
-	FILE=${3}
48
-	
49
-	if [ -e "../output/${FILE}" ]; then
50
-		echo ""
51
-		echo "Uploading ${TYPE}"
52
-		${PYTHON} ${PWD}/googlecode_upload.py --summary "DMDirc ${VERSION} ${TYPE}" --user ${USERNAME} --pass ${PASSWORD} --labels="Featured,${LABELS}" ${FILE}
53
-	else
54
-		echo "Not Uploading ${TYPE} (File '${FILE}' Doesn't exist)"
55
-	fi;
56
-}
57
-
58
-uploadFile "Jar" "Type-Executable,OpSys-All" "../output/DMDirc-${VERSION}.jar"
59
-uploadFile "OS X Image" "Type-Archive,OpSys-OSX" "../output/DMDirc-${VERSION}.dmg"
60
-uploadFile "Windows Installer" "Type-Installer,OpSys-Windows" "../output/DMDirc-${VERSION}-Setup.exe"
61
-uploadFile "Unix Installer" "Type-Installer,OpSys-Linux,OpSys-BSD,OpSys-Solaris" "../output/DMDirc-${VERSION}-Setup.run"
62
-exit 0;

+ 0
- 184
installer/jar/makeJar.sh Ver fichero

@@ -1,184 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script generates a jar file for a release version of DMDirc
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
7
-#
8
-# Permission is hereby granted, free of charge, to any person obtaining a copy
9
-# of this software and associated documentation files (the "Software"), to deal
10
-# in the Software without restriction, including without limitation the rights
11
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
-# copies of the Software, and to permit persons to whom the Software is
13
-# furnished to do so, subject to the following conditions:
14
-#
15
-# The above copyright notice and this permission notice shall be included in
16
-# all copies or substantial portions of the Software.
17
-#
18
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
-# SOFTWARE.
25
-
26
-# Final Name of the file (without file extention)
27
-FILENAME=DMDirc
28
-# full name of the file to output to
29
-RUNNAME="${PWD}/${FILENAME}.jar"
30
-
31
-# Go!
32
-echo "-----------"
33
-if [ -e "${RUNNAME}" ]; then
34
-	echo "Removing existing file"
35
-	rm -Rf ${RUNNAME}
36
-fi
37
-
38
-showHelp() {
39
-	echo "This will generate a DMDirc jar file for any system with java on it."
40
-	echo "The following command line arguments are known:"
41
-	echo "---------------------"
42
-	echo "-h, --help                Help information"
43
-	echo "-p, --plugins <plugins>   What plugins to add to the jar file"
44
-	echo "-c, --compile             Recompile the .jar file (otherwise use the existing file from dist/)"
45
-	echo "    --jar <file>          use <file> as DMDirc.jar (ie just add the plugins to it and rename)"
46
-	echo "    --current             Use the current folder as the base for the build"
47
-	echo "-e, --extra <tag>         Tag to add to final name to distinguish this build from a standard build"
48
-	echo "    --channel [channel]  Channel to pass to ant (if not passed, 'NONE', if passed without a value, 'STABLE')"
49
-	echo "---------------------"
50
-	exit 0;
51
-}
52
-
53
-# Check for some CLI params
54
-compileJar="false"
55
-isRelease=""
56
-finalTag=""
57
-BRANCH="0"
58
-plugins=""
59
-location="../../"
60
-current="1"
61
-jarfile=""
62
-jre=""
63
-jrename="jre" # Filename for JRE without the .bin
64
-TAGGED=""
65
-CHANNEL="NONE"
66
-while test -n "$1"; do
67
-	case "$1" in
68
-		--plugins|-p)
69
-			shift
70
-			plugins=${1}
71
-			;;
72
-		--jar)
73
-			shift
74
-			jarfile=${1}
75
-			;;
76
-		--current)
77
-			location="../../"
78
-			current="1"
79
-			;;
80
-		--compile|-c)
81
-			compileJar="true"
82
-			;;
83
-		--release|-r)
84
-			shift
85
-			isRelease=${1}
86
-			;;
87
-		--extra|-e)
88
-			shift
89
-			finalTag=${1}
90
-			RUNNAME="${PWD}/${FILENAME}-${1}.jar"
91
-			;;
92
-		--help|-h)
93
-			showHelp;
94
-			;;
95
-		--branch|-b)
96
-			BRANCH="1"
97
-			;;
98
-		--tag|-t)
99
-			TAGGED=`git describe --tags`
100
-			TAGGED=${TAGGED%%-*}
101
-			;;
102
-		--channel)
103
-			PASSEDPARAM=`echo "${2}" | grep -v ^-`
104
-			if [ "${PASSEDPARAM}" != "" ]; then
105
-				shift
106
-				CHANNEL=${PASSEDPARAM};
107
-			else
108
-				CHANNEL="STABLE";
109
-			fi;
110
-			;;
111
-	esac
112
-	shift
113
-done
114
-if [ "" = "${current}" ]; then
115
-	jarPath="${location}trunk"
116
-else
117
-	jarPath="${location}"
118
-fi
119
-
120
-if [ "" = "${jarfile}" ]; then
121
-	jarfile=${jarPath}"/dist/DMDirc.jar"
122
-	if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
123
-		echo "Creating jar.."
124
-		OLDPWD=${PWD}
125
-		cd ${jarPath}
126
-
127
-		ant -Dchannel=${CHANNEL} clean jar
128
-		if [ ! -e "dist/DMDirc.jar" ]; then
129
-			echo "There was an error creating the .jar file. Aborting."
130
-			exit 1;
131
-		fi;
132
-		cd ${OLDPWD}
133
-	fi;
134
-elif [ ! -e "${jarfile}" ]; then
135
-	echo "Requested Jar file (${jarfile}) does not exist."
136
-	exit 1;
137
-fi;
138
-
139
-echo "Copying jar (${jarfile} -> ${RUNNAME}).."
140
-cp ${jarfile} ${RUNNAME}
141
-
142
-# Remove plugins added by createAllPluginJar
143
-zip -d ${RUNNAME} plugins plugins/*
144
-
145
-if [ "${plugins}" != "" ]; then
146
-	echo "Adding plugins to jar"
147
-	ln -sf ${jarPath}"/plugins"
148
-	pluginList=""
149
-	for plugin in ${plugins}; do
150
-		pluginList=${pluginList}" plugins/${plugin}"
151
-	done
152
-	jar -uvf "${RUNNAME}" ${pluginList}
153
-
154
-        ../../updateBundledPlugins.sh ${RUNNAME};
155
-	rm -Rf plugins;
156
-fi;
157
-
158
-doRename=0
159
-if [ "${TAGGED}" != "" ]; then
160
-	doRename=1	
161
-fi;
162
-
163
-if [ ${doRename} -eq 1 ]; then
164
-	if [ "${TAGGED}" = "" ]; then
165
-		isRelease=branch-${isRelease}
166
-	else
167
-		isRelease=${TAGGED}
168
-	fi;
169
-
170
-	if [ "" != "${finalTag}" ]; then
171
-		finalTag="-${finalTag}"
172
-	fi;
173
-	finalname=DMDirc-${isRelease}${finalTag}.jar
174
-else
175
-	finalname=${RUNNAME##*/}
176
-fi;
177
-
178
-mv ${RUNNAME} ../output/${finalname}
179
-echo "-----------"
180
-echo "Done."
181
-echo "-----------"
182
-
183
-# and Done \o
184
-exit 0;

+ 0
- 139
installer/linux/functions.sh Ver fichero

@@ -1,139 +0,0 @@
1
-#!/bin/sh
2
-
3
-# Check for OS X
4
-OSASCRIPT=`which osascript`
5
-KERNEL=`uname -s`
6
-ISOSX="0"
7
-# Kernel is darwin, and osascript exists, probably OS X!
8
-if [ "${KERNEL}" = "Darwin" -a "" != "${OSASCRIPT}" ]; then
9
-	ISOSX="1"
10
-fi;
11
-
12
-if [ "${ISOSX}" != "1" ]; then
13
-	PIDOF=`which pidof`
14
-	if [ "${PIDOF}" = "" ]; then
15
-		# For some reason some distros hide pidof...
16
-		if [ -e /sbin/pidof ]; then
17
-			PIDOF=/sbin/pidof
18
-		elif [ -e /usr/sbin/pidof ]; then
19
-			PIDOF=/usr/sbin/pidof
20
-		fi;
21
-	fi;
22
-	
23
-	PGREP=`which pgrep`
24
-	if [ "${PIDOF}" != "" ]; then
25
-		ISKDE=`${PIDOF} -x -s kdeinit kdeinit4`
26
-		ISGNOME=`${PIDOF} -x -s gnome-panel`
27
-	elif [ "${PGREP}" != "" ]; then
28
-		ISKDE=`pgrep kdeinit`
29
-		ISGNOME=`pgrep gnome-panel`
30
-	else
31
-		ISKDE=`ps -Af | grep kdeinit | grep -v grep`
32
-		ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
33
-	fi;
34
-	KDIALOG=`which kdialog`
35
-	ZENITY=`which zenity`
36
-	DIALOG=`which dialog`
37
-	
38
-	KSUDO=`which kdesudo`
39
-	GSUDO=`which gksudo`
40
-fi;
41
-
42
-if [ "${ISKDE}" != "" -o "${ZENITY}" = "" ]; then
43
-	USEKDIALOG="1";
44
-else
45
-	USEKDIALOG="0";
46
-fi;
47
-
48
-messagedialog() {
49
-	# Send message to console.
50
-	echo ""
51
-	echo "-----------------------------------------------------------------------"
52
-	echo "DMDirc: ${1}"
53
-	echo "-----------------------------------------------------------------------"
54
-	echo "${2}"
55
-	echo "-----------------------------------------------------------------------"
56
-
57
-
58
-	# If we are on OSX
59
-	if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
60
-		echo "Displaying dialog.."
61
-		${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} giving up after 120 with icon note" -e 'end tell'
62
-	elif [ "" != "${KDIALOG}" -a "" != "${DISPLAY}" -a "" = "${ISGNOME}" -a "${USEKDIALOG}" = "1" ]; then
63
-		# else if kdialog exists, and we have a display, and we are not running
64
-		# gnome, and either we are running kde or zenity doesn't exist..
65
-		echo "Dialog on Display: ${DISPLAY}"
66
-		${KDIALOG} --title "DMDirc: ${1}" --msgbox "${2}"
67
-	elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
68
-		# Else, if zenity exists and we have a display
69
-		echo "Dialog on Display: ${DISPLAY}"
70
-		${ZENITY} --info --title "DMDirc: ${1}" --text "${2}"
71
-	elif [ "" != "${DIALOG}" ]; then
72
-		# Else, if dialog exists and we have a display
73
-		${DIALOG} --title "DMDirc: ${1}" --msgbox "${2}" 8 40 
74
-	fi;
75
-}
76
-
77
-questiondialog() {
78
-	# Send question to console.
79
-	echo ""
80
-	echo "-----------------------------------------------------------------------"
81
-	echo "DMDirc: ${1}"
82
-	echo "-----------------------------------------------------------------------"
83
-	echo "${2}"
84
-	echo "-----------------------------------------------------------------------"
85
-
86
-	# If we are on OSX
87
-	if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
88
-		echo "Displaying dialog.."
89
-		${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"Line 1\nLine 2\" with icon note" -e 'end tell'
90
-	elif [ "" != "${KDIALOG}" -a "" != "${DISPLAY}" -a "" = "${ISGNOME}" -a "${USEKDIALOG}" = "1" ]; then
91
-		# else if kdialog exists, and we have a display, and we are not running
92
-		# gnome, and either we are running kde or zenity doesn't exist..
93
-		echo "Dialog on Display: ${DISPLAY}"
94
-		${KDIALOG} --title "DMDirc: ${1}" --yesno "${2}"
95
-	elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
96
-		# Else, if zenity exists and we have a display
97
-		echo "Dialog on Display: ${DISPLAY}"
98
-		${ZENITY} --question --title "DMDirc: ${1}" --text "${2}"
99
-	elif [ "" != "${DIALOG}" ]; then
100
-		# Else, if dialog exists and we have a display
101
-		${DIALOG} --title "DMDirc: ${1}" --yesno "${2}" 8 40
102
-	elif [ "${3}" != "" ]; then
103
-		# Else, fail and return default.
104
-		echo "Unable to ask question, assuming '${3}'."
105
-		return ${3};
106
-	else
107
-		# Else, fail and return no.
108
-		echo "Unable to ask question, assuming no."
109
-		return 1;
110
-	fi;
111
-}
112
-
113
-errordialog() {
114
-	# Send error to console.
115
-	echo ""
116
-	echo "-----------------------------------------------------------------------"
117
-	echo "[Error] DMDirc: ${1}"
118
-	echo "-----------------------------------------------------------------------"
119
-	echo "${2}"
120
-	echo "-----------------------------------------------------------------------"
121
-
122
-	# If we are on OSX
123
-	if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
124
-		echo "Displaying dialog.."
125
-		${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} with icon stop" -e 'end tell'
126
-	elif [ "" != "${KDIALOG}" -a "" != "${DISPLAY}" -a "" = "${ISGNOME}" -a "${USEKDIALOG}" = "1" ]; then
127
-		# else if kdialog exists, and we have a display, and we are not running
128
-		# gnome, and either we are running kde or zenity doesn't exist..
129
-		echo "Dialog on Display: ${DISPLAY}"
130
-		${KDIALOG} --title "DMDirc: ${1}" --error "${2}"
131
-	elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
132
-		# Else, if zenity exists and we have a display
133
-		echo "Dialog on Display: ${DISPLAY}"
134
-		${ZENITY} --error --title "DMDirc: ${1}" --text "${2}"
135
-	elif [ "" != "${DIALOG}" ]; then
136
-		# Else, if dialog exists and we have a display
137
-		${DIALOG} --title "[Error] DMDirc: ${1}" --msgbox "${2}" 8 40
138
-	fi
139
-}

+ 0
- 166
installer/linux/getjre.sh Ver fichero

@@ -1,166 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script downloads a JRE.
4
-#
5
-
6
-# Check the which command exists, and if so make sure it behaves how we want
7
-# it to...
8
-WHICH=`which which 2>/dev/null`
9
-if [ "" = "${WHICH}" ]; then
10
-	echo "which command not found. Aborting.";
11
-	exit 0;
12
-else
13
-	# Solaris sucks
14
-	BADWHICH=`which /`
15
-	if [ "${BADWHICH}" != "" ]; then
16
-		echo "Replacing bad which command.";
17
-		# "Which" on solaris gives non-empty results for commands that don't exist
18
-		which() {
19
-			OUT=`${WHICH} ${1}`
20
-			if [ $? -eq 0 ]; then
21
-				echo ${OUT}
22
-			else
23
-				echo ""
24
-			fi;
25
-		}
26
-	fi;
27
-fi
28
-
29
-# Find out where we are
30
-BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
31
-
32
-PIDOF=`which pidof`
33
-if [ "${PIDOF}" = "" ]; then
34
-	# For some reason some distros hide pidof...
35
-	if [ -e /sbin/pidof ]; then
36
-		PIDOF=/sbin/pidof
37
-	elif [ -e /usr/sbin/pidof ]; then
38
-		PIDOF=/usr/sbin/pidof
39
-	fi;
40
-fi;
41
-
42
-if [ -e "${BASEDIR}/functions.sh" ]; then
43
-	. ${BASEDIR}/functions.sh
44
-else
45
-	echo "Unable to find functions.sh, unable to continue."
46
-	exit 1;
47
-fi;
48
-
49
-# Get the JRE.
50
-ARCH=`uname -m`
51
-ISAINFO=`which isainfo`
52
-ISFREEBSD=`uname -s | grep -i FreeBSD`
53
-if [ "${ISAINFO}" != "" ]; then
54
-	# Solaris-ish
55
-	ARCH=`uname -p`
56
-fi;
57
-URL="http://www.dmdirc.com/getjava/`uname -s`/${ARCH}"
58
-if [ "${ISFREEBSD}" != "" ]; then
59
-	RELEASE=`uname -r`
60
-	URL="${URL}/${RELEASE}"
61
-fi;
62
-
63
-WGET=`which wget`
64
-FETCH=`which fetch`
65
-CURL=`which curl`
66
-if [ "${WGET}" != "" ]; then
67
-	length=`${WGET} --spider ${URL} 2>&1 | grep "Length:"| awk '{print $2, $3}' | sed 's/,//g'`
68
-	actualLength=${length%% *}
69
-elif [ "${FETCH}" != "" ]; then
70
-	actualLength=`${FETCH} -s ${URL}`
71
-elif [ "${CURL}" != "" ]; then
72
-	length=`${CURL} -# -I ${URL} 2>&1 | grep "Content-Length:"| awk '{print $2}'`
73
-fi;
74
-
75
-# Convert the length from Bytes to something user-friendly is possible.
76
-BC=`which bc`
77
-if [ "${BC}" = "" ]; then
78
-	niceLength=${actualLength}"B"
79
-elif [ ${actualLength} -ge 1048576 ]; then
80
-	niceLength=`echo "scale=2; ${actualLength}/1048576" | bc`"MB"
81
-elif [ ${actualLength} -ge 1024 ]; then
82
-	niceLength=`echo "scale=2; ${actualLength}/1024" | bc`"KB"
83
-else
84
-	niceLength=`echo "scale=2; ${actualLength}" | bc`"B"
85
-fi;
86
-
87
-if [ "${actualLength}" = "6" ]; then
88
-	# Unable to download.
89
-	errordialog "Download Failed" "Unable to find JRE for this platform (`uname -s`/${ARCH})."
90
-	exit 1;
91
-fi;
92
-
93
-PIPE=""
94
-wgetpid=""
95
-# Make sure wget and the progressbar die if we do.
96
-badclose() {
97
-	if [ "${wgetpid}" != "" ]; then
98
-		kill -9 ${wgetpid}
99
-	fi;
100
-	if [ "${PIPE}" != "" ]; then
101
-		if [ -e ${PIPE} ]; then
102
-			echo "quit" > ${PIPE}
103
-			echo "Closing badly, pipe still exists."
104
-		fi
105
-	fi
106
-}
107
-trap 'badclose' INT TERM EXIT
108
-
109
-if [ "" != "${1}" ]; then
110
-	questiondialog "Download JRE" "${1} (Download Size: ${niceLength})"
111
-	result=$?
112
-else
113
-		questiondialog "Download JRE" "Would you like to download the java JRE? (Download Size: ${niceLength})\n(Choose no if you want to manually install or install using a package manager)"
114
-	result=$?
115
-fi;
116
-if [ $result -eq 0 ]; then
117
-	PIPE=`mktemp progresspipe.XXXXXXXXXXXXXX`
118
-	if [ "${WGET}" != "" ]; then
119
-		${WGET} -q -O jre.bin ${URL} &
120
-		wgetpid=${!}
121
-	elif [ "${FETCH}" != "" ]; then
122
-		${FETCH} -q -o jre.bin ${URL} &
123
-		wgetpid=${!}
124
-	elif [ "${CURL}" != "" ]; then
125
-		${CURL} -s -o jre.bin ${URL} &
126
-		wgetpid=${!}
127
-	fi;
128
-	/bin/sh ${PWD}/progressbar.sh "Downloading JRE.." ${actualLength} ${PIPE} ${wgetpid} &
129
-	sleep 1;
130
-	progressbarpid=${!}
131
-	while [ `ps -p ${wgetpid} | wc -l` = 2 ]; do
132
-		SIZE=`ls -l jre.bin | awk '{print $5}'`
133
-		if [ -e ${PIPE} ]; then
134
-			echo "${SIZE}" > ${PIPE}
135
-		else
136
-			kill -9 ${wgetpid}
137
-			errordialog "Download Canceled" "Download Canceled by user"
138
-			exit 1;
139
-		fi;
140
-	done;
141
-	if [ -e ".downloadWasCancelled" ]; then
142
-		kill -9 ${wgetpid}
143
-		errordialog "Download Canceled" "Download Canceled by user"
144
-		exit 1;
145
-	fi;
146
-	SIZE=`ls -l jre.bin | awk '{print $5}'`
147
-	/bin/sh ${PWD}/progressbar.sh --watchdog ${progressbarpid} &
148
-	if [ -e ${PIPE} ]; then
149
-		echo "${SIZE}" > ${PIPE}
150
-	fi;
151
-	wgetpid=""
152
-	if [ "${ISFREEBSD}" != "" -o "${ISAINFO}" != "" ]; then
153
-		echo "Killing progressbar"
154
-		kill ${progressbarpid}
155
-	fi;
156
-	messagedialog "Download Completed" "Download Completed"
157
-	if [ -e ${PIPE} ]; then
158
-		echo "Deleting Pipe ${PIPE}"
159
-		rm -Rf "${PIPE}"
160
-	fi;
161
-	exit 0;
162
-else
163
-	messagedialog "Download JRE" "JRE Download Canceled"
164
-	exit 1;
165
-fi;
166
-exit 1;

+ 0
- 344
installer/linux/installerstub.sh Ver fichero

@@ -1,344 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script installs dmdirc
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
7
-#
8
-# Permission is hereby granted, free of charge, to any person obtaining a copy
9
-# of this software and associated documentation files (the "Software"), to deal
10
-# in the Software without restriction, including without limitation the rights
11
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
-# copies of the Software, and to permit persons to whom the Software is
13
-# furnished to do so, subject to the following conditions:
14
-#
15
-# The above copyright notice and this permission notice shall be included in
16
-# all copies or substantial portions of the Software.
17
-#
18
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
-# SOFTWARE.
25
-
26
-MD5=""
27
-
28
-# Check the which command exists, and if so make sure it behaves how we want
29
-# it to...
30
-WHICH=`which which 2>/dev/null`
31
-if [ "" = "${WHICH}" ]; then
32
-	echo "which command not found. Aborting.";
33
-	exit 0;
34
-else
35
-	# Solaris sucks
36
-	BADWHICH=`which /`
37
-	if [ "${BADWHICH}" != "" ]; then
38
-		# "Which" on solaris gives non-empty results for commands that don't exist
39
-		which() {
40
-			OUT=`${WHICH} ${1}`
41
-			if [ $? -eq 0 ]; then
42
-				echo ${OUT}
43
-			else
44
-				echo ""
45
-			fi;
46
-		}
47
-	fi;
48
-fi
49
-
50
-# Find out what params we should pass to things.
51
-# Solaris has a nice and ancient version of grep in /usr/bin
52
-grep -na "" /dev/null >/dev/null 2>&1
53
-if [ $? -eq 2 ]; then
54
-	GREPOPTS="-n"
55
-else
56
-	GREPOPTS="-na"
57
-fi;
58
-# Solaris also has a crappy version of tail!
59
-tail -n +1 /dev/null >/dev/null 2>&1
60
-if [ $? -eq 2 ]; then
61
-	TAILOPTS="+"
62
-else
63
-	TAILOPTS="-n +"
64
-fi;
65
-
66
-###ADDITIONAL_STUFF###
67
-
68
-###FUNCTIONS_FILE###
69
-
70
-# Location of .run stub end
71
-ENDLINE=`grep ${GREPOPTS} "^###END STUB###$" $0`
72
-ENDLINE=$((${ENDLINE%%:*} + 1))
73
-
74
-if [ "" = "${ENDLINE}" ]; then
75
-	errordialog "DMDirc Setup" "End of stub not found. Aborting.";
76
-	exit 0;
77
-fi
78
-
79
-# Attempt to get a name for a random dir in /tmp
80
-random() {
81
-	# First off, lets try mktemp.
82
-	MKTEMP=`which mktemp`
83
-	if [ "" != "${MKTEMP}" ]; then
84
-		# mktemp exists \o
85
-		DIR=`${MKTEMP} -d /tmp/DMDirc.XXXXXX`
86
-		eval "$1=${DIR}"
87
-		return;
88
-	fi
89
-
90
-	TMPDIR=${TMPDIR:=/tmp}
91
-	BASEDIR=${TMPDIR}dmdirc_`whoami`_
92
-	DIR=${PWD}
93
-	while [ -d "${DIR}" ]; do
94
-		if [ "" != "${RANDOM}" ]; then
95
-			# Bash has a psuedo random number generator that can be accessed
96
-			# using ${RANDOM}
97
-			RND=${RANDOM}${RANDOM}${RANDOM}
98
-		else
99
-			# Dash (the ubuntu default sh) however does not.
100
-			# od and awk however usually exist, and we can get a random number
101
-			# from /dev/urandom or /dev/random
102
-			OD=`which od`
103
-			AWK=`which awk`
104
-			RND=""
105
-			if [ "" != "$OD" -a "" != "$AWK" ]; then
106
-				# Try /dev/urandom first
107
-				RAND=/dev/urandom
108
-				# If it doesn't exist try /dev/random
109
-				if [ ! -e "${RAND}" ]; then
110
-					RAND=/dev/urandom;
111
-				fi
112
-				# This makes sure we only try to read if one exists
113
-				if [ ! -e "${RAND}" ]; then
114
-					RND=$(head -1 ${RAND} | od -N 3 -t u | awk '{ print $2 }')
115
-				fi;
116
-			fi;
117
-
118
-			# No random number was generated, getting to here means that
119
-			# ${RANDOM} doesn't exist, /dev/random doesn't exist, /dev/urandom doesn't exist
120
-			# or that od/awk don't exist. Annoying.
121
-			# Try using this processes PID instead!
122
-			if [ "${RND}" = "" ]; then
123
-				RND=$$
124
-				DIR=${BASEDIR}${RND}
125
-				if [ -e "${DIR}" ]; then
126
-					# Lets hope this never happens.
127
-					errordialog "DMDirc Setup" "Unable to create random directory";
128
-					exit 0;
129
-				fi;
130
-			fi;
131
-		fi;
132
-		DIR=${BASEDIR}${RND}
133
-	done
134
-	mkdir ${DIR}
135
-	eval "$1=${DIR}"
136
-}
137
-
138
-uncompress() {
139
-#	DEBUGINFO="\n\nRunname: ${0}"
140
-#	DEBUGINFO="${DEBUGINFO}\nOldPwd: ${OLDPWD}"
141
-
142
-	# Try runname, in old dir.
143
-	FILE=${OLDPWD}/$0
144
-	if [ ! -e ${FILE} ]; then
145
-		# Else, try run filename in old dir
146
-		FILE=${OLDPWD}/`basename $0`
147
-		if [ ! -e ${FILE} ]; then
148
-			# Else try run name
149
-			FILE=$0
150
-			if [ ! -e ${FILE} ]; then
151
-				# Unable to find this file!
152
-				errordialog "DMDirc Setup" "Unable to find installer.\nThis shouldn't happen, please raise a bug report at http://bugs.dmdirc.com${DEBUGINFO}";
153
-				echo "Removing temp dir"
154
-				cd ${OLDPWD}
155
-				rm -Rf ${TEMPDIR}
156
-				exit 1;
157
-			fi;
158
-		fi;
159
-	fi;
160
-	echo "Decompressing: ${FILE}"
161
-#	DEBUGINFO="${DEBUGINFO}\nFile: ${FILE}"
162
-#	DEBUGINFO="${DEBUGINFO}\nCommand: tail ${TAILOPTS}${ENDLINE} "${FILE}" | gzip -cd | tar -xvf - 2>&1"
163
-	OUTPUT=`tail ${TAILOPTS}${ENDLINE} "${FILE}" | gzip -cd | tar -xvf - 2>&1`
164
-	if [ "${OUTPUT}" = "" ]; then
165
-		echo "Decompression failed."
166
-		errordialog "DMDirc Setup" "Decompression failed.\nThis shouldn't happen, please raise a bug report at http://bugs.dmdirc.com${DEBUGINFO}";
167
-		echo "Removing temp dir"
168
-		cd ${OLDPWD}
169
-		rm -Rf ${TEMPDIR}
170
-		exit 1;
171
-	fi;
172
-	echo "Decompression successful."
173
-}
174
-
175
-showHelp() {
176
-	echo "This will install DMDirc on a unix based system."
177
-	echo "The following command line arguments are known:"
178
-	echo "---------------------"
179
-	echo "-h, --help        Help information"
180
-	echo "-e, --extract     Extract .run file only, do not run setup.sh"
181
-#	echo "-s, --script      Don't use installer.jar (not implemented yet)"
182
-	echo "---------------------"
183
-	exit 0;
184
-}
185
-
186
-# Defaults
187
-extractOnly="false"
188
-setupParams=""
189
-skipMD5="false"
190
-
191
-# Begin
192
-echo "---------------------"
193
-echo "DMDirc Unix Setup"
194
-if [ "${isRelease}" != "" ]; then
195
-	echo "Version: "${isRelease};
196
-	setupParams="${setupParams} --release "${isRelease}
197
-fi;
198
-echo "---------------------"
199
-# Check for cmdline args
200
-while test -n "$1"; do
201
-	case "$1" in
202
-		--help|-h)
203
-			showHelp
204
-			;;
205
-		--extract|-e)
206
-			extractOnly="true"
207
-			;;
208
-		--script|-s)
209
-			setupParams="${setupParams} --script"
210
-			;;
211
-		--nomd5)
212
-			skipMD5="true"
213
-			;;
214
-	esac
215
-	shift
216
-done
217
-
218
-MD5BIN=`which md5sum`
219
-if [ "${MD5BIN}" = "" ]; then
220
-	MD5BIN=`which md5`
221
-fi;
222
-AWK=`which awk`
223
-getMD5() {
224
-	if [ "${MD5BIN}" != "" ]; then
225
-		echo "test" | ${MD5BIN} -
226
-		if [ $? -eq 0 ]; then
227
-			echo "Linux-Style MD5SUM: ${MD5BIN}"
228
-			getMD5Linux $@
229
-		else
230
-			echo "BSD-Style MD5SUM: ${MD5BIN}"
231
-			getMD5BSD $@
232
-		fi;
233
-	fi;
234
-}
235
-
236
-getMD5Linux() {
237
-	# Everything below the MD5SUM Line
238
-	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
239
-	MD5LINE=$((${MD5LINE%%:*} + 1))
240
-
241
-	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
242
-	return;
243
-}
244
-
245
-getMD5BSD() {
246
-	# Everything below the MD5SUM Line
247
-	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
248
-	MD5LINE=$((${MD5LINE%%:*} + 1))
249
-
250
-	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
251
-	return;
252
-}
253
-
254
-if [ "${MD5BIN}" != "" ]; then
255
-	if [ ${skipMD5} != "true" ]; then
256
-		#if [ -e "${0}.md5"  ]; then
257
-		#	echo "Checking MD5 using ${0}.md5.."
258
-		#	${MD5BIN} --check --status ${0}.md5
259
-		#	if [ $? = 0 ]; then
260
-		#		echo "MD5 Check Passed!"
261
-		#	else
262
-		#		ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
263
-		#		ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
264
-		#		errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
265
-		#		exit 1;
266
-		#	fi
267
-		#elif [ "${MD5}" != ""  ]; then
268
-		if [ "${MD5}" != ""  ]; then
269
-			echo "Checking MD5 using built in hash.."
270
-			if [ "${AWK}" != "" ]; then
271
-				MD5SUM=""
272
-				getMD5 ${0} ${MD5SUM}
273
-
274
-				echo "SUM obtained is: ${MD5SUM}"
275
-				echo "SUM expected is: ${MD5}"
276
-				if [ "${MD5SUM}" = "${MD5}" ]; then
277
-					echo "MD5 Check Passed!"
278
-				elif [ "${MD5SUM}" = "" -o "${MD5}" = "" ]; then
279
-					ERROR="The DMDirc installer is unable to verify the checksum of this download.";
280
-					if [ "${MD5SUM}" = "" ]; then
281
-						ERROR=${ERROR}"(Unable to calculate sum locally)";
282
-					else
283
-						ERROR=${ERROR}"(No checksum found in file)";
284
-					fi;
285
-					
286
-					ERROR=${ERROR}"\nDo you want to continue anyway?";
287
-					
288
-					questiondialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
289
-					exit 1;
290
-				else
291
-					ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
292
-					ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
293
-					errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
294
-					exit 1;
295
-				fi;
296
-			else
297
-				echo "MD5 Check skipped (awk not found).."
298
-			fi;
299
-		else
300
-			#if [ "${MD5BIN}" = "" ]; then
301
-			#	echo "MD5 Check skipped (md5sum not found).."
302
-			#else
303
-				echo "MD5 Check skipped (No MD5 hash found to compare against).."
304
-			#fi
305
-		fi;
306
-	else
307
-		echo "MD5 Check skipped (Requested).."
308
-	fi
309
-fi;
310
-
311
-OLDPWD=${PWD}
312
-echo "Getting Temp Dir"
313
-random TEMPDIR
314
-echo "Got Temp Dir: ${TEMPDIR}"
315
-cd ${TEMPDIR}
316
-echo "Uncompressing to temp dir.."
317
-uncompress
318
-echo "Done."
319
-# Check if extract only was wanted.
320
-if [ "${extractOnly}" = "true" ]; then
321
-	echo "Extracted. (Files can be found in: ${TEMPDIR})"
322
-	exit 0;
323
-fi
324
-
325
-if [ -e "${TEMPDIR}/setup.sh" ]; then
326
-	echo "Running setup.."
327
-	chmod a+x ${TEMPDIR}/setup.sh
328
-	${TEMPDIR}/setup.sh ${setupParams}
329
-	echo ""
330
-	if [ $? -eq 0 ]; then
331
-		echo "Setup completed."
332
-	else
333
-		echo "Setup did not complete."
334
-	fi
335
-else
336
-	echo "No setup.sh found. This was pointless?"
337
-fi
338
-echo "Removing temp dir"
339
-cd ${OLDPWD}
340
-rm -Rf ${TEMPDIR}
341
-echo "Installation Completed."
342
-# Job Done!
343
-exit 0;
344
-###END STUB###

+ 0
- 251
installer/linux/installjre.sh Ver fichero

@@ -1,251 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# Install the JRE.
4
-#
5
-
6
-# Find out what params we should pass to things.
7
-# Solaris has a nice and ancient version of grep in /usr/bin
8
-grep -na "" /dev/null >/dev/null 2>&1
9
-if [ $? -eq 2 ]; then
10
-	GREPOPTS="-n"
11
-else
12
-	GREPOPTS="-na"
13
-fi;
14
-# Solaris also has a crappy version of tail!
15
-tail -n +1 /dev/null >/dev/null 2>&1
16
-if [ $? -eq 2 ]; then
17
-	TAILOPTS="+"
18
-else
19
-	TAILOPTS="-n +"
20
-fi;
21
-# Check the which command exists, and if so make sure it behaves how we want
22
-# it to...
23
-WHICH=`which which 2>/dev/null`
24
-if [ "" = "${WHICH}" ]; then
25
-	echo "which command not found. Aborting.";
26
-	exit 0;
27
-else
28
-	# Solaris sucks
29
-	BADWHICH=`which /`
30
-	if [ "${BADWHICH}" != "" ]; then
31
-		echo "Replacing bad which command.";
32
-		# "Which" on solaris gives non-empty results for commands that don't exist
33
-		which() {
34
-			OUT=`${WHICH} ${1}`
35
-			if [ $? -eq 0 ]; then
36
-				echo ${OUT}
37
-			else
38
-				echo ""
39
-			fi;
40
-		}
41
-	fi;
42
-fi
43
-
44
-# Find out where we are
45
-BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
46
-
47
-PIDOF=`which pidof`
48
-if [ "${PIDOF}" = "" ]; then
49
-	# For some reason some distros hide pidof...
50
-	if [ -e /sbin/pidof ]; then
51
-		PIDOF=/sbin/pidof
52
-	elif [ -e /usr/sbin/pidof ]; then
53
-		PIDOF=/usr/sbin/pidof
54
-	fi;
55
-fi;
56
-
57
-ISFREEBSD=`uname -s | grep -i FreeBSD`
58
-
59
-if [ -e "${BASEDIR}/functions.sh" ]; then
60
-	. ${BASEDIR}/functions.sh
61
-else
62
-	echo "Unable to find functions.sh, unable to continue."
63
-	exit 1;
64
-fi;
65
-
66
-showLicence() {
67
-	# Get Licence Text
68
-	FILE=`mktemp licence.XXXXXXXXXXXXXX`
69
-	if [ "${ISFREEBSD}" != "" ]; then
70
-		WGET=`which wget`
71
-		FETCH=`which fetch`
72
-		CURL=`which curl`
73
-		
74
-		ARCH=`uname -m`
75
-		RELEASE=`uname -r`
76
-		URL="http://www.dmdirc.com/getjavalicense/`uname -s`/${ARCH}/${RELEASE}"
77
-		
78
-		if [ "${WGET}" != "" ]; then
79
-			${WGET} -q -O ${FILE} ${URL}
80
-		elif [ "${FETCH}" != "" ]; then
81
-			${FETCH} -q -o ${FILE} ${URL}
82
-		elif [ "${CURL}" != "" ]; then
83
-			${CURL} -s -o ${FILE} ${URL}
84
-		fi;
85
-	else
86
-		# Location of licence start
87
-		STARTLINE=`grep ${GREPOPTS} "^more <<\"EOF\"$" jre.bin`
88
-		STARTLINE=$((${STARTLINE%%:*} + 1))
89
-		# Location of licence end
90
-		ENDLINE=`grep ${GREPOPTS} "Do you agree to the above license terms?" jre.bin`
91
-		ENDLINE=$((${ENDLINE%%:*} - 4))
92
-
93
-		if [ ${ENDLINE} -lt 4 ]; then
94
-			errordialog "Installer Error" "DMDirc has been unable to figure out what to do with this jre download and can not continue. Please raise an issue about this at http://bugs.dmdirc.com"
95
-			exit 1;
96
-		fi;
97
-
98
-		head -n ${ENDLINE} jre.bin | tail ${TAILOPTS}${STARTLINE} > ${FILE}
99
-	fi;
100
-
101
-	# Send text to console.
102
-	echo ""
103
-	echo "-----------------------------------------------------------------------"
104
-	echo "Java Licence"
105
-	echo "-----------------------------------------------------------------------"
106
-	cat ${FILE}
107
-	echo "-----------------------------------------------------------------------"
108
-
109
-	# Now try to use the GUI Dialogs.
110
-	if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
111
-		echo "Dialog on Display: ${DISPLAY}"
112
-		${KDIALOG} --title "DMDirc: Java Licence" --textbox ${FILE} 600 400
113
-	elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
114
-		echo "Dialog on Display: ${DISPLAY}"
115
-		${ZENITY} --text-info --title "DMDirc: Java Licence" --filename=${FILE} --width=600 --height=400
116
-	fi
117
-	
118
-	# Remove temp file
119
-	rm -Rf ${FILE}
120
-}
121
-
122
-
123
-if [ "" != "${1}" ]; then
124
-	questiondialog "Java Install" "${1}"
125
-	result=$?
126
-	if [ $result -ne 0 ]; then
127
-		exit 1;
128
-	fi;
129
-fi;
130
-
131
-messagedialog "Java Install" "Before java can be installed, please review the following licence."
132
-showLicence
133
-questiondialog "Java Install" "Do you agree to the Java Licence?"
134
-if [ $? -eq 0 ]; then
135
-	if [ "${ISFREEBSD}" != "" ]; then
136
-		JREJAVAHOME="diablo-jre1.6.0_07"
137
-	else
138
-		# Look to see where the JRE wants to install to
139
-		JREJAVAHOME=`grep ${GREPOPTS} "^javahome=" jre.bin`
140
-		JREJAVAHOME=${JREJAVAHOME##*=}
141
-	fi;
142
-	
143
-	echo "JREJAVAHOME: ${JREJAVAHOME}"
144
-	
145
-	if [ "${UID}" = "" ]; then
146
-		UID=`id -u`;
147
-	fi
148
-	if [ "0" = "${UID}" ]; then
149
-		mkdir -p /usr/lib/jvm/
150
-		installdir=/usr/lib/jvm/${JREJAVAHOME}
151
-	else
152
-		installdir=${HOME}/${JREJAVAHOME}
153
-	fi;
154
-	
155
-	echo "installdir: ${installdir}"
156
-	
157
-	if [ ! -e ${installdir} ]; then
158
-		messagedialog "Java Install" "Java install will begin when you press OK.\nThis may take some time, so please wait.\n\nYou will be informed when the installation is completed."
159
-		if [ "${ISFREEBSD}" != "" ]; then
160
-			mv jre.bin jre.tar.bz2
161
-			tar -jxvf jre.tar.bz2
162
-			mv jre.tar.bz2 jre.bin
163
-		else
164
-			# Hack jre.bin to allow us to install without asking for a licence, or failing
165
-			# the checksum.
166
-			
167
-			# Location of licence start
168
-			STARTLINE=`grep ${GREPOPTS} "^more <<\"EOF\"$" jre.bin`
169
-			STARTLINE=${STARTLINE%%:*}
170
-			# Location of licence end
171
-			ENDLINE=`grep ${GREPOPTS} "Do you agree to the above license terms?" jre.bin`
172
-			ENDLINE=$((${ENDLINE%%:*} - 2))
173
-			if [ ${ENDLINE} -lt 2 ]; then
174
-				errordialog "Installer Error" "DMDirc has been unable to figure out what to do with this jre download and can not continue. Please raise an issue about this at http://bugs.dmdirc.com"
175
-				exit 1;
176
-			fi;
177
-			# Location of checksum start
178
-			CSSTARTLINE=`grep ${GREPOPTS} "^if \[ -x /usr/bin/sum \]; then$" jre.bin`
179
-			CSSTARTLINE=${CSSTARTLINE%%:*}
180
-			# Location of checksum end
181
-			CSENDLINE=`grep ${GREPOPTS} "Can't find /usr/bin/sum to do checksum" jre.bin`
182
-			CSENDLINE=$((${CSENDLINE%%:*} + 2))
183
-			# Location of script end
184
-			SCENDLINE=`grep ${GREPOPTS} "^echo \"Done.\"$" jre.bin`
185
-			SCENDLINE=$((${SCENDLINE%%:*} + 2 - (${ENDLINE} - ${STARTLINE}) - (${CSENDLINE} - ${CSSTARTLINE})))
186
-			# Remove the licence and checksum stuff!
187
-			head -n $((${STARTLINE} -1)) jre.bin > jre.bin.tmp
188
-			tail ${TAILOPTS}$((${ENDLINE})) jre.bin | head -n $((${CSSTARTLINE} -1 - ${ENDLINE})) >> jre.bin.tmp
189
-			echo "tail \${tail_args} +${SCENDLINE} \"\$0\" > \$outname" >> jre.bin.tmp
190
-			tail ${TAILOPTS}$((${CSENDLINE})) jre.bin >> jre.bin.tmp
191
-
192
-			PIPE=`mktemp installprogresspipe.XXXXXXXXXXXXXX`
193
-			/bin/sh ${PWD}/progressbar.sh --pulsate "Installing JRE. Please wait.." 100 ${PIPE} &
194
-			sleep 1;
195
-			echo "-1" > ${PIPE}
196
-			# This is supposed to write to the pipe as it does stuff, but it appears
197
-			# not to work properly.
198
-			yes | sh jre.bin.tmp | egrep --line-buffered -i "(extracting|inflating):" > ${PIPE};
199
-			echo "quit" > ${PIPE}
200
-			# rm -Rf jre.bin.tmp
201
-		fi;
202
-		
203
-		mv ${JREJAVAHOME} ${installdir}
204
-
205
-		if [ "0" = "${UID}" ]; then
206
-			# Add to global path.
207
-			if [ -e "/usr/bin/java" ]; then
208
-				rm -Rf /usr/bin/java
209
-			fi;
210
-			ln -s /usr/lib/jvm/${JREJAVAHOME}/bin/java /usr/bin/java
211
-			
212
-			# This allows the main installer to continue with the new java version,
213
-			# incase the shell doesn't find the new binary.
214
-			echo "Adding java-bin: ${installdir}/bin/java -> ${PWD}/java-bin"
215
-			ln -s ${installdir}/bin/java ${PWD}/java-bin
216
-		else
217
-			# Add to path.
218
-			echo "" >> ${HOME}/.profile
219
-			echo "# set PATH so it includes user's private java if it exists" >> ${HOME}/.profile
220
-			echo "if [ -d ~/${JREJAVAHOME}/bin ] ; then" >> ${HOME}/.profile
221
-			echo "	PATH=~/${JREJAVAHOME}/bin:\${PATH}" >> ${HOME}/.profile
222
-			echo "fi" >> ${HOME}/.profile
223
-			
224
-			if [ -e ${HOME}/.cshrc ]; then
225
-				echo "" >> ${HOME}/.cshrc
226
-				echo "# set PATH so it includes user's private java if it exists" >> ${HOME}/.cshrc
227
-				echo "if( -d ~/${JREJAVAHOME}/bin ) then" >> ${HOME}/.cshrc
228
-				echo "	set path = (~/${JREJAVAHOME}/bin \$path)" >> ${HOME}/.cshrc
229
-				echo "endfi" >> ${HOME}/.cshrc
230
-			fi
231
-			
232
-			# This allows the main installer to continue with the new java version.
233
-			echo "Adding java-bin: ${installdir}/bin/java -> ${PWD}/java-bin"
234
-			ln -s ${installdir}/bin/java ${PWD}/java-bin
235
-			
236
-			# This allows dmdirc launcher to find the jre if the path is not set.
237
-			ln -sf ${installdir} ${HOME}/jre
238
-		fi;
239
-		
240
-		messagedialog "Java Install" "Java installation complete"
241
-		exit 0;
242
-	else
243
-		messagedialog "Java Install" "An existing install was found at ${installdir}, but this directory is not in the current path, DMDirc setup will try to use this version of java for the install."
244
-		echo "Adding java-bin: ${installdir}/bin/java -> ${PWD}/java-bin"
245
-		ln -s ${installdir}/bin/java ${PWD}/java-bin
246
-		exit 0;
247
-	fi;
248
-else
249
-	errordialog "Java Install" "You must agree to the licence before java can be installed"
250
-fi;
251
-exit 1;

+ 0
- 437
installer/linux/makeInstallerLinux.sh Ver fichero

@@ -1,437 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script generates a .run file that will install DMDirc
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
7
-#
8
-# Permission is hereby granted, free of charge, to any person obtaining a copy
9
-# of this software and associated documentation files (the "Software"), to deal
10
-# in the Software without restriction, including without limitation the rights
11
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
-# copies of the Software, and to permit persons to whom the Software is
13
-# furnished to do so, subject to the following conditions:
14
-#
15
-# The above copyright notice and this permission notice shall be included in
16
-# all copies or substantial portions of the Software.
17
-#
18
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
-# SOFTWARE.
25
-
26
-# Final Name of the installer (without file extention)
27
-INSTALLERNAME=DMDirc-Setup
28
-# full name of the file to output to
29
-RUNNAME="${PWD}/${INSTALLERNAME}.run"
30
-
31
-# Find out what params we should pass to things.
32
-# Solaris has a nice and ancient version of grep in /usr/bin
33
-grep -na "" /dev/null >/dev/null 2>&1
34
-if [ $? -eq 2 ]; then
35
-	GREPOPTS="-n"
36
-else
37
-	GREPOPTS="-na"
38
-fi;
39
-# Solaris also has a crappy version of tail!
40
-tail -n +1 /dev/null >/dev/null 2>&1
41
-if [ $? -eq 2 ]; then
42
-	TAILOPTS="+"
43
-else
44
-	TAILOPTS="-n +"
45
-fi;
46
-# Check the which command exists, and if so make sure it behaves how we want
47
-# it to...
48
-WHICH=`which which 2>/dev/null`
49
-if [ "" = "${WHICH}" ]; then
50
-	echo "which command not found. Aborting.";
51
-	exit 0;
52
-else
53
-	# Solaris sucks
54
-	BADWHICH=`which /`
55
-	if [ "${BADWHICH}" != "" ]; then
56
-		echo "Replacing bad which command.";
57
-		# "Which" on solaris gives non-empty results for commands that don't exist
58
-		which() {
59
-			OUT=`${WHICH} ${1}`
60
-			if [ $? -eq 0 ]; then
61
-				echo ${OUT}
62
-			else
63
-				echo ""
64
-			fi;
65
-		}
66
-	fi;
67
-fi
68
-
69
-# Compress stuff!
70
-compress() {
71
-	tar cvfh - $@ | gzip - 2>/dev/null >>${RUNNAME} || {
72
-		echo "Compression failed."
73
-		kill -15 $$;
74
-	};
75
-}
76
-
77
-WGET=`which wget`
78
-FETCH=`which fetch`
79
-CURL=`which curl`
80
-getFile() {
81
-	URL=${1}
82
-	OUTPUT=${2}
83
-
84
-	if [ "${WGET}" != "" ]; then
85
-		${WGET} -O ${OUTPUT} ${URL}
86
-	elif [ "${FETCH}" != "" ]; then
87
-		${FETCH} -o ${OUTPUT} ${URL}
88
-	elif [ "${CURL}" != "" ]; then
89
-		${CURL} -o ${OUTPUT} ${URL}
90
-	fi;
91
-}
92
-
93
-# Go!
94
-echo "-----------"
95
-if [ -e "${RUNNAME}" ]; then
96
-	echo "Removing existing .run file"
97
-	rm -Rf ./*.run
98
-fi
99
-
100
-showHelp() {
101
-	echo "This will generate a DMDirc installer for a unix based system."
102
-	echo "The following command line arguments are known:"
103
-	echo "---------------------"
104
-	echo "-h, --help                Help information"
105
-	echo "-b, --branch              Release in -r is a branch "
106
-	echo "-p, --plugins <plugins>   What plugins to add to the jar file"
107
-	echo "-c, --compile             Recompile the .jar file"
108
-	echo "    --jre                 Include the JRE in this installer"
109
-	echo "    --jre64               Include the 64-Bit JRE in this installer"
110
-	echo "    --jar <file>          use <file> as DMDirc.jar"
111
-	echo "    --current             Use the current folder as the base for the build"
112
-	echo "-e, --extra <tag>         Tag to add to final exe name to distinguish this build from a standard build"
113
-	echo "---------------------"
114
-	exit 0;
115
-}
116
-
117
-# Check for some CLI params
118
-compileJar="false"
119
-isRelease=""
120
-finalTag=""
121
-BRANCH="0"
122
-plugins=""
123
-location="../../"
124
-current="1"
125
-jarfile=""
126
-jre=""
127
-jrename="jre" # Filename for JRE without the .bin
128
-TAGGED=""
129
-while test -n "$1"; do
130
-	case "$1" in
131
-		--plugins|-p)
132
-			shift
133
-			plugins=${1}
134
-			;;
135
-		--jar)
136
-			shift
137
-			jarfile=${1}
138
-			;;
139
-		--jre)
140
-			jre="http://www.dmdirc.com/getjava/linux/i686"
141
-			;;
142
-		--jre64)
143
-			jre="http://www.dmdirc.com/getjava/linux/x86_64"
144
-			jrename="jre64"
145
-			;;
146
-		--current)
147
-			location="../../"
148
-			current="1"
149
-			;;
150
-		--compile|-c)
151
-			compileJar="true"
152
-			;;
153
-		--release|-r)
154
-			shift
155
-			isRelease=${1}
156
-			;;
157
-		--extra|-e)
158
-			shift
159
-			finalTag=${1}
160
-			RUNNAME="${PWD}/${INSTALLERNAME}-${1}.run"
161
-			;;
162
-		--help|-h)
163
-			showHelp;
164
-			;;
165
-		--branch|-b)
166
-			BRANCH="1"
167
-			;;
168
-		--tag|-t)
169
-			TAGGED=`git describe --tags`
170
-			TAGGED=${TAGGED%%-*}
171
-			;;
172
-	esac
173
-	shift
174
-done
175
-if [ "" = "${current}" ]; then
176
-	jarPath="${location}trunk"
177
-else
178
-	jarPath="${location}"
179
-fi
180
-
181
-if [ "" = "${jarfile}" ]; then
182
-	jarfile=${jarPath}"/dist/DMDirc.jar"
183
-	if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
184
-		echo "Creating jar.."
185
-		OLDPWD=${PWD}
186
-		cd ${jarPath}
187
-
188
-		rm -Rf build dist
189
-		ant jar
190
-		if [ ! -e "dist/DMDirc.jar" ]; then
191
-			echo "There was an error creating the .jar file. Aborting."
192
-			exit 1;
193
-		fi;
194
-		cd ${OLDPWD}
195
-	fi;
196
-elif [ ! -e "${jarfile}" ]; then
197
-	echo "Requested Jar file (${jarfile}) does not exist."
198
-	exit 1;
199
-fi;
200
-
201
-if [ "" = "${plugins}" ]; then
202
-	echo "Linking jar (${jarfile}).."
203
-	ln -sf ${jarfile} "./DMDirc.jar"
204
-else
205
-	echo "Copying jar (${jarfile}).."
206
-	cp ${jarfile} "./DMDirc.jar"
207
-
208
-	echo "Adding plugins to jar"
209
-	ln -sf ${jarPath}"/plugins"
210
-	pluginList=""
211
-	for plugin in ${plugins}; do
212
-		pluginList=${pluginList}" plugins/${plugin}"
213
-	done
214
-	jar -uvf "DMDirc.jar" ${pluginList}
215
-
216
-        ../../updateBundledPlugins.sh "DMDirc.jar";
217
-	rm -Rf plugins;
218
-fi
219
-
220
-echo "Creating .run file"
221
-echo "Adding stub.."
222
-
223
-grep -na "" /dev/null >/dev/null 2>&1
224
-if [ $? -eq 2 ]; then
225
-	GREPOPTS="-n"
226
-else
227
-	GREPOPTS="-na"
228
-fi;
229
-# Solaris also has a crappy version of tail!
230
-tail -n +1 /dev/null >/dev/null 2>&1
231
-if [ $? -eq 2 ]; then
232
-	TAILOPTS="+"
233
-else
234
-	TAILOPTS="-n +"
235
-fi;
236
-
237
-FUNCTIONSLINE=`grep ${GREPOPTS} "^\s*###FUNCTIONS_FILE###\s*$" installerstub.sh`
238
-FUNCTIONSLINE=$((${FUNCTIONSLINE%%:*} + 0))
239
-
240
-head -n ${FUNCTIONSLINE} installerstub.sh  > ${RUNNAME}
241
-cat functions.sh >> ${RUNNAME}
242
-echo "" >> ${RUNNAME}
243
-tail ${TAILOPTS}$((${FUNCTIONSLINE%%:*} + 1)) installerstub.sh >> ${RUNNAME}
244
-
245
-# Add release info.
246
-awk '{gsub(/###ADDITIONAL_STUFF###/,"isRelease=\"'${TAGGED}'\"");print}' ${RUNNAME} > ${RUNNAME}.tmp
247
-mv ${RUNNAME}.tmp ${RUNNAME}
248
-
249
-FILES="DMDirc.jar";
250
-echo "Compressing files.."
251
-for FILE in "getjre.sh" "installjre.sh" "progressbar.sh" "functions.sh"; do
252
-	if [ -e "${FILE}" ]; then
253
-		FILES="${FILES} ${FILE}"
254
-	fi
255
-done;
256
-
257
-if [ "" != "${jre}" ]; then
258
-	if [ ! -e "../common/${jrename}.bin" ]; then
259
-		echo "Downloading JRE to include in installer"
260
-		getFile "${jre}" "../common/${jrename}.bin"
261
-	fi
262
-	ln -sf ../common/${jrename}.bin jre.bin
263
-	FILES="${FILES} jre.bin"
264
-fi;
265
-
266
-if [ -e "setup.sh" ]; then
267
-	FILES="${FILES} setup.sh"
268
-else
269
-	echo "[WARNING] Creating setup-less archive. This will just extract and immediately delete the .jar file unless the -e flag is used"
270
-fi
271
-
272
-#if [ -e "../common/installer.jar" ]; then
273
-#	ln -sf ../common/installer.jar ./installer.jar
274
-#	FILES="${FILES} installer.jar"
275
-#else
276
-#	echo "[WARNING] Creating installer-less archive - relying on setup.sh"
277
-#fi
278
-
279
-if [ -e ${jarPath}"/src/com/dmdirc/res/source/logo.svg" ]; then
280
-	ln -sf ${jarPath}"/src/com/dmdirc/res/source/logo.svg" ./icon.svg
281
-	FILES="${FILES} icon.svg"
282
-fi
283
-
284
-if [ "${isRelease}" != "" ]; then
285
-	DOCSDIR=${jarPath}
286
-else
287
-	DOCSDIR="../common"
288
-fi
289
-
290
-if [ -e "${DOCSDIR}/README.TXT" ]; then
291
-	ln -sf "${DOCSDIR}/README.TXT" .
292
-	FILES="${FILES} README.TXT"
293
-fi
294
-
295
-if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
296
-	ln -sf "${DOCSDIR}/CHANGES.TXT" .
297
-	FILES="${FILES} CHANGES.TXT"
298
-elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
299
-	ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
300
-	FILES="${FILES} CHANGELOG.TXT"
301
-fi
302
-
303
-if [ -e "${jarPath}/launcher/unix" ]; then
304
-	# Hax in functions.sh
305
-	FUNCTIONSFILE="functions.sh"
306
-	SRCFILE=${jarPath}/launcher/unix/DMDirc.sh
307
-	DESTFILE=./DMDirc.sh
308
-
309
-	if [ -e "${FUNCTIONSFILE}" ]; then
310
-		FUNCTIONSLINE=`grep ${GREPOPTS} "^###FUNCTIONS_FILE###$" ${SRCFILE}`
311
-		if [ "${FUNCTIONSLINE}" == "" ]; then
312
-			echo "    Functions already built into launcher."
313
-			cp ${SRCFILE} ${DESTFILE}
314
-		else
315
-			echo "    Including functions.sh into launcher."
316
-			FUNCTIONSLINE=$((${FUNCTIONSLINE%%:*} + 0))
317
-
318
-			head -n ${FUNCTIONSLINE} ${SRCFILE} > ${DESTFILE}
319
-			cat ${FUNCTIONSFILE} >> ${DESTFILE}
320
-			echo "" >> ${DESTFILE}
321
-			tail ${TAILOPTS}$((${FUNCTIONSLINE%%:*} + 1)) ${SRCFILE} >> ${DESTFILE}
322
-		fi;
323
-	else
324
-		echo "    Unable to create unix launcher update, no functions.sh found."
325
-	fi;
326
-	
327
-	FILES="${FILES} DMDirc.sh"
328
-fi
329
-
330
-if [ -e "uninstall.sh" ]; then
331
-	FILES="${FILES} uninstall.sh"
332
-fi
333
-
334
-compress $FILES
335
-
336
-MD5BIN=`which md5sum`
337
-if [ "${MD5BIN}" = "" ]; then
338
-	MD5BIN=`which md5`
339
-fi;
340
-AWK=`which awk`
341
-getMD5() {
342
-	if [ "${MD5BIN}" != "" ]; then
343
-		echo "test" | ${MD5BIN} -
344
-		if [ $? -eq 0 ]; then
345
-			echo "Linux-Style MD5SUM: ${MD5BIN}"
346
-			getMD5Linux $@
347
-		else
348
-			echo "BSD-Style MD5SUM: ${MD5BIN}"
349
-			getMD5BSD $@
350
-		fi;
351
-	fi;
352
-}
353
-
354
-getMD5Linux() {
355
-	# Everything below the MD5SUM Line
356
-	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
357
-	MD5LINE=$((${MD5LINE%%:*} + 1))
358
-
359
-	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
360
-	return;
361
-}
362
-
363
-getMD5BSD() {
364
-	# Everything below the MD5SUM Line
365
-	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
366
-	MD5LINE=$((${MD5LINE%%:*} + 1))
367
-
368
-	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
369
-	return;
370
-}
371
-
372
-if [ "${MD5BIN}" != "" -a "${AWK}" != "" ]; then
373
-	echo "Adding MD5.."
374
-
375
-	MD5SUM=""
376
-	getMD5 ${RUNNAME} ${MD5SUM}
377
-
378
-	echo "SUM obtained is: ${MD5SUM}"
379
-
380
-	LINENUM=`grep ${GREPOPTS} "^MD5=\"\"$" ${RUNNAME}`
381
-	LINENUM=${LINENUM%%:*}
382
-
383
-	head -n $((${LINENUM} -1)) ${RUNNAME} > ${RUNNAME}.tmp
384
-	echo 'MD5="'${MD5SUM}'"' >> ${RUNNAME}.tmp
385
-	tail ${TAILOPTS}$((${LINENUM} +1)) ${RUNNAME} >> ${RUNNAME}.tmp
386
-	mv ${RUNNAME}.tmp ${RUNNAME}
387
-else
388
-	echo "Not Adding MD5.."
389
-fi;
390
-
391
-echo "Chmodding"
392
-chmod a+x ${RUNNAME}
393
-
394
-doRename=0
395
-if [ "${TAGGED}" != "" ]; then
396
-	doRename=1	
397
-fi;
398
-
399
-if [ ${doRename} -eq 1 ]; then
400
-	if [ "${TAGGED}" = "" ]; then
401
-		isRelease=branch-${isRelease}
402
-	else
403
-		isRelease=${TAGGED}
404
-	fi;
405
-	if [ "" != "${finalTag}" ]; then
406
-		finalTag="-${finalTag}"
407
-	fi;
408
-	finalname=DMDirc-${isRelease}-Setup${finalTag}.run
409
-else
410
-	finalname=${RUNNAME##*/}
411
-fi;
412
-
413
-if [ "" != "${jre}" ]; then
414
-	finalname=`echo ${finalname} | sed "s/.run$/.${jrename}.run/"`
415
-fi;
416
-
417
-mv ${RUNNAME} ../output/${finalname}
418
-mv setup.sh setup.sh.tmp
419
-mv getjre.sh getjre.sh.tmp
420
-mv installjre.sh installjre.sh.tmp
421
-mv progressbar.sh progressbar.sh.tmp
422
-mv uninstall.sh uninstall.sh.tmp
423
-mv functions.sh functions.sh.tmp
424
-rm -f ${FILES}
425
-mv setup.sh.tmp setup.sh
426
-mv getjre.sh.tmp getjre.sh
427
-mv installjre.sh.tmp installjre.sh
428
-mv progressbar.sh.tmp progressbar.sh
429
-mv uninstall.sh.tmp uninstall.sh
430
-mv functions.sh.tmp functions.sh
431
-
432
-echo "-----------"
433
-echo "Done."
434
-echo "-----------"
435
-
436
-# and Done \o
437
-exit 0;

+ 0
- 325
installer/linux/progressbar.sh Ver fichero

@@ -1,325 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# Show a progress bar.
4
-#
5
-# If kdialog/zenity are available they are used.
6
-# Progress data is read from the created pipe, echoing "quit" to the pipe will 
7
-# cause the script to terminate, as will the progress reaching 100%
8
-#
9
-# Pressing cancel on a zenity dialog will terminate right away, kdialog will
10
-# only terminate when the next line of data is read from the pipe.
11
-#
12
-
13
-# Check the which command exists, and if so make sure it behaves how we want
14
-# it to...
15
-WHICH=`which which 2>/dev/null`
16
-if [ "" = "${WHICH}" ]; then
17
-	echo "which command not found. Aborting.";
18
-	exit 0;
19
-else
20
-	# Solaris sucks
21
-	BADWHICH=`which /`
22
-	if [ "${BADWHICH}" != "" ]; then
23
-		echo "Replacing bad which command.";
24
-		# "Which" on solaris gives non-empty results for commands that don't exist
25
-		which() {
26
-			OUT=`${WHICH} ${1}`
27
-			if [ $? -eq 0 ]; then
28
-				echo ${OUT}
29
-			else
30
-				echo ""
31
-			fi;
32
-		}
33
-	fi;
34
-fi
35
-# Solaris also has a crappy version of tail!
36
-tail -n +1 /dev/null >/dev/null 2>&1
37
-if [ $? -eq 2 ]; then
38
-	TAILOPTS="-"
39
-else
40
-	TAILOPTS="-n"
41
-fi;
42
-
43
-PIDOF=`which pidof`
44
-if [ "${PIDOF}" = "" ]; then
45
-	# For some reason some distros hide pidof...
46
-	if [ -e /sbin/pidof ]; then
47
-		PIDOF=/sbin/pidof
48
-	elif [ -e /usr/sbin/pidof ]; then
49
-		PIDOF=/usr/sbin/pidof
50
-	fi;
51
-fi;
52
-
53
-## Helper Functions
54
-if [ -n "${PIDOF}" ]; then
55
-	ISKDE=`${PIDOF} -x -s kdeinit kdeinit4`
56
-	ISGNOME=`${PIDOF} -x -s gnome-panel`
57
-else
58
-	ISKDE=`pgrep kdeinit`
59
-	ISGNOME=`pgrep gnome-panel`
60
-fi;
61
-
62
-KDIALOG=`which kdialog`
63
-ZENITY=`which zenity`
64
-USEKDIALOG="0";
65
-QDBUS=`which qdbus`
66
-DBUSSEND=`which dbus-send`
67
-DCOP=`which dcop`
68
-BC=`which bc`
69
-KDETYPE=""
70
-if [ "${ISKDE}" != "" -o "${ZENITY}" = "" ]; then
71
-	# Check to see if we have the dcop or dbus binaries needed..
72
-	USEDCOP=`kdialog --help | grep -i dcop`
73
-	if [ "${USEDCOP}" != "" -a "${DCOP}" != "" ]; then
74
-		KDETYPE="dcop"
75
-		USEKDIALOG="1";
76
-	elif [ "${USEDCOP}" = "" -a "${QDBUS}" != "" ]; then
77
-		KDETYPE="qdbus"
78
-		USEKDIALOG="1";
79
-	elif [ "${USEDCOP}" = "" -a "${DBUSSEND}" != "" ]; then
80
-		KDETYPE="dbussend"
81
-		USEKDIALOG="1";
82
-	fi;
83
-fi;
84
-
85
-# Check for special watchdog mode.
86
-# In this mode we are used to kill ourself after a certain time limit to make sure we don't hang.
87
-if [ "${1}" = "--watchdog" ]; then
88
-	if [ "" != "${2}" ]; then
89
-		echo "Watchdog for: ${2}"
90
-		sleep 5;
91
-		kill -1 ${2} >/dev/null 2>&1 &
92
-		sleep 5;
93
-		kill -9 ${2} >/dev/null 2>&1 &
94
-		exit 0;
95
-	else
96
-		echo "No PID specified to watch."
97
-		exit 1;
98
-	fi;
99
-
100
-	exit 1;
101
-fi;
102
-
103
-if [ "${1}" = "--pulsate" ]; then
104
-	shift;
105
-	PULSATE="1"
106
-else
107
-	PULSATE="0"
108
-fi;
109
-
110
-CAPTION=${1}
111
-FILESIZE=${2}
112
-WGETPID=${4}
113
-progresswindow=""
114
-TYPE=""
115
-PIPE="progresspipe_${$}"
116
-retval="1"
117
-CONTINUE="1"
118
-
119
-readprogress() {
120
-	data=""
121
-	input=""
122
-	while [ ${CONTINUE} -eq "1" -a -e ${PIPE} ]; do
123
-		if [ "${TYPE}" = "KDE" ]; then
124
-			wasCancelled="false"
125
-			if [ "${KDETYPE}" = "dcop" ]; then
126
-				wasCancelled=`${DCOP} ${progresswindow} wasCancelled`;
127
-			elif [ "${KDETYPE}" = "qdbus" ]; then
128
-				wasCancelled=`${QDBUS} ${progresswindow} org.kde.kdialog.ProgressDialog.wasCancelled`;
129
-			elif [ "${KDETYPE}" = "dbussend" ]; then
130
-				wasCancelled=`${DBUSSEND} --print-reply --dest=${progresswindow} org.kde.kdialog.ProgressDialog.wasCancelled | grep boolean | awk '{print $2}'`;
131
-			fi
132
-			if [ "${wasCancelled}" = "true" ]; then
133
-				touch .downloadWasCancelled
134
-				break;
135
-			fi;
136
-		fi;
137
-		
138
-		input=`cat "${PIPE}" | tail ${TAILOPTS}1`
139
-		if [ "${input}" = "quit" ]; then
140
-			break;
141
-		elif [ "${input}" != "" ]; then
142
-			data=${input}
143
-			input=""
144
-			if [ "${PULSATE}" = "1" ]; then
145
-				val=-1
146
-				
147
-				if [ "${data}" != "-1" ]; then
148
-					if [ "${TYPE}" = "KDE" ]; then
149
-						if [ "${KDETYPE}" = "dcop" ]; then
150
-							${DCOP} ${progresswindow} setLabelText "${data}"
151
-						elif [ "${KDETYPE}" = "qdbus" ]; then
152
-							${QDBUS} ${progresswindow} org.kde.kdialog.ProgressDialog.setLabelText "${data}"
153
-						elif [ "${KDETYPE}" = "dbussend" ]; then
154
-							${DBUSSEND} --print-reply --dest=${progresswindow} org.kde.kdialog.ProgressDialog.setLabelText "string:\'${data}\'" > /dev/null
155
-						fi;
156
-					elif [ "${TYPE}" = "GNOME" ]; then
157
-						echo "${data}" | sed 's/^/# /g'
158
-					else
159
-						echo "${data}"
160
-					fi;
161
-				fi;
162
-				
163
-			else
164
-				if [ "${BC}" != "" ]; then
165
-					res=`echo "scale=4 ; (${data}/${FILESIZE})*100" | bc`;
166
-				else
167
-					# Note, this will return 0 or 100, nothing else, better than spamming
168
-					# errors and never closing tho.
169
-					res=`echo $(( (${data}/${FILESIZE})*100 ))`;
170
-				fi;
171
-				val=${res%%.*}
172
-				if [ "${val}" = "" ]; then
173
-					val=0
174
-				fi;
175
-			fi;
176
-			if [ "${TYPE}" = "KDE" ]; then
177
-				if [ "${KDETYPE}" = "dcop" ]; then
178
-					${DCOP} ${progresswindow} setProgress ${val}
179
-					returnVal=${?}
180
-				elif [ "${KDETYPE}" = "qdbus" ]; then
181
-					${QDBUS} ${progresswindow} org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog value ${val}
182
-					returnVal=${?}
183
-				elif [ "${KDETYPE}" = "dbussend" ]; then
184
-					${DBUSSEND} --print-reply --dest=${progresswindow} org.freedesktop.DBus.Properties.Set string:'org.kde.kdialog.ProgressDialog' string:'value' variant:int32:${val} > /dev/null
185
-					returnVal=${?}
186
-				fi;
187
-				
188
-				if [ ${returnVal} -ne 0 ]; then
189
-					break;
190
-				fi;
191
-			elif [ "${TYPE}" = "GNOME" ]; then
192
-				echo ${val}
193
-				if [ $? -ne 0 ] ; then
194
-					break;
195
-				fi
196
-			else
197
-				if [ $((${val} % 2)) -eq 0 ]; then
198
-					echo "-> "${val}"%"
199
-				fi;
200
-			fi;
201
-			if [ "${val}" = "100" ]; then
202
-				retval="0"
203
-				CONTINUE="0"
204
-				break;
205
-			fi;
206
-		fi;
207
-	done;
208
-}
209
-
210
-if [ "" = "${CAPTION}" -o "" = "${FILESIZE}" ]; then
211
-	echo "Insufficient Parameters."
212
-	echo "Usage: ${0} <caption> <totalvalue> [pipename]"
213
-	exit;
214
-fi;
215
-
216
-if [ "" != "${3}" ]; then
217
-	# Assume pipe name is what we want, delete existing file.
218
-	PIPE=${3}
219
-	rm -Rf ${PIPE}
220
-else
221
-	# Make sure we get a file that doesn't already exist, keep appending our
222
-	# pid untill we get a file that hasn't been taken.
223
-	while [ -e "${PIPE}" ]; do
224
-		PIPE="${PIPE}_${$}"
225
-	done;
226
-fi;
227
-
228
-echo "Using pipe: "${PIPE}
229
-mkfifo "${PIPE}"
230
-EMPTYPIPE="1"
231
-WDPID=""
232
-WD2PID=""
233
-closeProgress() {
234
-	CONTINUE="0"
235
-	if [ "${TYPE}" = "KDE" -a ${retval} != "0" ]; then
236
-		if [ "${KDETYPE}" = "dcop" ]; then
237
-			${DCOP} ${progresswindow} close
238
-		elif [ "${KDETYPE}" = "qdbus" ]; then
239
-			${QDBUS} ${progresswindow} org.kde.kdialog.ProgressDialog.close
240
-		elif [ "${KDETYPE}" = "dbussend" ]; then
241
-			${DBUSSEND} --print-reply --dest=${progresswindow} org.kde.kdialog.ProgressDialog.close > /dev/null
242
-		fi;
243
-	fi;
244
-	echo "Exiting with value: $retval"
245
-	if [ "${WGETPID}" != "" ]; then
246
-		echo "Attempting to kill wget (${WGETPID})"
247
-		kill -9 ${WGETPID}
248
-	fi;
249
-	
250
-	if [ -e ${PIPE} ]; then
251
-		if [ "${EMPTYPIPE}" = "1" ]; then
252
-			sh ${0} --watchdog ${$} &
253
-			WDPID=${!}
254
-		
255
-			EMPTYPIPE="2"
256
-			echo "Emptying pipe (${PIPE}) this may hang if no data has been written to the pipe."
257
-			cat ${PIPE};
258
-		elif [ "${EMPTYPIPE}" = "2" ]; then
259
-			echo "Helping pipe (${PIPE}) this may hang if nothing is reading from the pipe."
260
-			sh ${0} --watchdog ${$} &
261
-			WD2PID=${!}
262
-			EMPTYPIPE="3"
263
-			echo "." > ${PIPE};
264
-		else
265
-			echo "Ignoring Pipe..."
266
-		fi;
267
-		echo "Killing watchdog 1."
268
-		kill -9 ${WDPID}
269
-		echo "Killing watchdog 2."
270
-		kill -9 ${WD2PID}
271
-		echo "Deleting Pipe ${PIPE}"
272
-		rm -Rf "${PIPE}"
273
-	fi;
274
-	exit $retval;
275
-}
276
-trap 'closeProgress' INT TERM EXIT
277
-
278
-rm .downloadWasCancelled
279
-
280
-# if kdialog exists, and we have a display, and we are not running gnome,
281
-# and either we are running kde or zenity doesn't exist..
282
-if [ "" != "${KDIALOG}" -a "" != "${DISPLAY}" -a "" = "${ISGNOME}" -a "${USEKDIALOG}" = "1" ]; then
283
-	echo "Progress dialog on Display: ${DISPLAY}"
284
-	progresswindow=`${KDIALOG} --title "DMDirc: ${CAPTION}" --progressbar "${CAPTION}" 100`
285
-	if [ "${PULSATE}" = "1" ]; then
286
-		SHOWCANCEL="false"
287
-	else
288
-		SHOWCANCEL="true"
289
-	fi;
290
-	if [ "${KDETYPE}" = "dcop" ]; then
291
-		${DCOP} ${progresswindow} setAutoClose true
292
-		${DCOP} ${progresswindow} showCancelButton ${SHOWCANCEL}
293
-	elif [ "${KDETYPE}" = "qdbus" ]; then
294
-		${QDBUS} ${progresswindow} org.freedesktop.DBus.Properties.Set org.kde.kdialog.ProgressDialog autoClose true
295
-		${QDBUS} ${progresswindow} org.kde.kdialog.ProgressDialog.showCancelButton ${SHOWCANCEL}
296
-	elif [ "${KDETYPE}" = "dbussend" ]; then
297
-		${DBUSSEND} --print-reply --dest=${progresswindow} org.kde.kdialog.ProgressDialog.showCancelButton boolean:${SHOWCANCEL} >/dev/null
298
-		${DBUSSEND} --print-reply --dest=${progresswindow} org.freedesktop.DBus.Properties.Set string:'org.kde.kdialog.ProgressDialog' string:'autoClose' variant:boolean:true > /dev/null
299
-	fi;
300
-	TYPE="KDE"
301
-	readprogress
302
-	CONTINUE="0"
303
-	echo "Progress Bar Complete"
304
-elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
305
-	# Else, if zenity exists and we have a display
306
-	echo "Progress dialog on Display: ${DISPLAY}"
307
-	TYPE="GNOME"
308
-	if [ "${PULSATE}" = "1" ]; then
309
-		readprogress | ${ZENITY} --progress --pulsate --auto-close --title "DMDirc: ${CAPTION}" --text "${CAPTION}"
310
-	else
311
-		readprogress | ${ZENITY} --progress --auto-close --auto-kill --title "DMDirc: ${CAPTION}" --text "${CAPTION}"
312
-	fi;
313
-	CONTINUE="0"
314
-	echo "Progress Bar Complete"
315
-else
316
-	# Else, basic command-line progress
317
-	echo "Progress For: ${CAPTION}"
318
-	echo "-> 0%"
319
-	readprogress
320
-	CONTINUE="0"
321
-	echo ""
322
-	echo "Finished!"
323
-fi
324
-echo "Exiting progressbar"
325
-exit 0;

+ 0
- 248
installer/linux/setup.sh Ver fichero

@@ -1,248 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script launches the dmdirc java-based installer.
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
7
-#
8
-# Permission is hereby granted, free of charge, to any person obtaining a copy
9
-# of this software and associated documentation files (the "Software"), to deal
10
-# in the Software without restriction, including without limitation the rights
11
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
-# copies of the Software, and to permit persons to whom the Software is
13
-# furnished to do so, subject to the following conditions:
14
-#
15
-# The above copyright notice and this permission notice shall be included in
16
-# all copies or substantial portions of the Software.
17
-#
18
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
-# SOFTWARE.
25
-
26
-# Check the which command exists, and if so make sure it behaves how we want
27
-# it to...
28
-WHICH=`which which 2>/dev/null`
29
-if [ "" = "${WHICH}" ]; then
30
-	echo "which command not found. Aborting.";
31
-	exit 0;
32
-else
33
-	# Solaris sucks
34
-	BADWHICH=`which /`
35
-	if [ "${BADWHICH}" != "" ]; then
36
-		echo "Replacing bad which command.";
37
-		# "Which" on solaris gives non-empty results for commands that don't exist
38
-		which() {
39
-			OUT=`${WHICH} ${1}`
40
-			if [ $? -eq 0 ]; then
41
-				echo ${OUT}
42
-			else
43
-				echo ""
44
-			fi;
45
-		}
46
-	fi;
47
-fi
48
-
49
-# Find out where we are
50
-BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
51
-
52
-PIDOF=`which pidof`
53
-if [ "${PIDOF}" = "" ]; then
54
-	# For some reason some distros hide pidof...
55
-	if [ -e /sbin/pidof ]; then
56
-		PIDOF=/sbin/pidof
57
-	elif [ -e /usr/sbin/pidof ]; then
58
-		PIDOF=/usr/sbin/pidof
59
-	fi;
60
-fi;
61
-
62
-if [ -e "${BASEDIR}/functions.sh" ]; then
63
-	. ${BASEDIR}/functions.sh
64
-else
65
-	echo "Unable to find functions.sh, unable to continue."
66
-	exit 1;
67
-fi;
68
-
69
-UNAME=`uname -a`
70
-
71
-# Store params so that we can pass them back to ourself if needed.
72
-for param in "$@"; do
73
-	PSN=`echo "${param}" | grep "^-psn_"`
74
-	if [ "" = "${PSN}" ]; then
75
-		SPACE=`echo "${param}" | grep " "`
76
-		if [ "${SPACE}" != "" ]; then
77
-			niceParam=`echo "${param}" | sed 's/"/\\\\"/g'`
78
-			params=${params}" \"${niceParam}\""
79
-		else
80
-			params=${params}" ${param}"
81
-		fi;
82
-	fi;
83
-done;
84
-
85
-# Check for some CLI params
86
-isRelease=""
87
-USEPROFILE=1;
88
-while test -n "$1"; do
89
-	case "$1" in
90
-		--release|-r)
91
-			shift
92
-			isRelease=${1}
93
-			;;
94
-		--help|-h)
95
-			showHelp;
96
-			;;
97
-		--noprofile)
98
-			USEPROFILE=0;
99
-			;;
100
-	esac
101
-	shift;
102
-done
103
-
104
-relaunch() {
105
-	trap - INT TERM EXIT
106
-	echo ""
107
-	echo "============================================================="
108
-	echo "ERROR"
109
-	echo "============================================================="
110
-	echo "${HOME}/.profile has errors in it (or an 'exit' command)."
111
-	echo "Setup will now restart with the --noprofile option."
112
-	echo "============================================================="
113
-	sh ${0} ${params} --noprofile
114
-}
115
-
116
-echo ""
117
-echo "---------------------"
118
-echo "Setup.sh"
119
-echo "---------------------"
120
-echo -n "Looking for java.. ";
121
-# Location where ports on FreeBSD/PCBSD installs java6
122
-# check it first, because it isn't added to the path automatically
123
-JAVA="/usr/local/jdk1.6.0/jre/bin/java"
124
-if [ ! -e "${JAVA}" ]; then
125
-	# Try alternative BSD Location
126
-	JAVA="/usr/local/diablo-jdk1.6.0/jre/bin/java"
127
-	if [ ! -e "${JAVA}" ]; then
128
-		# Look in path
129
-		if [ -e "${HOME}/.profile" -a "${USEPROFILE}" = "1" ]; then
130
-			# Source the profile incase java can't be found otherwise
131
-			# First, lets add a nice handler for the script exiting because of this crap.
132
-			trap relaunch INT TERM EXIT
133
-			. ${HOME}/.profile
134
-			trap - INT TERM EXIT
135
-		fi;
136
-		JAVA=`which java`
137
-	fi
138
-fi
139
-
140
-installjre() {
141
-	result=1
142
-	if [ ! -e "jre.bin" ]; then
143
-		message="Would you like to download and install java?"
144
-		if [ "install" = "${1}" ]; then
145
-			message="Java was not detected on your machine. Would you like to download and install it now?" 
146
-		elif [ "upgrade" = "${1}" ]; then
147
-			message="The version of java detected on your machine is not compatible with DMDirc. Would you like to download and install a compatible version now?"
148
-		fi;
149
-		/bin/sh getjre.sh "${message}"
150
-		if [ $? -eq 0 ]; then
151
-			/bin/sh installjre.sh
152
-			result=$?
153
-		fi;
154
-	else
155
-		message="Would you like to install java?"
156
-		if [ "install" = "${1}" ]; then
157
-			message="Java was not detected on your machine. Would you like to install it now?" 
158
-		elif [ "upgrade" = "${1}" ]; then
159
-			message="The version of java detected on your machine is not compatible with DMDirc. Would you like to install a compatible version now?"
160
-		fi;
161
-		/bin/sh installjre.sh  "${message}"
162
-		result=$?
163
-	fi;
164
-	if [ ${result} -ne 0 ]; then
165
-		if [ "upgrade" = "${1}" ]; then
166
-			errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without an updated version of java."
167
-		else
168
-			errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without java."
169
-		fi;
170
-		exit 1;
171
-	else
172
-		if [ -e "${PWD}/java-bin" ]; then
173
-			echo "Found JREBin: ${PWD}/java-bin"
174
-			JAVA="${PWD}/java-bin"
175
-		else
176
-			JAVA=`which java`
177
-		fi;
178
-	fi;
179
-}
180
-
181
-if [ "" != "${JAVA}" ]; then
182
-	echo "Success! ("${JAVA}")"
183
-else
184
-	echo "Failed!"
185
-	installjre "install"
186
-fi
187
-
188
-echo "Success!"
189
-
190
-if [ "${UID}" = "" ]; then
191
-	UID=`id -u`;
192
-fi
193
-if [ "0" = "${UID}" ]; then
194
-	echo "Running as root.."
195
-	isRoot="--isroot";
196
-else
197
-	echo "Running as user.."
198
-	isRoot="";
199
-fi
200
-
201
-showHelp() {
202
-	echo "This will setup DMDirc on a unix based system."
203
-	echo "The following command line arguments are known:"
204
-	echo "---------------------"
205
-	echo "-h, --help                Help information"
206
-	echo "-r, --release [version]   This is a release"
207
-	echo "---------------------"
208
-	exit 0;
209
-}
210
-
211
-if [ "${isRelease}" != "" ]; then
212
-	isRelease=" --release "${isRelease}
213
-fi
214
-
215
-if [ -e "DMDirc.jar" ]; then
216
-	echo "Checking for openJDK.."
217
-	ISOPENJDK=`${JAVA} -version 2>&1 | grep -i openjdk`
218
-	if [ "" != "${ISOPENJDK}" ]; then
219
-		message="The DMDirc installer has detected that you are using OpenJDK. There are currently known issues with some versions of OpenJDK and DMDirc. To ensure DMDirc runs optimally we recommend you use the Sun JRE."
220
-		message="${message}\n\nWould you like to continue anyway?"
221
-		questiondialog "OpenJDK" "${message}" 0
222
-		if [ $? -ne 0 ]; then
223
-			echo "Aborting."
224
-			exit 1;
225
-		fi;
226
-	fi;
227
-	
228
-	echo "Checking java version.."
229
-	${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main --help >/dev/null
230
-	if [ $? -ne 0 ]; then
231
-		installjre "upgrade"
232
-		echo "Trying to run installer.."
233
-		${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
234
-		if [ $? -ne 0 ]; then
235
-			exit 1;
236
-		fi;
237
-	else
238
-		echo "Running installer.."
239
-		${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
240
-		exit $?
241
-	fi
242
-else
243
-	echo "No installer found!"
244
-fi
245
-
246
-## Script-Only install goes here.
247
-echo "Script-Only functionality not implemented."
248
-exit 1;

+ 0
- 141
installer/linux/uninstall.sh Ver fichero

@@ -1,141 +0,0 @@
1
-#!/bin/sh
2
-
3
-# Check the which command exists, and if so make sure it behaves how we want
4
-# it to...
5
-WHICH=`which which 2>/dev/null`
6
-if [ "" = "${WHICH}" ]; then
7
-	echo "which command not found. Aborting.";
8
-	exit 0;
9
-else
10
-	# Solaris sucks
11
-	BADWHICH=`which /`
12
-	if [ "${BADWHICH}" != "" ]; then
13
-		echo "Replacing bad which command.";
14
-		# "Which" on solaris gives non-empty results for commands that don't exist
15
-		which() {
16
-			OUT=`${WHICH} ${1}`
17
-			if [ $? -eq 0 ]; then
18
-				echo ${OUT}
19
-			else
20
-				echo ""
21
-			fi;
22
-		}
23
-	fi;
24
-fi
25
-
26
-# Find out where we are
27
-BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
28
-
29
-if [ ! -e ${BASEDIR}/.uninstall.conf ]; then
30
-	echo "No .uninstall.conf found, unable to continue."
31
-	exit 1;
32
-else
33
-	INSTALLED_AS_ROOT=""
34
-	INSTALL_LOCATION=""
35
-	
36
-	. ${BASEDIR}/.uninstall.conf
37
-
38
-	if [ "${INSTALL_LOCATION}" = "" ]; then
39
-		echo "Unable to read .uninstall.conf, unable to continue."
40
-		exit 1;
41
-	fi;
42
-fi;
43
-
44
-PIDOF=`which pidof`
45
-if [ -z "${PIDOF}" ]; then
46
-	# For some reason some distros hide pidof...
47
-	if [ -e /sbin/pidof ]; then
48
-		PIDOF=/sbin/pidof
49
-	elif [ -e /usr/sbin/pidof ]; then
50
-		PIDOF=/usr/sbin/pidof
51
-	fi;
52
-fi;
53
-
54
-JAVA=`which java`
55
-
56
-if [ -e "${BASEDIR}/functions.sh" ]; then
57
-	. ${BASEDIR}/functions.sh
58
-else
59
-	echo "Unable to find functions.sh, unable to continue."
60
-	exit 1;
61
-fi;
62
-
63
-if [ "${INSTALLED_AS_ROOT}" -eq 1 ]; then
64
-	USER=`whoami`
65
-	if [ "${USER}" != "root" ]; then
66
-		errordialog "Uninstaller" "Uninstall Aborted. Only root can use this script"
67
-		exit 1;
68
-	fi
69
-fi
70
-
71
-questiondialog "Uninstaller" "Are you sure you want to uninstall DMDirc?"
72
-if [ $? -ne 0 ]; then
73
-	messagedialog "Uninstaller" "Uninstall Aborted."
74
-	echo "Uninstall Aborted"
75
-	exit 1;
76
-fi
77
-
78
-${JAVA} -jar ${INSTALL_LOCATION}/DMDirc.jar -k
79
-
80
-if [ $? -eq 0 ]; then
81
-	errordialog "Uninstaller" "Uninstall Aborted - DMDirc is still running. Please close DMDirc before continuing"
82
-	echo "Uninstall Aborted - DMDirc already running."
83
-	exit 1;
84
-fi
85
-
86
-echo "Uninstalling DMDirc"
87
-echo "Removing Shortcuts.."
88
-
89
-TOOL=`which gconftool-2`
90
-COMMAND=""
91
-FILENAME=""
92
-if [ "${INSTALLED_AS_ROOT}" -eq 1 ]; then
93
-	COMMAND="${TOOL} --config-source=`${TOOL} --get-default-source`"
94
-	FILENAME="/usr/share/services/irc.protocol"
95
-	rm -Rfv /usr/share/applications/DMDirc.desktop
96
-else
97
-	COMMAND="${TOOL}"
98
-	FILENAME="${HOME}/.kde/share/services/irc.protocol"
99
-	rm -Rfv ${HOME}/.local/share/applications/DMDirc.desktop
100
-	rm -Rfv ${HOME}/Desktop/DMDirc.desktop
101
-fi;
102
-
103
-if [ "${TOOL}" != "" ]; then
104
-	CURRENT=`${COMMAND} --get /desktop/gnome/url-handlers/irc/command`
105
-	if [ "${CURRENT}" = "\"${INSTALL_LOCATION}/DMDirc.sh\" -e -c %s" ]; then
106
-		echo "Removing Gnome Protocol Handler"
107
-		${COMMAND} --unset /desktop/gnome/url-handlers/irc/enabled
108
-		${COMMAND} --unset /desktop/gnome/url-handlers/irc/command
109
-	else
110
-		echo "Not Removing Gnome Protocol Handler"
111
-	fi
112
-fi
113
-
114
-if [ -e "${FILENAME}" ]; then
115
-	CURRENT=`grep DMDirc ${FILENAME}`
116
-	if [ "" != "${CURRENT}" ]; then
117
-		echo "Removing KDE Protocol Handler"
118
-		rm -Rfv ${FILENAME}
119
-	else
120
-		echo "Not Removing KDE Protocol Handler"
121
-	fi
122
-fi
123
-
124
-echo "Removing Installation Directory"
125
-
126
-rm -Rfv ${INSTALL_LOCATION}
127
-
128
-PROFILEDIR="${HOME}/.DMDirc"
129
-
130
-if [ -e ${PROFILEDIR}/dmdirc.config ]; then
131
-	questiondialog "Uninstaller" "A DMDirc profile has been detected (${PROFILEDIR}) Do you want to delete it as well?"
132
-	if [ $? -eq 0 ]; then
133
-		rm -Rfv "${PROFILEDIR}"
134
-	fi
135
-fi
136
-
137
-messagedialog "Uninstaller" "DMDirc Uninstalled Successfully"
138
-
139
-echo "Done."
140
-
141
-exit 0;

BIN
installer/osx/.DS_Store Ver fichero


+ 0
- 121
installer/osx/DMDirc-Apple.c Ver fichero

@@ -1,121 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- *
22
- * JNI library for OS X url handling.
23
- * Compile with:
24
- *     gcc -dynamiclib -framework JavaVM -framework Carbon -o libDMDirc-Apple.jnilib DMDirc-Apple.c -arch x86_64
25
- */
26
-
27
-#include <Carbon/Carbon.h>
28
-#include <JavaVM/jni.h>
29
-
30
-/** The method to callback */
31
-static jmethodID callbackMethod;
32
-
33
-/** The JVM our callback is in */
34
-static JavaVM *jvm;
35
-
36
-/** The global reference to the Apple object that wants the callback */
37
-static jobject apple;
38
-
39
-/** Callback from OS X with URL. */
40
-static OSErr openURLCallback(const AppleEvent *theAppleEvent, AppleEvent* reply, long handlerRefcon);
41
-
42
-/**
43
- * JNI Method to register interest in callback.
44
- * Obtained from:
45
- *     javah -classpath plugins/ui_swing.jar com.dmdirc.addons.ui_swing.Apple
46
- * Reference:
47
- *     http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#//apple_ref/c/func/AEInstallEventHandler
48
- *
49
- * @param env The JNIEnvironment for this callback.
50
- * @param this The object that is registering the callback
51
- */
52
-JNIEXPORT jint JNICALL Java_com_dmdirc_addons_ui_1swing_Apple_registerOpenURLCallback (JNIEnv *env, jobject object) {
53
-	// Find the callback in the object
54
-	callbackMethod = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, object), "handleOpenURL", "(Ljava/lang/String;)V");
55
-	
56
-	// Check if the callback exists.
57
-	if (callbackMethod != 0) {
58
-		// Store the JVM for this callback, and a global reference to the Apple object
59
-		(*env)->GetJavaVM(env, &jvm);
60
-		apple = (*env)->NewGlobalRef(env, object);
61
-	
62
-		// Now register the callback to ourself.
63
-		return (jint)AEInstallEventHandler(kInternetEventClass, kAEGetURL, NewAEEventHandlerUPP((AEEventHandlerProcPtr)openURLCallback), 0, false);
64
-	} else {
65
-		return 1;
66
-	}
67
-}
68
-
69
-
70
-/**
71
- * Callback from OS X with URL.
72
- * Reference:
73
- *     http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#//apple_ref/c/func/NewAEEventHandlerUPP
74
- *     http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#//apple_ref/c/tdef/AEEventHandlerUPP
75
- *     http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#//apple_ref/c/tdef/AEEventHandlerProcPtr
76
- *
77
- * @param theAppleEvent Pointer to apple event handle
78
- * @param reply Pointer to default reply event
79
- * @param handlerRefcon Reference constant for this callback. (Ignored)
80
- */
81
-static OSErr openURLCallback(const AppleEvent *theAppleEvent, AppleEvent* reply, long handlerRefcon) {
82
-	OSErr result = noErr;
83
-	Size givenLength = 0;
84
-	DescType type = typeChar;
85
-	
86
-	// Get the size of the string the callback wants to give us, and then
87
-	// check that it is > 0 in length.
88
-	result = AESizeOfParam(theAppleEvent, keyDirectObject, &type, &givenLength);
89
-	if (result == noErr && givenLength != 0) {
90
-		// Allocate a buffer for the result
91
-		// givenLength +1 for the \0
92
-		Size length = givenLength + 1;
93
-		char *dataPtr = (char*)malloc(length);
94
-		
95
-		if (dataPtr != 0) {
96
-			// Empty the buffer
97
-			memset(dataPtr, 0, length);
98
-			
99
-			// Get the url
100
-			result = AEGetParamPtr(theAppleEvent, keyDirectObject, typeChar, 0, dataPtr, givenLength, &givenLength);
101
-			// Did we get it?
102
-			if (result == noErr) {
103
-				// Get the java environment for the jvm we want to callback to
104
-				JNIEnv *env;
105
-				(*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);
106
-				
107
-				// Convert the url into a java string
108
-				jstring theURL = (*env)->NewStringUTF(env, dataPtr);
109
-				
110
-				// Call the method!
111
-				(*env)->CallVoidMethod(env, apple, callbackMethod, theURL);
112
-			}
113
-			
114
-			// Free the buffer
115
-			free(dataPtr);
116
-		}
117
-	}
118
-	
119
-	// And return!
120
-	return result;
121
-}

BIN
installer/osx/libDMDirc-Apple.jnilib Ver fichero


+ 0
- 455
installer/osx/makeInstallerOSX.sh Ver fichero

@@ -1,455 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script generates a .dmg file that includes dmdirc
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
7
-#
8
-# Permission is hereby granted, free of charge, to any person obtaining a copy
9
-# of this software and associated documentation files (the "Software"), to deal
10
-# in the Software without restriction, including without limitation the rights
11
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
-# copies of the Software, and to permit persons to whom the Software is
13
-# furnished to do so, subject to the following conditions:
14
-#
15
-# The above copyright notice and this permission notice shall be included in
16
-# all copies or substantial portions of the Software.
17
-#
18
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
-# SOFTWARE.
25
-
26
-# Final Name of the installer (without file extention)
27
-INSTALLERNAME=DMDirc
28
-# full name of the file to output to
29
-RUNNAME="${PWD}/${INSTALLERNAME}.dmg"
30
-
31
-# Linux needs an entry in fstab to allow normal users to mount things (like a
32
-# dmg image).
33
-# These 2 config vars choose what dir and file we mount so that fstab can be
34
-# correct, these should be full paths, and are ignored on OSX.
35
-# This is the name of the image that gets mounted:
36
-LINUXIMAGE=${PWD}/DMDirc.dmg
37
-# This is the dir we mount it in
38
-LINUXIMAGEDIR=${PWD}/dmg
39
-# fstab entry should read:
40
-# ${LINUXIMAGE} ${LINUXIMAGEDIR} auto users,noauto,loop 0 0
41
-
42
-MKISOFS=`which mkisofs`
43
-HDIUTIL=`which hdiutil`
44
-
45
-JNIName="libDMDirc-Apple.jnilib"
46
-
47
-if [ ! -e "${JNIName}" ]; then
48
-	if [ -e "/System/Library/Frameworks/JavaVM.framework/Headers" ]; then
49
-		GCC=`which gcc`
50
-		${GCC} -dynamiclib -framework JavaVM -framework Carbon -o ${JNIName} DMDirc-Apple.c -arch x86_64
51
-		if [ ! -e "${JNIName}" ]; then
52
-			echo "JNI Lib not found and failed to compile. Aborting."
53
-			exit 1;
54
-		fi;
55
-	else
56
-		echo "JNI Lib not found, unable to compile on this system. Aborting."
57
-		exit 1;
58
-	fi;
59
-fi;
60
-
61
-if [ "" = "${HDIUTIL}" ]; then
62
-	if [ "" != "${MKISOFS}" ]; then
63
-		MKISOFS_TEST=`${MKISOFS} --help 2>&1 | grep apple`
64
-		if [ "" = "${MKISOFS_TEST}" ]; then
65
-			echo "This machine is unable to produce dmg images (no support from mkisofs). Aborting."
66
-			exit 1;
67
-		fi;
68
-	else
69
-		echo "This machine is unable to produce dmg images (missing mkisofs or hdiutil). Aborting."
70
-		exit 1;
71
-	fi;
72
-fi;
73
-
74
-# Go!
75
-echo "-----------"
76
-if [ -e "${RUNNAME}" ]; then
77
-	echo "Removing existing .dmg file"
78
-	rm -Rf ./*.dmg
79
-fi
80
-
81
-WGET=`which wget`
82
-FETCH=`which fetch`
83
-CURL=`which curl`
84
-getFile() {
85
-	URL=${1}
86
-	OUTPUT=${2}
87
-
88
-	if [ "${WGET}" != "" ]; then
89
-		${WGET} -O ${OUTPUT} ${URL}
90
-	elif [ "${FETCH}" != "" ]; then
91
-		${FETCH} -o ${OUTPUT} ${URL}
92
-	elif [ "${CURL}" != "" ]; then
93
-		${CURL} -o ${OUTPUT} ${URL}
94
-	fi;
95
-}
96
-
97
-showHelp() {
98
-	echo "This will generate a DMDirc installer for a unix based system."
99
-	echo "The following command line arguments are known:"
100
-	echo "---------------------"
101
-	echo "-h, --help                Help information"
102
-	echo "-b, --branch              Release in -r is a branch "
103
-	echo "-p, --plugins <plugins>   What plugins to add to the jar file"
104
-	echo "-c, --compile             Recompile the .jar file"
105
-	echo "    --jar <file>          use <file> as DMDirc.jar"
106
-	echo "    --current             Use the current folder as the base for the build"
107
-	echo "-e, --extra <tag>         Tag to add to final exe name to distinguish this build from a standard build"
108
-	echo "---------------------"
109
-	exit 0;
110
-}
111
-
112
-# Check for some CLI params
113
-compileJar="false"
114
-isRelease=""
115
-finalTag=""
116
-BRANCH="0"
117
-plugins=""
118
-location="../../"
119
-current="1"
120
-jarfile=""
121
-TAGGED=""
122
-while test -n "$1"; do
123
-	case "$1" in
124
-		--plugins|-p)
125
-			shift
126
-			plugins=${1}
127
-			;;
128
-		--jar)
129
-			shift
130
-			jarfile=${1}
131
-			;;
132
-		--current)
133
-			location="../../"
134
-			current="1"
135
-			;;
136
-		--compile|-c)
137
-			compileJar="true"
138
-			;;
139
-		--release|-r)
140
-			shift
141
-			isRelease=${1}
142
-			;;
143
-		--extra|-e)
144
-			shift
145
-			finalTag=${1}
146
-			RUNNAME="${PWD}/${INSTALLERNAME}-${1}.dmg"
147
-			;;
148
-		--help|-h)
149
-			showHelp;
150
-			;;
151
-		--branch|-b)
152
-			BRANCH="1"
153
-			;;
154
-		--tag|-t)
155
-			TAGGED=`git describe --tags`
156
-			TAGGED=${TAGGED%%-*}
157
-			;;
158
-	esac
159
-	shift
160
-done
161
-if [ "" = "${current}" ]; then
162
-	jarPath="${location}trunk"
163
-else
164
-	jarPath="${location}"
165
-fi
166
-
167
-if [ "" = "${jarfile}" ]; then
168
-	jarfile=${jarPath}"/dist/DMDirc.jar"
169
-	if [ ! -e ${jarPath}"/dist/DMDirc.jar" -o "${compileJar}" = "true" ]; then
170
-		echo "Creating jar.."
171
-		OLDPWD=${PWD}
172
-		cd ${jarPath}
173
-
174
-		rm -Rf build dist
175
-		ant jar
176
-		if [ ! -e "dist/DMDirc.jar" ]; then
177
-			echo "There was an error creating the .jar file. Aborting."
178
-			exit 1;
179
-		fi;
180
-		cd ${OLDPWD}
181
-	fi;
182
-elif [ ! -e "${jarfile}" ]; then
183
-	echo "Requested Jar file (${jarfile}) does not exist."
184
-	exit 1;
185
-fi;
186
-
187
-echo "Copying jar (${jarfile}).."
188
-cp ${jarfile} "./DMDirc.jar"
189
-if [ "" != "${plugins}" ]; then
190
-	echo "Adding plugins to jar"
191
-	ln -sf ${jarPath}"/plugins"
192
-	pluginList=""
193
-	for plugin in ${plugins}; do
194
-		pluginList=${pluginList}" plugins/${plugin}"
195
-	done
196
-	jar -uvf "DMDirc.jar" ${pluginList}
197
-
198
-	../../updateBundledPlugins.sh "DMDirc.jar";
199
-	rm -Rf plugins;
200
-fi
201
-
202
-APPDIR="DMDirc.app"
203
-CONTENTSDIR=${APPDIR}/Contents
204
-RESDIR=${CONTENTSDIR}/Resources
205
-MACOSDIR=${CONTENTSDIR}/MacOS
206
-
207
-if [ -e "${APPDIR}" ]; then
208
-	echo "Removing existing .app directory";
209
-	rm -Rf ${APPDIR}
210
-fi;
211
-
212
-echo "Creating .app directory"
213
-mkdir -pv ${APPDIR}
214
-mkdir -pv ${CONTENTSDIR}
215
-mkdir -pv ${RESDIR}
216
-mkdir -pv ${RESDIR}/Java
217
-mkdir -pv ${MACOSDIR}
218
-
219
-echo "Creating meta files"
220
-echo "APPLDMDI" > ${CONTENTSDIR}/PkgInfo
221
-
222
-doRename=0
223
-if [ "${TAGGED}" != "" ]; then
224
-	doRename=1	
225
-fi;
226
-
227
-if [ ${doRename} -eq 1 ]; then
228
-	if [ "${TAGGED}" = "" ]; then
229
-		bundleVersion=branch-${isRelease}
230
-	else
231
-		bundleVersion=${TAGGED}
232
-	fi
233
-else
234
-	bundleVersion="trunk-"`date +%Y%m%d_%H%M%S`
235
-fi;
236
-
237
-
238
-cat <<EOF> ${CONTENTSDIR}/Info.plist
239
-
240
-<?xml version="1.0" encoding="UTF-8"?>
241
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
242
-<plist version="0.9">
243
-<dict>
244
-	<key>CFBundleName</key>
245
-	<string>DMDirc</string>
246
-	<key>CFBundleIdentifier</key>
247
-	<string>com.dmdirc.osx</string>
248
-	<key>CFBundleAllowMixedLocalizations</key>
249
-	<string>true</string>
250
-	<key>CFBundleExecutable</key>
251
-	<string>DMDirc.sh</string>
252
-	<key>CFBundleDevelopmentRegion</key>
253
-	<string>English</string>
254
-	<key>CFBundlePackageType</key>
255
-	<string>APPL</string>
256
-	<key>CFBundleSignature</key>
257
-	<string>DMDI</string>
258
-	<key>CFBundleInfoDictionaryVersion</key>
259
-	<string>6.0</string>
260
-	<key>CFBundleIconFile</key>
261
-	<string>dmdirc.icns</string>
262
-	<key>CFBundleVersion</key>
263
-	<string>${bundleVersion}</string>
264
-	<key>CFBundleShortVersionString</key>
265
-	<string>${bundleVersion}</string>
266
-	<key>Java</key>
267
-	<dict>
268
-		<key>WorkingDirectory</key>
269
-		<string>\$APP_PACKAGE/Contents/Resources/Java</string>
270
-		<key>MainClass</key>
271
-		<string>com.dmdirc.Main</string>
272
-		<key>JVMVersion</key>
273
-		<string>1.6+</string>
274
-		<key>ClassPath</key>
275
-		<string>\$JAVAROOT/DMDirc.jar</string>
276
-	</dict>
277
-	<key>CFBundleURLTypes</key>
278
-	<array>
279
-		<dict>
280
-			<key>CFBundleURLName</key>
281
-			<string>IRC URL</string>
282
-			<key>CFBundleURLSchemes</key>
283
-			<array>
284
-				<string>irc</string>
285
-			</array>
286
-		</dict>
287
-	</array>
288
-</dict>
289
-</plist>
290
-EOF
291
-
292
-#	<key>Properties</key>
293
-#	<dict>
294
-#		<key>com.apple.mrj.application.growbox.intrudes</key>
295
-#		<string>false</string>
296
-#		<key>com.apple.mrj.application.live-resize</key>
297
-#		<string>true</string>
298
-#		<key>com.apple.mrj.application.apple.menu.about.name</key>
299
-#		<string>DMDirc</string>
300
-#		<key>apple.laf.useScreenMenuBar</key>
301
-#		<string>true</string>
302
-#	</dict>
303
-
304
-cp DMDirc.jar ${RESDIR}/Java/DMDirc.jar
305
-cp ${JNIName} ${RESDIR}/Java/${JNIName}
306
-
307
-#if [ -e "../common/installer.jar" ]; then
308
-#	ln -sf ../common/installer.jar ./installer.jar
309
-#	FILES="${FILES} installer.jar"
310
-#else
311
-#	echo "[WARNING] Creating installer-less archive - relying on setup.sh"
312
-#fi
313
-
314
-if [ -e ${jarPath}"/installer/osx/res/dmdirc.icns" ]; then
315
-	cp ${jarPath}"/installer/osx/res/dmdirc.icns" ${RESDIR}/dmdirc.icns
316
-fi
317
-
318
-if [ "${isRelease}" != "" ]; then
319
-	DOCSDIR=${jarPath}
320
-else
321
-	DOCSDIR="../common"
322
-fi
323
-
324
-if [ -e "${DOCSDIR}/README.TXT" ]; then
325
-	cp "${DOCSDIR}/README.TXT" ${RESDIR}/README.TXT
326
-fi
327
-
328
-if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
329
-	cp "${DOCSDIR}/CHANGES.TXT" ${RESDIR}/CHANGES.TXT
330
-elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
331
-	cp "${DOCSDIR}/CHANGELOG.TXT" ${RESDIR}/CHANGELOG.TXT
332
-fi
333
-
334
-if [ -e "${jarPath}/launcher/unix" ]; then
335
-	cp ${jarPath}/launcher/unix/DMDirc.sh ${MACOSDIR}/DMDirc.sh
336
-	chmod a+x ${MACOSDIR}/DMDirc.sh
337
-fi
338
-
339
-if [ -e "${jarPath}/installer/linux" ]; then
340
-        cp ${jarPath}/installer/linux/functions.sh ${MACOSDIR}/functions.sh
341
-else
342
-	echo "Unable to find launcher functions, exiting."
343
-	exit 1;
344
-fi
345
-
346
-echo "Packaging.."
347
-# Create RUNNAME
348
-# Create temp dir
349
-DMG=package
350
-if [ -e ${DMG} ]; then
351
-	rm -Rf ${DMG}
352
-fi;
353
-mkdir ${DMG}
354
-# Copy the application
355
-mv ${APPDIR} ${DMG}/
356
-# link to /Applications to allow easy drag and drop
357
-ln -sf /Applications ${DMG}/
358
-
359
-if [ -e ${jarPath}"/installer/osx/res/VolumeIcon.icns" ]; then
360
-	cp -v ${jarPath}"/installer/osx/res/VolumeIcon.icns" ${DMG}/.VolumeIcon.icns
361
-fi
362
-
363
-if [ -e ${jarPath}"/installer/osx/res/Background.png" ]; then
364
-	mkdir ${DMG}/.background
365
-	cp -v ${jarPath}"/installer/osx/res/Background.png" ${DMG}/.background/background.png
366
-fi
367
-
368
-if [ -e ${PWD}/.DS_Store ]; then
369
-	cp -v ${PWD}/.DS_Store ${DMG}/.DS_Store
370
-fi
371
-
372
-# Now, make a dmg
373
-if [ "" = "${HDIUTIL}" ]; then
374
-	# Make sure the variables are set
375
-	if [ "" = "${LINUXIMAGEDIR}" ]; then
376
-		LINUXIMAGEDIR=${PWD}/dmg
377
-	fi;
378
-	if [ "" = "${LINUXIMAGED}" ]; then	
379
-		LINUXIMAGE=${PWD}/DMDirc.dmg
380
-	fi;
381
-
382
-	# Non-OSX
383
-	# Create Read-Only blessed image
384
-	${MKISOFS} -V 'DMDirc' -no-pad -r -apple -o "${LINUXIMAGE}" -hfs-creator "DMDI" -hfs-bless "/Volumes/DMDirc" "${DMG}"
385
-
386
-	# Compres it \o
387
-	if [ ! -e "${PWD}/compress-dmg" ]; then
388
-		getFile "http://binary.dmdirc.com/dmg" "compress-dmg"
389
-		chmod a+x compress-dmg
390
-	fi;
391
-	if [ ! -e "${PWD}/compress-dmg" ]; then
392
-		echo "DMG will not be compressed."
393
-	else
394
-		echo "Compressing DMG"
395
-		mv ${LINUXIMAGE} ${LINUXIMAGE}.pre
396
-		${PWD}/compress-dmg dmg ${LINUXIMAGE}.pre ${LINUXIMAGE}
397
-		if [ -e ${LINUXIMAGE} ]; then
398
-			rm -Rf ${LINUXIMAGE}.pre
399
-		else
400
-			echo "Compression failed."
401
-			mv ${LINUXIMAGE}.pre ${LINUXIMAGE}
402
-		fi;
403
-	fi;
404
-	
405
-	if [ "${LINUXIMAGE}" != "${RUNNAME}" ]; then
406
-		# Rename the image
407
-		mv ${LINUXIMAGE} ${RUNNAME}
408
-	fi;
409
-else
410
-	# OSX
411
-	# Create Read/Write image
412
-	${HDIUTIL} create -volname "DMDirc" -fs HFS+ -srcfolder ${DMG} -format UDRW ${RUNNAME}.RW.dmg
413
-	# Make it auto-open
414
-	BLESS=`which bless`
415
-	if [ "" != "${BLESS}" ]; then
416
-		if [ -e /Volumes/DMDirc ]; then
417
-			${HDIUTIL} detach /Volumes/DMDirc
418
-		fi;
419
-		if [ ! -e /Volumes/DMDirc ]; then
420
-			${HDIUTIL} attach ${RUNNAME}.RW.dmg
421
-			${BLESS} -openfolder /Volumes/DMDirc
422
-			${HDIUTIL} detach /Volumes/DMDirc
423
-		fi;
424
-	fi;
425
-	# Convert to compressed read-only image
426
-	${HDIUTIL} convert ${RUNNAME}.RW.dmg -format UDZO -imagekey zlib-level=9 -o ${RUNNAME}
427
-	rm ${RUNNAME}.RW.dmg
428
-fi;
429
-
430
-echo "DMG Creation complete!"
431
-
432
-if [ ${doRename} -eq 1 ]; then
433
-	if [ "${TAGGED}" = "" ]; then
434
-		isRelease=branch-${isRelease}
435
-	else
436
-		isRelease=${TAGGED}
437
-	fi;
438
-	if [ "" != "${finalTag}" ]; then
439
-		finalTag="-${finalTag}"
440
-	fi;
441
-	finalname=DMDirc-${isRelease}${finalTag}.dmg
442
-else
443
-	finalname=${RUNNAME##*/}
444
-fi;
445
-
446
-mv ${RUNNAME} ../output/${finalname}
447
-
448
-rm -Rfv ${DMG} ${APPDIR} ${DMGMOUNTDIR} DMDirc.jar
449
-
450
-echo "-----------"
451
-echo "Done."
452
-echo "-----------"
453
-
454
-# and Done \o
455
-exit 0;

BIN
installer/osx/res/Background.png Ver fichero


BIN
installer/osx/res/DMDircVolumeIcon.png Ver fichero


BIN
installer/osx/res/VolumeIcon.icns Ver fichero


BIN
installer/osx/res/VolumeIcon.png Ver fichero


BIN
installer/osx/res/dmdirc.icns Ver fichero


BIN
installer/osx/res/logo128.png Ver fichero


BIN
installer/osx/res/logo16.png Ver fichero


BIN
installer/osx/res/logo256.png Ver fichero


BIN
installer/osx/res/logo32.png Ver fichero


BIN
installer/osx/res/logo512.png Ver fichero


+ 0
- 223
installer/release.sh Ver fichero

@@ -1,223 +0,0 @@
1
-#!/bin/sh
2
-
3
-# Jar names of plugins to add to ALL installers. (* means all)
4
-plugins="ui_swing.jar tabcompletion_bash.jar tabcompletion_mirc.jar parser_irc.jar dcc.jar dns.jar identd.jar lagdisplay.jar logging.jar systray.jar time.jar osd.jar"
5
-
6
-# Additional Jar names of plugins to add to only Windows installers. (* means all)
7
-plugins_windows=""
8
-
9
-# Additional Jar names of plugins to add to only linux installers. (* means all)
10
-plugins_linux=""
11
-
12
-# Additional Jar names of plugins to add to only osx installers. (* means all)
13
-plugins_osx=""
14
-
15
-showHelp() {
16
-	echo "This will generate the different DMDirc installers."
17
-	echo "Usage: ${0} [params]"
18
-	echo "The following params are known:"
19
-	echo "---------------------"
20
-	echo "-t,  --tag                          This is a tagged release"
21
-	echo "     --jar <file>                   Use <file> instead of compiling a jar."
22
-	echo "     --fulljar <file>               Use <file> instead of compiling a jar, and don't run makeJar on it."
23
-	echo "     --jre                          Include a jre in the installers."
24
-	echo "     --jre64                        Include a 64bit jre in the installers."
25
-	echo "     --target <target>              Build only a specific target. <target> should be one of 'windows', 'linux' or 'osx'."
26
-	echo "-p,  --plugins <plugins>            Plugins to add to all the jars."
27
-	echo "-pl, --plugins-linux <plugins>      Plugins to linux installer."
28
-	echo "-pw, --plugins-windows <plugins>    Plugins to windows installer."
29
-	echo "-po  --plugins-osx <plugins>        Plugins to osx installer."
30
-	echo "-h,  --help                         Help information"
31
-	echo "-o,  --opt <options>                Additional options to pass to the make*Installer.sh files"
32
-	echo "     --upload                       Try to upload to google code when done (Only works on tags)"
33
-	echo "-c   --channel [channel]            Channel to pass to ant (if not passed, 'NONE', if passed without a value, 'STABLE')"
34
-	echo "     --compile                      Recompile the .jar file (otherwise use the existing file from dist/)"
35
-	echo "---------------------"
36
-	exit 0;
37
-}
38
-
39
-# Check for some CLI params
40
-LAST=""
41
-OPT=""
42
-BRANCH=""
43
-JARFILE=""
44
-JRE=""
45
-FULLJAR=""
46
-BUILDTARGET=""
47
-UPLOAD="0"
48
-TAG="0"
49
-TAGGED=""
50
-CHANNEL=""
51
-compileJar=""
52
-while test -n "$1"; do
53
-	LAST=${1}
54
-	case "$1" in
55
-		--plugins|-p)
56
-			shift
57
-			plugins="${1}"
58
-			;;
59
-		--target)
60
-			shift
61
-			BUILDTARGET="${1}"
62
-			;;
63
-		--jar)
64
-			shift
65
-			JARFILE="--jar ${1} "
66
-			;;
67
-		--fulljar)
68
-			shift
69
-			JARFILE="--jar ${1} "
70
-			FULLJAR="1"
71
-			;;
72
-		--jre|--jre64)
73
-			JRE="${1} "
74
-			;;
75
-		--plugins-linux|-pl)
76
-			shift
77
-			plugins_linux="${1}"
78
-			;;
79
-		--plugins-windows|-pw)
80
-			shift
81
-			plugins_windows="${1}"
82
-			;;
83
-		--plugins-osx|-po)
84
-			shift
85
-			plugins_osx="${1}"
86
-			;;
87
-		--opt|-o)
88
-			shift
89
-			OPT="${1} "
90
-			;;
91
-		--help|-h)
92
-			showHelp;
93
-			;;
94
-		--upload)
95
-			UPLOAD="1";
96
-			;;
97
-		--branch|-b)
98
-			BRANCH="-b "
99
-			;;
100
-		--compile)
101
-			compileJar="--compile "
102
-			;;
103
-		--tag|-t)
104
-			TAGGED="-t "
105
-
106
-			# Always recompile if tagging
107
-			compileJar="--compile "
108
-			;;
109
-		--channel|-c)
110
-			PASSEDPARAM=`echo "${2}" | grep -v ^- | grep -v " "`
111
-			if [ "${PASSEDPARAM}" != "" ]; then
112
-				shift
113
-				CHANNEL="--channel ${PASSEDPARAM} ";
114
-			else
115
-				CHANNEL="--channel STABLE ";
116
-			fi;
117
-			# Always recompile if passing a channel
118
-			compileJar="--compile "
119
-			;;
120
-	esac
121
-	shift
122
-done
123
-
124
-if [ ! -e output ]; then
125
-	mkdir output
126
-fi;
127
-
128
-if [ "${plugins}" = "*" -o "${plugins_linux}" = "*" -o "${plugins_windows}" = "*" -o "${plugins_osx}" = "*" ]; then
129
-	echo "Something is all.";
130
-	allPlugins=""
131
-	for thisfile in `ls -1 ../plugins/*.jar`; do
132
-		allPlugins=${allPlugins}" ${thisfile##*/}"
133
-	done
134
-	if [ "${plugins}" = "*" ]; then plugins=${allPlugins}; fi
135
-	if [ "${plugins_linux}" = "*" ]; then plugins_linux=${allPlugins}; fi
136
-	if [ "${plugins_windows}" = "*" ]; then plugins_windows=${allPlugins}; fi
137
-	if [ "${plugins_osx}" = "*" ]; then plugins_osx=${allPlugins}; fi
138
-fi;
139
-
140
-VERSION=`git branch | grep ^* | sed "s/^* //g"`
141
-if [ "${VERSION}" = "master" ]; then
142
-	RELEASE=""
143
-else
144
-	RELEASE="-r ${VERSION}"
145
-fi;
146
-
147
-JAR=`which jar`
148
-JAVAC=`which javac`
149
-# OSX Users might have a non 1.6 javac, look specifically for it.
150
-if [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javac" ]; then
151
-	JAVAC="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/javac"
152
-elif [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/javac" ]; then
153
-	JAVAC="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/javac"
154
-fi;
155
-
156
-THISDIR=${PWD}
157
-
158
-echo "================================================================"
159
-echo "Removing existing releases from output directory"
160
-echo "================================================================"
161
-rm -Rf output/*.run output/*.exe output/*.dmg
162
-
163
-if [ "" = "${FULLJAR}" ]; then
164
-	echo "================================================================"
165
-	echo "Building Release Jar"
166
-	echo "================================================================"
167
-	cd jar
168
-	./makeJar.sh ${compileJar}${CHANNEL}${OPT}${JARFILE}${JRE}-c -k -s ${TAGGED}${BRANCH}${RELEASE} -p "${plugins}"
169
-	RESULT=${?}
170
-	cd ${THISDIR}
171
-
172
-	if [ ${RESULT} -eq 0 ]; then
173
-		JARNAME=`ls -1tr output | grep jar$ | tail -n 1`
174
-		JARFILE="--jar ../output/${JARNAME} "
175
-	else
176
-		echo "Failed to build release jar, aborting."
177
-		exit 1;
178
-	fi;
179
-fi;
180
-
181
-if [ "linux" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
182
-	echo "================================================================"
183
-	echo "Building linux installer"
184
-	echo "================================================================"
185
-	cd linux
186
-	./makeInstallerLinux.sh ${OPT}${JARFILE}${JRE}-k ${TAGGED}${BRANCH}${RELEASE} -p "${plugins_linux}"
187
-	cd ${THISDIR}
188
-fi;
189
-
190
-if [ "windows" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
191
-	echo "================================================================"
192
-	echo "Building NSIS Windows installer"
193
-	echo "================================================================"
194
-	cd windows
195
-	./makeInstallerNSIS.sh ${OPT}${JARFILE}${JRE}-k -s ${TAGGED}${BRANCH}${RELEASE} -p "${plugins_windows}"
196
-	cd ${THISDIR}
197
-fi;
198
-
199
-if [ "osx" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
200
-	echo "================================================================"
201
-	echo "Building OSX Bundle"
202
-	echo "================================================================"
203
-	cd osx
204
-	./makeInstallerOSX.sh ${OPT}${JARFILE}-k -s ${TAGGED}${BRANCH}${RELEASE} -p "${plugins_osx}"
205
-	cd ${THISDIR}
206
-fi;
207
-
208
-
209
-if [ "1" = "${UPLOAD}" -a "" != "${TAGGED}" ]; then
210
-	echo "================================================================"
211
-	echo "Uploading to GoogleCode"
212
-	echo "================================================================"
213
-	
214
-	cd gcode
215
-	sh uploads_release.sh -v ${VERSION}
216
-else
217
-	echo "Not uploading to GoogleCode (Only tagged releases can be uploaded)"
218
-fi;
219
-
220
-echo "================================================================"
221
-echo "Release ready - see output folder"
222
-echo "================================================================"
223
-exit 0;

+ 0
- 6
installer/signing/readme.txt Ver fichero

@@ -1,6 +0,0 @@
1
-exe Signing stuff goes here on renji.
2
-   DMDirc.cer
3
-   DMDirc.pvk 
4
-   DMDirc.spc
5
-
6
-(This file makes git (and thus svn) track this directory)

+ 0
- 124
installer/windows/makeInstallerNSIS.sh Ver fichero

@@ -1,124 +0,0 @@
1
-#!/bin/sh
2
-## Temporary Hack, this should be removed at some point when we stop
3
-## using everything in /installer
4
-## This script only understands the parameters needed by BuildAll and the
5
-## installer-* ant targets.
6
-
7
-if [ ! -e "../../modules/installer/windows/" ]; then
8
-	echo "Unable to find NSIS Source"
9
-	exit 1;
10
-fi;
11
-
12
-
13
-signEXE="true"
14
-
15
-while test -n "$1"; do
16
-	case "$1" in
17
-		--plugins|-p)
18
-			shift
19
-			plugins=${1}
20
-			;;
21
-		--jar)
22
-			shift
23
-			jarfile=${1}
24
-			;;
25
-		--tag|-t)
26
-			TAGGED=`git describe --tags`
27
-			TAGGED=${TAGGED%%-*}
28
-			;;
29
-		--unsigned|-u)
30
-			signEXE="false"
31
-			;;
32
-		--extra|-e)
33
-			shift
34
-			finalTag="-${1}"
35
-			;;
36
-	esac
37
-	shift
38
-done
39
-
40
-INSTALLNAME=DMDirc-Setup
41
-OLDDIR=`pwd`
42
-
43
-mkdir -p ../../modules/installer/output
44
-rm -Rfv ../../modules/installer/windows/files
45
-mkdir -p ../../modules/installer/windows/files
46
-
47
-cp "${jarfile}" "../../modules/installer/windows/files/DMDirc.jar"
48
-cd ../../modules/installer/windows/files
49
-
50
-if [ "" != "${plugins}" ]; then
51
-	echo "Adding plugins to jar"
52
-	ln -sf ${jarPath}"/plugins"
53
-	pluginList=""
54
-	for plugin in ${plugins}; do
55
-		pluginList=${pluginList}" plugins/${plugin}"
56
-	done
57
-	jar -uvf "DMDirc.jar" ${pluginList}
58
-
59
-	../../../../updateBundledPlugins.sh
60
-	rm -Rf plugins;
61
-fi
62
-
63
-cp ../../../../src/com/dmdirc/res/icon.ico icon.ico
64
-
65
-cd ..
66
-
67
-for NSI in updater.nsi launcher.nsi installer.nsi; do
68
-	LASTCOMMIT=`git rev-list --max-count=1 HEAD -- $NSI`
69
-	NSISVERSION=`git describe --tags --always $LASTCOMMIT`
70
-	makensis -DVERSION="${NSISVERSION}" -V2 $NSI;
71
-done
72
-
73
-cd "${OLDDIR}"
74
-SRC="../../modules/installer/output/DMDirc-Setup.exe"
75
-
76
-doRename=0
77
-if [ "${TAGGED}" != "" ]; then
78
-	doRename=1
79
-fi;
80
-
81
-if [ ${doRename} -eq 1 ]; then
82
-	if [ "${TAGGED}" = "" ]; then
83
-		releaseTag=branch-${isRelease}
84
-	else
85
-		releaseTag=${TAGGED}
86
-	fi;
87
-	DEST="DMDirc-${releaseTag}-Setup${finalTag}.exe"
88
-else
89
-	DEST="${INSTALLNAME}${finalTag}.exe"
90
-fi;
91
-
92
-mv "${SRC}" "../output/${DEST}"
93
-
94
-# Get signcode path
95
-SIGNCODE=`which signcode`
96
-
97
-if [ "" = "${SIGNCODE}" ]; then
98
-	echo "Signcode not found. EXE's will not be digitally signed."
99
-fi
100
-
101
-# Sign stuff!
102
-signexe() {
103
-	if [ "" != "${SIGNCODE}" ]; then
104
-		if [ -e "../signing/DMDirc.spc" -a -e "../signing/DMDirc.pvk" ]; then
105
-			echo "Digitally Signing EXE (${@})..."
106
-			${SIGNCODE} -spc "../signing/DMDirc.spc" -v "../signing/DMDirc.pvk" -i "http://www.dmdirc.com/" -n "DMDirc Installer" $@ 2>/dev/null || {
107
-				kill -15 $$;
108
-			};
109
-			rm ${@}.sig
110
-			rm ${@}.bak
111
-		fi
112
-	fi
113
-}
114
-
115
-FULLINSTALLER="../output/${DEST}"
116
-
117
-echo "Chmodding.."
118
-chmod a+x ${FULLINSTALLER}
119
-if [ "${signEXE}" = "true" ]; then
120
-	echo "Signing.."
121
-	signexe ${FULLINSTALLER}
122
-else
123
-	echo "Not Signing.."
124
-fi;

+ 0
- 70
launcher/createUpdate.sh Ver fichero

@@ -1,70 +0,0 @@
1
-#!/bin/sh
2
-# This script generates the launcher updates
3
-LAUNCHERDIR=`dirname $0`
4
-LAUNCHERUPDATEDIR="/tmp/launchers/"
5
-
6
-UNIXVERSION=`cat ${LAUNCHERDIR}/unix/DMDirc.sh | grep LAUNCHERVERSION= | awk -F\" '{print $2}'`
7
-WINDOWSVERSION=`cat ${LAUNCHERDIR}/windows/DMDirc.dpr | grep "launcherVersion: String =" | awk -F\' '{print $2}'`
8
-
9
-# Find out what params we should pass to things.
10
-# Solaris has a nice and ancient version of grep in /usr/bin
11
-grep -na "" /dev/null >/dev/null 2>&1
12
-if [ $? -eq 2 ]; then
13
-	GREPOPTS="-n"
14
-else
15
-	GREPOPTS="-na"
16
-fi;
17
-# Solaris also has a crappy version of tail!
18
-tail -n +1 /dev/null >/dev/null 2>&1
19
-if [ $? -eq 2 ]; then
20
-	TAILOPTS="+"
21
-else
22
-	TAILOPTS="-n +"
23
-fi;
24
-
25
-if [ ! -e "${LAUNCHERUPDATEDIR}/unix-${UNIXVERSION}.sh" ]; then
26
-echo	/home/dmdirc/scripts/oblong.sh "LAUNCHER" "Creating Launcher Update: unix-${UNIXVERSION}";
27
-	
28
-	FUNCTIONSFILE="${LAUNCHERDIR}/../installer/linux/functions.sh"
29
-	SRCFILE=${LAUNCHERDIR}/unix/DMDirc.sh
30
-	DESTFILE=${LAUNCHERUPDATEDIR}/unix-${UNIXVERSION}.sh
31
-	
32
-	if [ -e "${FUNCTIONSFILE}" ]; then
33
-		FUNCTIONSLINE=`grep ${GREPOPTS} "^\s*###FUNCTIONS_FILE###\s*$" ${SRCFILE}`
34
-		if [ "${FUNCTIONSLINE}" == "" ]; then
35
-			cp ${SRCFILE} ${DESTFILE}
36
-		else
37
-			FUNCTIONSLINE=$((${FUNCTIONSLINE%%:*} + 0))
38
-			
39
-			head -n ${FUNCTIONSLINE} ${SRCFILE} > ${DESTFILE}
40
-			cat ${FUNCTIONSFILE} >> ${DESTFILE}
41
-			echo "" >> ${DESTFILE}
42
-			tail ${TAILOPTS}$((${FUNCTIONSLINE%%:*} + 1)) ${SRCFILE} >> ${DESTFILE}
43
-		fi;
44
-	else
45
-echo		/home/dmdirc/scripts/oblong.sh "LAUNCHER" "Unable to create unix launcher update, no functions.sh found."
46
-	fi;
47
-fi;
48
-
49
-exit 0;
50
-
51
-if [ ! -e "${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip" ]; then
52
-echo	/home/dmdirc/scripts/oblong.sh "LAUNCHER" "Creating Launcher Update: windows-${WINDOWSVERSION}";
53
-	OLDDIR=${PWD}
54
-	cd ${LAUNCHERDIR}/windows
55
-	sh compile.sh
56
-	# Create symlinks
57
-	for exe in `ls *.exe`; do
58
-		ln -s ${exe} .${exe}
59
-	done;
60
-
61
-	# Create Zip File
62
-	zip -9 ${LAUNCHERUPDATEDIR}/windows-${WINDOWSVERSION}.zip .*.exe
63
-
64
-	# Remove temp exes
65
-	for exe in `ls .*.exe`; do
66
-		rm -Rf ${exe}
67
-	done;
68
-
69
-	cd ${OLDDIR}
70
-fi;

+ 0
- 522
launcher/unix/DMDirc.sh Ver fichero

@@ -1,522 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# This script launches dmdirc and attempts to update the jar file if needed.
4
-#
5
-# DMDirc - Open Source IRC Client
6
-# Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes, Simon
7
-# Mott
8
-#
9
-# Permission is hereby granted, free of charge, to any person obtaining a copy
10
-# of this software and associated documentation files (the "Software"), to deal
11
-# in the Software without restriction, including without limitation the rights
12
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
-# copies of the Software, and to permit persons to whom the Software is
14
-# furnished to do so, subject to the following conditions:
15
-#
16
-# The above copyright notice and this permission notice shall be included in
17
-# all copies or substantial portions of the Software.
18
-#
19
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
-# SOFTWARE.
26
-
27
-LAUNCHERVERSION="18"
28
-LAUNCHERINFO="unix-${LAUNCHERVERSION}"
29
-
30
-params=""
31
-
32
-# Check the which command exists, and if so make sure it behaves how we want
33
-# it to...
34
-WHICH=`which which 2>/dev/null`
35
-if [ "" = "${WHICH}" ]; then
36
-	echo "which command not found. Aborting.";
37
-	exit 0;
38
-else
39
-	# Solaris sucks
40
-	BADWHICH=`which /`
41
-	if [ "${BADWHICH}" != "" ]; then
42
-		echo "Replacing bad which command.";
43
-		# "Which" on solaris gives non-empty results for commands that don't exist
44
-		which() {
45
-			OUT=`${WHICH} ${1}`
46
-			if [ $? -eq 0 ]; then
47
-				echo ${OUT}
48
-			else
49
-				echo ""
50
-			fi;
51
-		}
52
-	fi;
53
-fi
54
-
55
-# Find out where we are
56
-BASEDIR=$(cd "${0%/*}" 2>/dev/null; echo $PWD)
57
-
58
-# Store params so that we can pass them back to the client
59
-for param in "$@"; do
60
-	if [ "${param}" = "--noprofile" -o "${param}" = "--updateonly" ]; then 
61
-		continue;
62
-	fi;
63
-	PSN=`echo "${param}" | grep "^-psn_"`
64
-	if [ "" = "${PSN}" ]; then
65
-		SPACE=`echo "${param}" | grep " "`
66
-		if [ "${SPACE}" != "" ]; then
67
-			niceParam=`echo "${param}" | sed 's/"/\\\\"/g'`
68
-			params=${params}" \"${niceParam}\""
69
-		else
70
-			params=${params}" ${param}"
71
-		fi;
72
-	fi;
73
-done;
74
-
75
-if [ -e "${BASEDIR}/functions.sh" ]; then
76
-	. ${BASEDIR}/functions.sh
77
-else
78
-	echo "Unable to find functions.sh, using built in functions"
79
-	###FUNCTIONS_FILE###
80
-fi;
81
-
82
-# Check to see if we can bspatch things
83
-BSPATCH="./bspatch"
84
-if [ ! -e "${BSPATCH}" ]; then
85
-	BSPATCH=`which bspatch`
86
-fi;
87
-
88
-# This launcher supports zip files.
89
-LAUNCHERINFO=${LAUNCHERINFO}",zip"
90
-
91
-if [ "${BSPATCH}" != "" ]; then
92
-	# TODO: Website should (if available) send bsdiff patches
93
-	# to clients with bsdiff compatible launchers
94
-	LAUNCHERINFO=${LAUNCHERINFO}",bsdiff";
95
-fi;
96
-
97
-# Check for some CLI params
98
-if [ "${ISOSX}" = "1" ]; then
99
-	profiledir="${HOME}/Library/Preferences/DMDirc/"
100
-else
101
-	profiledir="${HOME}/.DMDirc/"
102
-	if [ ! -d "${profiledir}" ]; then
103
-		profiledir="${XDG_CONFIG_HOME}"
104
-		if [ "${profiledir}" = "" ]; then
105
-			profiledir="${HOME}/.config"
106
-		fi;
107
-		profiledir="${profiledir}/DMDirc/"
108
-	fi;
109
-fi;
110
-
111
-USEPROFILE=1;
112
-UPDATEONLY=0;
113
-while test -n "$1"; do
114
-	case "$1" in
115
-		--directory|-d)
116
-			shift
117
-			profiledir=${1}
118
-			;;
119
-		--noprofile)
120
-			USEPROFILE=0;
121
-			;;
122
-		--updateonly)
123
-			UPDATEONLY=1;
124
-			;;
125
-		-p|--portable)
126
-			profiledir=${PWD};
127
-			;;
128
-	esac
129
-	shift
130
-done
131
-
132
-getConfigOption() {
133
-	FILE="${profiledir}/dmdirc.config"
134
-	WANTED_DOMAIN="${1}"
135
-	WANTED_KEY="${2}"
136
-	CURRENT_SECTION=""
137
-	if [ "${WANTED_KEY}" != "" -a "${WANTED_DOMAIN}" = "" ]; then
138
-		if [ -e "${FILE}" ]; then
139
-			cat ${FILE} | sed 's/\\/\\\\/g' | while IFS='' read -r LINE; do
140
-				IS_SECTION=`echo ${LINE} | egrep "^.*:$"`
141
-				IS_KEYVALUE=`echo ${LINE} | egrep "^[[:space:]]+.*=.*$"`
142
-				if [ "" != "${IS_SECTION}" ]; then
143
-					CURRENT_SECTION=${LINE%%:*}
144
-				elif [ "" != "${IS_KEYVALUE}" ]; then
145
-					KEY=`echo ${LINE%%=*} | sed 's/^\s*//g'`
146
-					VALUE=${LINE##*=}
147
-					if [ "${WANTED_DOMAIN}" = "${CURRENT_SECTION}" -a "${WANTED_KEY}" = "${KEY}" ]; then
148
-						echo ${VALUE};
149
-					fi;
150
-				fi;
151
-			done;
152
-		fi;
153
-	fi;
154
-}
155
-
156
-if [ "${ISOSX}" = "1" ]; then
157
-	jarDir=${BASEDIR}/../Resources/Java/
158
-	jar=${jarDir}DMDirc.jar
159
-else
160
-	jar=${BASEDIR}/DMDirc.jar
161
-fi
162
-launcherUpdater=${profiledir}/updateLauncher.sh
163
-BSDJava1="/usr/local/jdk1.6.0/jre/bin/java"
164
-BSDJava2="/usr/local/diablo-jdk1.6.0/jre/bin/java"
165
-echo "---------------------"
166
-echo "DMDirc - Open Source IRC Client"
167
-echo "Launcher Version: ${LAUNCHERVERSION}"
168
-echo "Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes, Simon Mott"
169
-echo "---------------------"
170
-if [ "${ISOSX}" = "1" ]; then
171
-	echo "Running on OS X."
172
-elif [ "${KERNEL}" = "Linux" ]; then
173
-	echo "Running on Linux."
174
-elif [ "`echo ${KERNEL} | grep -i BSD`" != "" ]; then
175
-	echo "Running on BSD."
176
-elif [ "`echo ${KERNEL} | grep -i SunOS`" != "" ]; then
177
-	echo "Running on Solaris."
178
-else
179
-	echo "Running on unknown unix variation: ${KERNEL}."
180
-fi;
181
-
182
-if [ -e "${profiledir}/.launcher.zip" ]; then
183
-	# Unzip!
184
-	unzip ${profiledir}/.launcher.zip -d ${profiledir}/
185
-fi;
186
-
187
-echo -n "Checking for launcher updates in ${profiledir} - ";
188
-if [ -e "${profiledir}/.launcher.sh.ignore" ]; then
189
-	rm -Rf "${profiledir}/.launcher.sh.ignore"
190
-	echo "Ignoring!";
191
-elif [ -e "${profiledir}/.launcher.sh" ]; then
192
-	echo "Found!";
193
-	echo "Attempting to update..";
194
-
195
-	# The code below intentionally doesn't use the FUNCTIONS_FILE include as it
196
-	# wouldn't correctly escape \${0} and \${2} where needed and thus stuff would
197
-	# break!
198
-	cat <<EOF> ${launcherUpdater}
199
-		cd ${BASEDIR}
200
-		if [ -e "${BASEDIR}/functions.sh" ]; then
201
-			. ${BASEDIR}/functions.sh
202
-		else
203
-			echo "Unable to find functions.sh, using old functions"
204
-			errordialog() {
205
-				# Send message to console.
206
-				echo ""
207
-				echo "-----------------------------------------------------------------------"
208
-				echo "Error: \${1}"
209
-				echo "-----------------------------------------------------------------------"
210
-				echo "\${2}"
211
-				echo "-----------------------------------------------------------------------"
212
-	
213
-				if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
214
-					echo "Displaying dialog.."
215
-					${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} with icon stop" -e 'end tell'
216
-				else
217
-					if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
218
-						echo "Dialog on Display: ${DISPLAY}"
219
-						${KDIALOG} --title "DMDirc: \${1}" --error "\${1}\n\n\${2}"
220
-					elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
221
-						echo "Dialog on Display: ${DISPLAY}"
222
-						${ZENITY} --error --title "DMDirc: \${1}" --text "\${1}\n\n\${2}"
223
-					fi
224
-				fi
225
-			}
226
-	
227
-			messagedialog() {
228
-				# Send message to console.
229
-				echo ""
230
-				echo "-----------------------------------------------------------------------"
231
-				echo "Info: \${1}"
232
-				echo "-----------------------------------------------------------------------"
233
-				echo "\${2}"
234
-				echo "-----------------------------------------------------------------------"
235
-	
236
-				if [ "${ISOSX}" = "1" -a "" != "${OSASCRIPT}" ]; then
237
-					echo "Displaying dialog.."
238
-					${OSASCRIPT} -e 'tell application "System Events"' -e "activate" -e "display dialog \"${1}\n${2}\" buttons {\"Ok\"} giving up after 120 with icon note" -e 'end tell'
239
-				else
240
-					if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
241
-						echo "Dialog on Display: ${DISPLAY}"
242
-						${KDIALOG} --title "DMDirc: \${1}" --msgbox "\${1}\n\n\${2}"
243
-					elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
244
-						echo "Dialog on Display: ${DISPLAY}"
245
-						${ZENITY} --info --title "DMDirc: \${1}" --text "\${1}\n\n\${2}"
246
-					fi
247
-				fi;
248
-			}
249
-		fi;
250
-
251
-		mv -fv ${profiledir}/.launcher.sh ${0}
252
-		if [ ! -e "${profiledir}/.launcher.sh" ]; then
253
-			echo "Launcher Update successful."
254
-			messagedialog "Launcher Update" "Launcher Update successful"
255
-		else
256
-			if [ "${UID}" = "" ]; then
257
-				UID=`id -u`;
258
-			fi
259
-			if [ "0" != "${UID}" ]; then
260
-				if [ "${ISOSX}" = "1" ]; then
261
-					messagedialog "DMDirc" "The DMDirc Client Updater was unable to modify the client installation, trying again with administrator access"
262
-					if [ $? -eq 0 ]; then
263
-						echo "Password dialog on display"
264
-						osascript -e do shell script "mv -fv \"${profiledir}/.launcher.sh\" \"${0}\"" with administrator privileges
265
-					fi;
266
-				else
267
-					if [ "" != "${ISKDE}" -a "" != "${KSUDO}" -a "" != "${DISPLAY}" ]; then
268
-						echo "Password dialog on ${DISPLAY}"
269
-						${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.launcher.sh" "${0}"
270
-					elif [ "" != "${ISGNOME}" -a "" != "${GSUDO}" -a "" != "${DISPLAY}" ]; then
271
-						echo "Password dialog on ${DISPLAY}"
272
-						${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.launcher.sh" "${0}"
273
-					elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then	
274
-						sudo -k
275
-						${ZENITY} --entry --title="DMDirc" --text="DMDirc Client Updater requires root access to modify the global installation, please enter your password to continue." --entry-text="" --hide-text | sudo -S -- mv -fv "${profiledir}/.launcher.sh" "${0}"
276
-					else
277
-						echo "DMDirc Client Updater requires root access to modify the global installation"
278
-						sudo mv -fv "${profiledir}/.launcher.sh" "${0}"
279
-					fi;
280
-				fi;
281
-			fi
282
-			if [ ! -e "${profiledir}/.launcher.sh" ]; then
283
-				echo "Update successful."
284
-				messagedialog "Launcher Update" "Launcher Update successful"
285
-			else
286
-				echo "Launcher failed."
287
-				errordialog "Launcher Update" "Launcher Update failed, using old version"
288
-				touch ${profiledir}/.launcher.sh.ignore
289
-			fi;
290
-		fi;
291
-		sh ${0} ${params}
292
-EOF
293
-	chmod a+x ${launcherUpdater}
294
-	${launcherUpdater}
295
-	exit 0;
296
-else
297
-	echo "Not found.";
298
-fi;
299
-
300
-if [ -e "${launcherUpdater}" ]; then
301
-	rm -Rf "${launcherUpdater}"
302
-fi;
303
-
304
-echo -n "Checking for client updates in ${profiledir} - ";
305
-
306
-UPDATESOURCE="${profiledir}/.DMDirc.jar"
307
-BSDIFF="0"
308
-if [ -e "${profiledir}/.DMDirc.jar.bsdiff" -a "${BSPATCH}" != "" ]; then
309
-	UPDATESOURCE="${profiledir}/.DMDirc.jar.bsdiff"
310
-	BSDIFF="1"
311
-fi;
312
-
313
-if [ -e "${UPDATESOURCE}" ]; then
314
-	UPDATEOK="0"
315
-	TRYROOT="1"
316
-	echo "Found!";
317
-	echo "Attempting to update..";
318
-	if [ "${BSDIFF}" = "1" ]; then
319
-		cp ${jar} ${jar}.bak
320
-		${BSPATCH} ${jar}.bak ${jar} ${UPDATESOURCE}
321
-		if [ "${?}" = "0" ]; then
322
-			FILEINFO=`which ${jar} | egrep "data$"`
323
-			if [ "${FILEINFO}" = "" ]; then
324
-				UPDATEOK="1"
325
-			else
326
-				# Let the user know the update failed.
327
-				echo "1" >> "${profiledir}/.updatefailed";
328
-				chmod 777 "${profiledir}/.updatefailed";
329
-				# Replace the attempted update with the old jar
330
-				cp ${jar}.bak ${jar}
331
-				# Don't bother trying as root.
332
-				TRYROOT="0"
333
-			fi;
334
-		fi;
335
-	else
336
-		mv -fv ${UPDATESOURCE} ${jar}
337
-		if [ ! -e "${profiledir}/.DMDirc.jar" ]; then
338
-			UPDATEOK="1"
339
-		fi;
340
-	fi;
341
-	
342
-	if [ "${UPDATEOK}" = "1" ]; then
343
-		if [ "${UPDATEONLY}" = "1" ]; then
344
-			exit 0;
345
-		fi;
346
-		echo "Update successful."
347
-		messagedialog "Client Update" "Client Update successful"
348
-
349
-	else
350
-		if [ "${UID}" = "" ]; then
351
-			UID=`id -u`;
352
-		fi
353
-		if [ "0" != "${UID}" -a "1" = "${TRYROOT}" ]; then
354
-			if [ "${ISOSX}" = "1" ]; then
355
-				messagedialog "DMDirc" "The DMDirc Client Updater was unable to modify the client installation, trying again with administrator access"
356
-				if [ $? -eq 0 ]; then
357
-					echo "Password dialog on display"
358
-					# osascript -e "do shell script \"mv -fv \\\"${profiledir}/.DMDirc.jar\\\" \\\"${jar}\\\"\" with administrator privileges"
359
-					osascript -e "do shell script \"sh ${0} ${params} -d "${profiledir}" --updateonly\" with administrator privileges"
360
-				fi;
361
-			else
362
-				if [ "" != "${ISKDE}" -a "" != "${KSUDO}" -a "" != "${DISPLAY}" ]; then
363
-					echo "Password dialog on ${DISPLAY}"
364
-					# ${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
365
-					${KSUDO} --comment "DMDirc Client Updater requires root access to modify the global installation" -- sh ${0} ${params} -d "${profiledir}" --updateonly
366
-				elif [ "" != "${ISGNOME}" -a "" != "${GSUDO}" -a "" != "${DISPLAY}" ]; then
367
-					echo "Password dialog on ${DISPLAY}"
368
-					# ${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
369
-					${GSUDO} -k --message "DMDirc Client Updater requires root access to modify the global installation" -- sh ${0} ${params} -d "${profiledir}" --updateonly
370
-				elif [ "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then	
371
-					sudo -k
372
-					${ZENITY} --entry --title="DMDirc" --text="DMDirc Client Updater requires root access to modify the global installation, please enter your password to continue." --entry-text="" --hide-text | sudo -S -- sh ${0} ${params} -d "${profiledir}" --updateonly
373
-				else
374
-					echo "DMDirc Client Updater requires root access to modify the global installation"
375
-					# sudo mv -fv "${profiledir}/.DMDirc.jar" "${jar}"
376
-					sudo sh ${0} ${params} -d "${profiledir}" --updateonly
377
-				fi;
378
-			fi;
379
-		elif [ "${UPDATEONLY}" = "1" ]; then
380
-			# Update failed as root, so give up.
381
-			echo "1" >> "${profiledir}/.updatefailed";
382
-			chmod 777 "${profiledir}/.updatefailed";
383
-			exit 1;
384
-		fi;
385
-		
386
-		if [ ! -e "${profiledir}/.updatefailed" ]; then
387
-			echo "Update successful."
388
-			messagedialog "Client Update" "Client Update successful"
389
-		else
390
-			rm -Rf ${profiledir}/.updatefailed;
391
-			echo "Update failed."
392
-			errordialog "Client Update" "Client Update failed, using old version"
393
-			if [ "${BSDIFF}" = "1" ]; then
394
-				# Run the client without bspatch support
395
-				LAUNCHERINFO=`echo ${LAUNCHERINFO} | sed 's/|bsdiff//'`
396
-			fi;
397
-		fi;
398
-	fi
399
-else
400
-	echo "Not found.";
401
-fi;
402
-
403
-if [ "${UPDATEONLY}" = "1" ]; then
404
-	exit 0;
405
-fi;
406
-
407
-relaunch() {
408
-	trap - INT TERM EXIT
409
-	echo ""
410
-	echo "============================================================="
411
-	echo "ERROR"
412
-	echo "============================================================="
413
-	echo "${HOME}/.profile has errors in it (or an 'exit' command)."
414
-	echo "Setup will now restart with the --noprofile option."
415
-	echo "============================================================="
416
-	sh ${0} ${params} --noprofile
417
-}
418
-
419
-echo -n "Looking for java - ";
420
-if [ "${ISOSX}" = "1" ]; then
421
-	JAVA=`which java`
422
-	if [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java" ]; then
423
-		JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java"
424
-	elif [ -e "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java" ]; then
425
-		JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java"
426
-	fi;
427
-else
428
-	if [ -e "${HOME}/.profile" -a "${USEPROFILE}" = "1" ]; then
429
-		# Source the profile incase java can't be found otherwise
430
-		trap relaunch INT TERM EXIT
431
-		. ${HOME}/.profile
432
-		trap - INT TERM EXIT
433
-	fi;
434
-	JAVA=`which java`
435
-	if [ ! -e "${JAVA}" ]; then
436
-		# Location where ports on FreeBSD/PCBSD installs java6
437
-		# check it first, because it isn't added to the path automatically
438
-		JAVA=${BSDJava1}
439
-		if [ ! -e "${JAVA}" ]; then
440
-			# Try alternative BSD Location
441
-			JAVA=${BSDJava2}
442
-		fi;
443
-	fi;
444
-fi;
445
-
446
-if [ "" != "${JAVA}" ]; then
447
-	echo "Success! (${JAVA})"
448
-else
449
-	echo "Failed!"
450
-	ERROR="Sorry, java does not appear to be installed on this machine.";
451
-	ERROR=${ERROR}"\n"
452
-	if [ "${ISOSX}" = "1" ]; then
453
-		ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
454
-	else
455
-		ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
456
-		ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
457
-	fi;
458
-	errordialog "Unable to launch dmdirc!" "${ERROR}";
459
-	exit 1;
460
-fi
461
-
462
-echo -n "Running DMDirc - "
463
-if [ -e "${jar}" ]; then
464
-	# Check that DMDirc will run, if java is not 1.6 this will fail.
465
-	# We do it this way otherwise segfaults etc would cause an unable to launch
466
-	# error message to be printed.
467
-	${JAVA} -jar ${jar} --help >/dev/null 2>&1
468
-	if [ $? -ne 0 ]; then
469
-		FAILED=1
470
-		# If we are on BSD, check to see if there is alternative versions of java
471
-		# than the one in the path.
472
-		if [ "`echo ${KERNEL} | grep -i BSD`" != "" ]; then
473
-			if [ "${JAVA}" != "${BSDJava1}" -a "${JAVA}" != "${BSDJava2}" ]; then
474
-				JAVA=${BSDJava1}
475
-				if [ ! -e "${JAVA}" ]; then
476
-					JAVA=${BSDJava2}
477
-				fi;
478
-				# Now check to see if DMDirc runs again.
479
-				${JAVA} -jar ${jar} --help >/dev/null 2>&1
480
-				if [ $? -eq 0 ]; then
481
-					# It runs!
482
-					FAILED=0
483
-				fi;
484
-			fi;
485
-		fi;
486
-		if [ ${FAILED} -eq 1 ]; then
487
-			echo "Failed."
488
-			ERROR="Sorry, the currently installed version of java is not compatible with DMDirc.";
489
-			ERROR=${ERROR}"\n";
490
-			if [ "${ISOSX}" = "1" ]; then
491
-				ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM.";
492
-			else
493
-				ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from: http://www.java.com";
494
-				ERROR=${ERROR}"\nor reinstall DMDirc and let the installer install one for you.";
495
-			fi;
496
-			errordialog "Unable to launch dmdirc!" "${ERROR}";
497
-			exit 1;
498
-		fi;
499
-	fi
500
-
501
-	# Now we can run the client for real, this allows stderr/stdout output
502
-	# to be seen, and the shell script exits with the correct exit code.
503
-	APPLEOPTS=""
504
-	if [ "${ISOSX}" = "1" ]; then
505
-		APPLEOPTS="${APPLEOPTS} -Djava.library.path=${jarDir}"
506
-		#APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.growbox.intrudes=false"
507
-		#APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.live-resize=true"
508
-		APPLEOPTS="${APPLEOPTS} -Dcom.apple.mrj.application.apple.menu.about.name=DMDirc"
509
-		#APPLEOPTS="${APPLEOPTS} -Dapple.awt.showGrowBox=true"
510
-		#APPLEOPTS="${APPLEOPTS} -Dapple.laf.useScreenMenuBar=true"
511
-	fi;
512
-	${JAVA}${APPLEOPTS} -ea -jar ${jar} -l ${LAUNCHERINFO} ${params}
513
-	EXITCODE=${?}
514
-	if [ ${EXITCODE} -eq 42 ]; then
515
-		# The client says we need to up update, rerun ourself before exiting.
516
-		${0} ${params}
517
-	fi;
518
-	exit ${EXITCODE};
519
-else
520
-	echo "Failed.";
521
-	errordialog "Unable to launch dmdirc!" "No jar file found";
522
-fi

+ 0
- 169
launcher/windows/DMDirc.dpr Ver fichero

@@ -1,169 +0,0 @@
1
-{*
2
- * This application launches DMDirc on windows and passes control to the
3
- * update engine as necessary.
4
- *
5
- * DMDirc - Open Source IRC Client
6
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes,
7
- * Michael Nixon
8
- *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy
10
- * of this software and associated documentation files (the "Software"), to deal
11
- * in the Software without restriction, including without limitation the rights
12
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- * copies of the Software, and to permit persons to whom the Software is
14
- * furnished to do so, subject to the following conditions:
15
- *
16
- * The above copyright notice and this permission notice shall be included in
17
- * all copies or substantial portions of the Software.
18
- *
19
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- * SOFTWARE.
26
- *}
27
-program DMDirc;
28
-{$MODE Delphi}
29
-{$APPTYPE GUI}
30
-
31
-{$R comctl.rc}
32
-{$R icon.rc}
33
-{$R version.rc}
34
-
35
-uses Vista, shared, Windows, SysUtils, classes, StrUtils;
36
-procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls';
37
-{ ---------------------------------------------------------------------------- }
38
-
39
-{ ----------------------------------------------------------------------------
40
-  MAIN PROGRAM
41
-  ---------------------------------------------------------------------------- }
42
-const
43
-  launcherVersion: String = '4';
44
-var
45
-  errorMessage: String;
46
-  cliParams: String = '';
47
-  directory: String = '';
48
-  i: integer;
49
-  jarName: String;
50
-  launcherUpdate: boolean = false;
51
-  result: integer;
52
-  s: string;
53
-  handle: thandle;
54
-begin
55
-  InitCommonControls;
56
-
57
-  { Check for a mutex created by the DMDirc update process. Wait until it no
58
-    longer exists before we continue. This prevents us from proceeding if any
59
-    previous instance of the launcher is shutting down. }
60
-  handle := OpenMutex(SYNCHRONIZE, False, 'DMDirc_Launcher_Restart_Wait');
61
-  if handle <> 0 then begin
62
-    { The mutex exists. Wait for it for up to 5 seconds. }
63
-    if WaitForSingleObject(handle, 5000) = WAIT_TIMEOUT then begin
64
-      { Timed out - we cannot continue, there is some kind of serious issue? }
65
-      showError('Internal error: Timed out waiting for previous instance of launcher to stop during restart upgrade', 'DMDirc', true, true);
66
-      exit;
67
-    end;
68
-    { If we get to here, the mutex has been released and we can continue }
69
-    CloseHandle(handle);
70
-  end;
71
-
72
-  jarName := ExtractFileDir(paramstr(0))+'\DMDirc.jar';
73
-
74
-  directory := GetEnvironmentVariable('APPDATA')+'\DMDirc';
75
-  if ParamCount > 0 then begin
76
-    for i := 1 to ParamCount do begin
77
-      if AnsiContainsStr(cliParams, ' ') then cliParams := cliParams+' "'+paramstr(i)+'"'
78
-      else cliParams := cliParams+' '+paramstr(i);
79
-      if (paramstr(i) = '-d') or (paramstr(i) = '--directory') then begin
80
-        if ParamCount > i then begin
81
-          directory := paramstr(i+1);
82
-        end;
83
-      end
84
-    end;
85
-  end;
86
-
87
-  // Update if needed.
88
-  launcherUpdate := FileExists(directory+'\.DMDirc.exe') and FileExists(directory+'\.DMDircUpdater.exe');
89
-  if FileExists(directory+'\.DMDirc.jar') or launcherUpdate then begin
90
-    // Vista Sucks.
91
-    if IsWindowsVista then begin
92
-      // Vista >.<
93
-      // Try and delete the old file, if it fails then the user needs to give
94
-      // us permission to delete the file (UAC), otherwise we can just go ahead
95
-      // and run the updater.
96
-      if not DeleteFile(pchar(jarName)) then begin
97
-        errorMessage := 'An update to DMDirc has been previously downloaded. ';
98
-        errorMessage := errorMessage+#13#10;
99
-        errorMessage := errorMessage+#13#10+'As you are running Windows Vista, DMDirc requires administrator access to ';
100
-        errorMessage := errorMessage+#13#10+'complete the update. ';
101
-        errorMessage := errorMessage+#13#10;
102
-        errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no ';
103
-        errorMessage := errorMessage+#13#10+'here to continue without updating. ';
104
-        if askQuestion(errorMessage, 'DMDirc') then begin
105
-          RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
106
-        end;
107
-      end
108
-      else RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
109
-    end
110
-    else RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
111
-  end;
112
-
113
-  if not launcherUpdate then begin
114
-    // Check JVM
115
-    if (RunJava('-version') <> 0) then begin
116
-      errorMessage := 'No JVM is currently installed.';
117
-      errorMessage := errorMessage+#13#10;
118
-      errorMessage := errorMessage+#13#10+'DMDirc requires a 1.6.0 compatible JVM, you can get one from:';
119
-      errorMessage := errorMessage+#13#10+'http://java.com/';
120
-      showError(errorMessage, 'DMDirc', true);
121
-    end
122
-    // Else try and run client. (This only asks for help output to check that client
123
-    // runs on this OS, otherwise later segfaults or so would cause the error to
124
-    // appear
125
-    else if FileExists(jarName) then begin
126
-      if (RunJava('-jar "'+jarName+'" --help') <> 0) then begin
127
-        errorMessage := 'The currently installed version of java is not compatible with DMDirc.';
128
-        errorMessage := errorMessage+#13#10;
129
-        errorMessage := errorMessage+#13#10+'DMDirc requires a 1.6.0 compatible JVM, you can get one from:';
130
-        errorMessage := errorMessage+#13#10+'http://java.com/';
131
-        showError(errorMessage, 'DMDirc', True);
132
-      end
133
-      else begin
134
-        { Need to wait so we can deal with exit code 42 to restart }
135
-        result := RunJava('-ea -jar "'+jarName+'"'+' -l windows-'+launcherVersion+' '+cliParams);
136
-        if result = 42 then begin
137
-          { Need to restart DMDirc launcher
138
-            We can't just rerun the EXE because it is possible for the new
139
-            process to launch the updater and try to replace this EXE before
140
-            the current thread ends - remote but possible. We deal with this
141
-            case by creating a mutex that this program will spin on when it
142
-            restarts until this instance ends. }
143
-          handle := CreateMutex(nil, True, 'DMDirc_Launcher_Restart_Wait');
144
-          if handle = 0 then begin
145
-            showError('Internal error: Failed to create restart mutex', 'DMDirc', true, true);
146
-            exit;
147
-          end;
148
-
149
-          { Build new command line }
150
-          s := '';
151
-          for i := 1 to paramcount do begin
152
-            if pos(' ', paramstr(i)) <> 0 then s := s + '"' + paramstr(i) + '"' else
153
-              s := s + paramstr(i);
154
-            if i < paramcount then s := s + ' ';
155
-          end;
156
-
157
-          { Launch self }
158
-          Launch('"' + paramstr(0)+ '" ' + s);
159
-        end;
160
-      end;
161
-    end
162
-    else begin
163
-      errorMessage := 'A file required to start DMDirc is missing. Please re-install DMDirc to rectify the problem.';
164
-      errorMessage := errorMessage+#13#10;
165
-      errorMessage := errorMessage+#13#10 + 'File: DMDirc.jar';
166
-      showError(errorMessage, 'DMDirc');
167
-    end;
168
-  end;
169
-end.

+ 0
- 131
launcher/windows/DMDircUpdater.dpr Ver fichero

@@ -1,131 +0,0 @@
1
-{*
2
- * Updates DMDirc windows components
3
- *
4
- * DMDirc - Open Source IRC Client
5
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes,
6
- * Michael Nixon
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *}
26
-program DMDircUpdater;
27
-{$MODE Delphi}
28
-{$APPTYPE GUI}
29
-
30
-{$R UAC.rc}
31
-
32
-uses Vista, shared, Windows, SysUtils, classes, StrUtils;
33
-procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls';
34
-{ ---------------------------------------------------------------------------- }
35
-
36
-{ ----------------------------------------------------------------------------
37
-  MAIN PROGRAM
38
-  ---------------------------------------------------------------------------- }
39
-var
40
-  sourceDir: String = '';
41
-  thisDir: String;
42
-  cliParams: String = '';
43
-  i: integer;
44
-  jarName: String;
45
-  launcherUpdate: boolean = false;
46
-  myName: String;
47
-  canDoMore: boolean = true;
48
-begin
49
-  InitCommonControls;
50
-
51
-  myName := ExtractFileName(paramstr(0));
52
-  thisDir := ExtractFileDir(paramstr(0));
53
-  jarName := thisDir+'\DMDirc.jar';
54
-
55
-  if ParamCount > 0 then begin
56
-    for i := 1 to ParamCount do begin
57
-      if AnsiContainsStr(cliParams, ' ') then cliParams := cliParams+' "'+paramstr(i)+'"'
58
-      else cliParams := cliParams+' '+paramstr(i);
59
-      if (paramstr(i) = '--UpdateSourceDir') then begin // Source Directory
60
-        if ParamCount > i then begin
61
-          sourceDir := paramstr(i+1);
62
-        end;
63
-      end
64
-    end;
65
-
66
-    // Look for a launcher update.
67
-    if FileExists(pchar(sourceDir+'\.DMDirc.exe')) and FileExists(pchar(sourceDir+'\.DMDircUpdater.exe')) then begin
68
-      if myName = 'DMDircUpdater.exe' then begin
69
-        // Windows won't let us overwrite ourself, so we need to copy ourself
70
-        // to another name, and run the new us.
71
-        if CopyFile(pchar(thisDir+'\DMDircUpdater.exe'), pchar(thisDir+'\DMDircLauncherUpdater.exe'), False) then begin
72
-          canDoMore := false;
73
-          Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
74
-        end
75
-        else begin
76
-          showmessage('Unable to overwrite launcher', 'DMDirc', 'Update Failed');
77
-        end;
78
-      end
79
-      else begin
80
-        launcherUpdate := true;
81
-        if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
82
-          if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
83
-            showmessage('Unable to delete DMDirc.exe', 'DMDirc', 'Launcher Update Failed');
84
-          end;
85
-        end;
86
-        
87
-        if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
88
-          if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
89
-            if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
90
-              showmessage('Unable to delete DMDircUpdater.exe', 'DMDirc', 'Launcher Update Failed');
91
-            end;
92
-          end;
93
-          if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
94
-            showmessage('Launcher update was successful', 'DMDirc');
95
-          end
96
-          else begin
97
-            showmessage('Unable to update DMDircUpdater.exe', 'DMDirc', 'Launcher Update Failed');
98
-          end;
99
-        end
100
-        else begin
101
-          showmessage('Unable to update DMDirc.exe', 'DMDirc', 'Launcher Update Failed');
102
-        end;
103
-      end;
104
-    end;
105
-
106
-    // Look for client update
107
-    if canDoMore then begin
108
-      if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
109
-        if FileExists(pchar(jarName)) then begin
110
-          if not DeleteFile(pchar(jarName)) then begin
111
-            showmessage('Unable to update DMDirc.jar', 'DMDirc', 'Launcher Update Failed');
112
-          end;
113
-        end;
114
-
115
-        if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
116
-          showmessage('Client update was successful', 'DMDirc');
117
-        end
118
-        else begin
119
-          showmessage('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName, 'DMDirc', 'Update Failed');
120
-        end;
121
-      end;
122
-      
123
-      if launcherUpdate then begin
124
-        showmessage('The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'DMDirc', 'Restart Required');
125
-      end;
126
-    end;
127
-  end
128
-  else begin
129
-    showError('This program can not be run on its own.', 'DMDirc');
130
-  end;
131
-end.

+ 0
- 10
launcher/windows/comctl.manifest Ver fichero

@@ -1,10 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
-  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="DMDirc Updater" type="win32"/>
4
-  <description>DMDirc Updater</description>
5
-  <dependency>
6
-    <dependentAssembly>
7
-      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
8
-    </dependentAssembly>
9
-  </dependency>
10
-</assembly>

+ 0
- 1
launcher/windows/comctl.rc Ver fichero

@@ -1 +0,0 @@
1
-1 24 "comctl.manifest"

+ 0
- 29
launcher/windows/compile.sh Ver fichero

@@ -1,29 +0,0 @@
1
-#!/bin/sh
2
-rm UAC.manifest UAC.rc
3
-if [ ! -e ../../installer/windows/UAC.rc ]; then
4
-	echo "1 24 \"UAC.manifest\"" > UAC.rc
5
-	cp ../../installer/windows/UAC.manifest .
6
-else
7
-	cp ../../installer/windows/UAC.manifest ../../installer/windows/UAC.rc .
8
-fi;
9
-
10
-if [ ! -e ./icon.ico ]; then
11
-	ln -sf "../../src/com/dmdirc/res/icon.ico" ./icon.ico
12
-fi
13
-
14
-rm -Rf ./*.exe
15
-PWDIR="${PWD}"
16
-# Windows binaries need real paths not cygwin-y pathhs.
17
-if [ "${WINDIR}" != "" ]; then
18
-	PWDIR=`echo "${PWDIR}" | sed 's#^/c/#c:/#'`
19
-fi;
20
-compilerFlags="-Xs -XX -O2 -Or -Op1"
21
-extraFlags="-Fu${PWDIR}/../../libwin"
22
-fpc -Sd -Twin32 ${compilerFlags} ${extraFlags} DMDirc.dpr
23
-fpc -Sd -Twin32 ${compilerFlags} ${extraFlags} DMDircUpdater.dpr
24
-rm -Rf ./*.o ./*.or ./*.ppu
25
-if [ -e DMDircUpdater.exe -a -e DMDirc.exe ]; then
26
-	exit 0;
27
-else
28
-	exit 1;
29
-fi

+ 0
- 1
launcher/windows/icon.rc Ver fichero

@@ -1 +0,0 @@
1
-icon.ico ICON icon.ico

+ 0
- 27
launcher/windows/version.rc Ver fichero

@@ -1,27 +0,0 @@
1
-1 VERSIONINFO
2
-FILEVERSION 1, 0, 0, 0
3
-PRODUCTVERSION 1, 0, 0, 0
4
-FILEFLAGSMASK 0x000A
5
-FILEFLAGS 0x3f
6
-FILEOS 0x40004
7
-FILETYPE 1
8
-BEGIN
9
-	BLOCK "StringFileInfo"
10
-	BEGIN
11
-		BLOCK "040004E4"
12
-		BEGIN
13
-			VALUE "Comments", "http://www.dmdirc.com/"
14
-			VALUE "CompanyName", "DMDirc"
15
-			VALUE "FileDescription", "Launcher for DMDirc"
16
-			VALUE "FileVersion", "2.0"
17
-			VALUE "InternalName", "DMDirc.exe"
18
-			VALUE "LegalCopyright", "Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes"
19
-			VALUE "OriginalFilename", "$2"
20
-			VALUE "ProductName", "DMDirc Launcher"
21
-		END
22
-	END
23
-	BLOCK "VarFileInfo"
24
-	BEGIN
25
-		VALUE "Translation", 0x400, 1252
26
-	END
27
-END

+ 0
- 65
src/com/dmdirc/installer/DefaultSettings.java Ver fichero

@@ -1,65 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import com.dmdirc.installer.cliparser.CLIParser;
26
-
27
-/**
28
- * Default settings for the installer.
29
- */
30
-public class DefaultSettings implements Settings {
31
-
32
-    /** {@inheritDoc} */
33
-    @Override
34
-    public boolean getShortcutMenuState() {
35
-        return CLIParser.getCLIParser().getParamNumber("-no-shortcut-menu")
36
-                == 0;
37
-    }
38
-
39
-    /** {@inheritDoc} */
40
-    @Override
41
-    public boolean getShortcutDesktopState() {
42
-        return CLIParser.getCLIParser().getParamNumber("-no-shortcut-desktop")
43
-                == 0;
44
-    }
45
-
46
-    /** {@inheritDoc} */
47
-    @Override
48
-    public boolean getShortcutQuickState() {
49
-        return CLIParser.getCLIParser().getParamNumber("-no-shortcut-quicklaunch")
50
-                == 0;
51
-    }
52
-
53
-    /** {@inheritDoc} */
54
-    @Override
55
-    public boolean getShortcutProtocolState() {
56
-        return CLIParser.getCLIParser().getParamNumber("-no-shortcut-protocol")
57
-                == 0;
58
-    }
59
-
60
-    /** {@inheritDoc} */
61
-    @Override
62
-    public String getInstallLocation() {
63
-        return Main.getInstaller().defaultInstallLocation();
64
-    }
65
-}

+ 0
- 257
src/com/dmdirc/installer/Installer.java Ver fichero

@@ -1,257 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import com.dmdirc.installer.cliparser.CLIParser;
26
-
27
-import java.io.File;
28
-import java.io.FileInputStream;
29
-import java.io.FileOutputStream;
30
-import java.io.FilenameFilter;
31
-import java.io.IOException;
32
-import java.nio.channels.FileChannel;
33
-
34
-/**
35
- * Installs DMDirc.
36
- */
37
-public abstract class Installer extends Thread {
38
-
39
-    /** Types of shortcut. */
40
-    public static enum ShortcutType {
41
-
42
-        /** Desktop shortcut. */
43
-        DESKTOP,
44
-        /** Menu (start/k/etc) shortcut. */
45
-        MENU,
46
-        /** Quick launch shortcut. */
47
-        QUICKLAUNCH,
48
-        /** The actual uninstaller (not a shortcut, as far as I can tell). */
49
-        UNINSTALLER,
50
-        /** Associate DMDirc with the irc:// protocol (not a shortcut). */
51
-        PROTOCOL;
52
-    }
53
-
54
-    /** Step where the installation output should be. */
55
-    protected TextStep step;
56
-
57
-    /**
58
-     * Create a new Installer.
59
-     */
60
-    public Installer() {
61
-        super("Installer-Thread");
62
-    }
63
-
64
-    /**
65
-     * Get the default install location.
66
-     *
67
-     * @return The default install location
68
-     */
69
-    public abstract String defaultInstallLocation();
70
-
71
-    /**
72
-     * This is what helps actually perform the installation in run().
73
-     * This is a hack to keep the installing and the GUI separate.
74
-     *
75
-     * @param step The step that called this
76
-     */
77
-    public final void setInstallStep(final TextStep step) {
78
-        this.step = step;
79
-    }
80
-
81
-    /** {@inheritDoc} */
82
-    @Override
83
-    public final void run() {
84
-        step.setText("Beginning Install..\n");
85
-
86
-        final boolean isUnattended = (CLIParser.getCLIParser().getParamNumber(
87
-                "-unattended") != 0);
88
-        final Settings settings = (isUnattended) ? new DefaultSettings() : ((Settings) Main.getWizardFrame().
89
-                getStep(1));
90
-
91
-        final String location = settings.getInstallLocation();
92
-        step.addText("Installing files to: " + location);
93
-        if (!doSetup(location)) {
94
-            step.addText("");
95
-            step.addText("Installation failed\n");
96
-            Main.getWizardFrame().enableNextStep(true);
97
-            return;
98
-        }
99
-
100
-        if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
101
-            if (settings.getShortcutMenuState()) {
102
-                step.addText("Setting up " + Main.getInstaller().getMenuName()
103
-                        + " shortcut");
104
-                setupShortcut(location, ShortcutType.MENU);
105
-            } else {
106
-                step.addText("Not setting up "
107
-                        + Main.getInstaller().getMenuName() + " shortcut");
108
-            }
109
-        }
110
-
111
-        if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)) {
112
-            if (settings.getShortcutDesktopState()) {
113
-                step.addText("Setting up Desktop shortcut");
114
-                setupShortcut(location, ShortcutType.DESKTOP);
115
-            } else {
116
-                step.addText("Not setting up Desktop shortcut");
117
-            }
118
-        }
119
-
120
-        if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)) {
121
-            if (settings.getShortcutQuickState()) {
122
-                step.addText("Setting up Quick Launch shortcut");
123
-                setupShortcut(location, ShortcutType.QUICKLAUNCH);
124
-            } else {
125
-                step.addText("Not setting up Quick Launch shortcut");
126
-            }
127
-        }
128
-
129
-        if (Main.getInstaller().supportsShortcut(ShortcutType.UNINSTALLER)) {
130
-            step.addText("Creating uninstaller");
131
-            setupShortcut(location, ShortcutType.UNINSTALLER);
132
-        }
133
-
134
-        if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)) {
135
-            if (settings.getShortcutProtocolState()) {
136
-                step.addText("Setting up irc:// handler");
137
-                setupShortcut(location, ShortcutType.PROTOCOL);
138
-            } else {
139
-                step.addText("Not setting up irc:// handler");
140
-            }
141
-        }
142
-
143
-        postInstall(location);
144
-
145
-        step.addText("");
146
-        step.addText("Installation finished\n");
147
-        Main.getWizardFrame().enableNextStep(true);
148
-    }
149
-
150
-    /**
151
-     * Is the given file name vaild to copy to the installation directory?
152
-     *
153
-     * @param filename File to check
154
-     * @return true If the file should be copied, else false.
155
-     */
156
-    public abstract boolean validFile(final String filename);
157
-
158
-    /**
159
-     * Main Setup stuff.
160
-     *
161
-     * @param location Location where app will be installed to.
162
-     * @return True if installation passed, else false
163
-     */
164
-    public boolean doSetup(final String location) {
165
-        // Create the directory
166
-        final File directory = new File(location);
167
-        if (!directory.exists()) {
168
-            directory.mkdir();
169
-        }
170
-
171
-        try {
172
-            final File dir = new File(".");
173
-            final FilenameFilter filter = new FilenameFilter() {
174
-
175
-                /** {@inheritDoc} */
176
-                @Override
177
-                public boolean accept(final File dir, final String name) {
178
-                    return name.charAt(0) != '.' && validFile(name);
179
-                }
180
-            };
181
-            final String[] children = dir.list(filter);
182
-            if (children != null) {
183
-                for (String filename : children) {
184
-                    step.addText("Copying " + filename);
185
-                    copyFile(filename, location + File.separator + filename);
186
-                }
187
-            }
188
-        } catch (IOException e) {
189
-            step.addText("Error copying files: " + e.getMessage());
190
-            return false;
191
-        }
192
-        step.addText("File Copying Complete.");
193
-        return true;
194
-    }
195
-
196
-    /**
197
-     * Check if this OS supports a given shortcut Type.
198
-     *
199
-     * @param shortcutType Type of shortcut to check
200
-     * @return True if this OS supports a given shortcut Type
201
-     */
202
-    public boolean supportsShortcut(final ShortcutType shortcutType) {
203
-        return false;
204
-    }
205
-
206
-    /**
207
-     * Check what name to show for the menu shortcut
208
-     *
209
-     * @return Name for menu shortcutType
210
-     */
211
-    public String getMenuName() {
212
-        return "menu";
213
-    }
214
-
215
-    /**
216
-     * Setup shortcut.
217
-     *
218
-     * @param location Location where app will be installed to.
219
-     * @param shortcutType Type of shortcut to add.
220
-     */
221
-    protected abstract void setupShortcut(final String location,
222
-                                          final ShortcutType shortcutType);
223
-
224
-    /**
225
-     * Copy a file from one location to another.
226
-     * Based on http://www.exampledepot.com/egs/java.io/CopyFile.html
227
-     *
228
-     * @param srcFile Original file
229
-     * @param dstFile New file
230
-     * @throws java.io.IOException If an exception occurs while copying
231
-     */
232
-    protected final void copyFile(final String srcFile, final String dstFile)
233
-            throws IOException {
234
-        if (new File(srcFile).exists()) {
235
-            final FileChannel srcChannel = new FileInputStream(srcFile).
236
-                    getChannel();
237
-            final FileChannel dstChannel = new FileOutputStream(dstFile).
238
-                    getChannel();
239
-
240
-            dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
241
-
242
-            srcChannel.close();
243
-            dstChannel.close();
244
-        } else {
245
-            throw new IOException(srcFile + " does not exist.");
246
-        }
247
-    }
248
-
249
-    /**
250
-     * Any post-install tasks should be done here.
251
-     *
252
-     * @param location Location where app was installed to.
253
-     */
254
-    public void postInstall(final String location) {
255
-        // Nothing to do by default, installers may override
256
-    }
257
-}

+ 0
- 133
src/com/dmdirc/installer/InstallerListener.java Ver fichero

@@ -1,133 +0,0 @@
1
-/*
2
- *
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer;
25
-
26
-import com.dmdirc.installer.Installer.ShortcutType;
27
-import com.dmdirc.installer.ui.InstallerDialog;
28
-
29
-/**
30
- * Listeners to all wizard and step changes and responds accordingly.
31
- */
32
-public class InstallerListener implements WizardListener, StepListener {
33
-
34
-    private Main main;
35
-
36
-    /**
37
-     * Instantiates a new installer listener.
38
-     *
39
-     * @param main Installer entry point
40
-     */
41
-    public InstallerListener(final Main main) {
42
-        this.main = main;
43
-    }
44
-
45
-    /** {@inheritDoc} */
46
-    @Override
47
-    public void wizardFinished() {
48
-        main.disposeOfInstaller();
49
-        Main.getWizardFrame().dispose();
50
-    }
51
-
52
-    /** {@inheritDoc} */
53
-    @Override
54
-    public void wizardCancelled() {
55
-        if (!"Install".equals(Main.getWizardFrame().getCurrentStepName()) && Main.getWizardFrame().
56
-                showCancelConfirmation()) {
57
-            Main.getWizardFrame().dispose();
58
-        }
59
-    }
60
-
61
-    /** {@inheritDoc} */
62
-    @Override
63
-    public void stepAboutToDisplay(final Step step) {
64
-        if ("Install".equals(step.getStepName())) {
65
-            installerToBeDisplayed(step);
66
-        } else if ("Confirm".equals(step.getStepName())) {
67
-            confirmToBeDisplayed(step);
68
-        }
69
-    }
70
-
71
-    /** {@inheritDoc} */
72
-    @Override
73
-    public void stepHidden(final Step step) {
74
-        //Ignore
75
-    }
76
-
77
-    private void installerToBeDisplayed(final Step step) {
78
-        final InstallerDialog dialog = Main.getWizardFrame();
79
-        dialog.enableNextStep(false);
80
-        dialog.enablePreviousStep(false);
81
-        Main.getInstaller().setInstallStep((TextStep) dialog.getStep("Install"));
82
-        Main.getInstaller().start();
83
-    }
84
-
85
-    private void confirmToBeDisplayed(final Step step) {
86
-        String shortcutText = "";
87
-
88
-        final Settings settings = (Settings) Main.getWizardFrame().getStep(1);
89
-
90
-        if (Main.getInstaller().supportsShortcut(ShortcutType.MENU) && settings.
91
-                getShortcutMenuState()) {
92
-            shortcutText = shortcutText + " - Create " + Main.getInstaller().
93
-                    getMenuName() + " shortcut\n";
94
-        }
95
-
96
-        if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)
97
-                && settings.getShortcutDesktopState()) {
98
-            shortcutText = shortcutText + " - Create desktop shortcut\n";
99
-        }
100
-
101
-        if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)
102
-                && settings.getShortcutQuickState()) {
103
-            shortcutText = shortcutText + " - Create Quick Launch shortcut\n";
104
-        }
105
-
106
-        if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)
107
-                && settings.getShortcutProtocolState()) {
108
-            shortcutText = shortcutText + " - Make DMDirc handle irc:// links\n";
109
-        }
110
-
111
-
112
-        final String installLocation = settings.getInstallLocation();
113
-
114
-
115
-        if (step instanceof TextStep) {
116
-            final TextStep textStep = (TextStep) step;
117
-            if (installLocation.isEmpty()) {
118
-                textStep.setText(
119
-                        "You have chosen an invalid install location\n\n"
120
-                        + "Please press the \"Previous\" button to go back and correct it.");
121
-               Main.getWizardFrame().enableNextStep(false);
122
-            } else {
123
-                textStep.setText(
124
-                        "Please review your chosen settings:\n\n"
125
-                        + " - Install Location:\n" + "    " + installLocation
126
-                        + "\n" + shortcutText + "\n" + "If you wish to change "
127
-                        + "any of these settings, press the \"Previous\" "
128
-                        + "button, otherwise click \"Next\" to begin the installation");
129
-                Main.getWizardFrame().enableNextStep(true);
130
-           }
131
-        }
132
-    }
133
-}

+ 0
- 282
src/com/dmdirc/installer/LinuxInstaller.java Ver fichero

@@ -1,282 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- * 
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- * 
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import com.dmdirc.installer.cliparser.CLIParser;
26
-
27
-import java.io.File;
28
-import java.io.IOException;
29
-import java.io.PrintWriter;
30
-
31
-/**
32
- * Installs DMDirc on linux
33
- * 
34
- * @author Shane Mc Cormack
35
- */
36
-public class LinuxInstaller extends Installer {
37
-    /**
38
-     * Are we running as root?
39
-     * 
40
-     * @return true iif running as root
41
-     */
42
-    private boolean isRoot() {
43
-        return CLIParser.getCLIParser().getParamNumber("-isroot") > 0;
44
-    }
45
-
46
-    /** {@inheritDoc} */
47
-    @Override
48
-    public boolean validFile(final String filename) {
49
-        return !filename.equalsIgnoreCase("setup.sh")
50
-                && !filename.equalsIgnoreCase("getjre.sh")
51
-                && !filename.equalsIgnoreCase("jre.bin")
52
-                && !filename.equalsIgnoreCase("java-bin")
53
-                && !filename.equalsIgnoreCase("progressbar.sh")
54
-                && !filename.equalsIgnoreCase("installjre.sh")
55
-                && !filename.matches(".*pipe.*");
56
-    }
57
-
58
-    /** {@inheritDoc} */
59
-    @Override
60
-    public String defaultInstallLocation() {
61
-        String result = "";
62
-        if (CLIParser.getCLIParser().getParamNumber("-directory") > 0) {
63
-            return CLIParser.getCLIParser().getParam("-directory")
64
-                    .getStringValue();
65
-        }
66
-        if (result.isEmpty()) {
67
-            if (isRoot()) {
68
-                result = "/opt/dmdirc";
69
-            } else {
70
-                result = System.getProperty("user.home") + "/DMDirc";
71
-            }
72
-        }
73
-        return result;
74
-    }
75
-
76
-    /** {@inheritDoc} */
77
-    @Override
78
-    public boolean supportsShortcut(final ShortcutType shortcutType) {
79
-        switch (shortcutType) {
80
-            case QUICKLAUNCH:
81
-                return false;
82
-            case DESKTOP:
83
-                // No desktop for root
84
-                return !isRoot();
85
-            case PROTOCOL:
86
-            case UNINSTALLER:
87
-            case MENU:
88
-                // Both root and non-root have a menu, uninstaller, and protocol
89
-                return true;
90
-            default:
91
-                // Anything else that gets added should be false until the
92
-                // relevent
93
-                // code is added
94
-                return false;
95
-        }
96
-    }
97
-
98
-    /** {@inheritDoc} */
99
-    @Override
100
-    public void setupShortcut(final String location,
101
-            final ShortcutType shortcutType) {
102
-        if (!supportsShortcut(shortcutType)) {
103
-            step
104
-                    .addText(" - Error creating shortcut. Not applicable to this Operating System");
105
-            return;
106
-        }
107
-
108
-        PrintWriter writer = null;
109
-        try {
110
-            String filename = "";
111
-            String command = "";
112
-
113
-            switch (shortcutType) {
114
-                case DESKTOP:
115
-                    filename = System.getProperty("user.home")
116
-                            + "/Desktop/DMDirc.desktop";
117
-                    break;
118
-
119
-                case MENU:
120
-                    if (isRoot()) {
121
-                        filename = "/usr/share/applications/DMDirc.desktop";
122
-                    } else {
123
-                        filename = System.getProperty("user.home")
124
-                                + "/.local/share/applications/DMDirc.desktop";
125
-                    }
126
-                    break;
127
-
128
-                case UNINSTALLER:
129
-                    // Write config for uninstaller
130
-                    writer = new PrintWriter(location + "/.uninstall.conf");
131
-                    writer.println("#!/bin/sh");
132
-                    writer.println("# DMDirc Uninstaller Settings");
133
-                    writer.println("INSTALLED_AS_ROOT="
134
-                            + (isRoot() ? "1" : "0"));
135
-                    writer.println("INSTALL_LOCATION=" + location);
136
-
137
-                    // Make sure uninstaller is executeable
138
-                    new File(location + "/uninstall.sh").setExecutable(true);
139
-                    return;
140
-
141
-                case PROTOCOL:
142
-                    if (isRoot()) {
143
-                        command = "${TOOL} --config-source=`${TOOL} --get-default-source`";
144
-                        filename = "/usr/share/services/";
145
-                    } else {
146
-                        command = "${TOOL}";
147
-                        filename = "${HOME}/.kde/share/services/";
148
-                    }
149
-
150
-                    writer = new PrintWriter(location + "/protocolHandlers.sh");
151
-                    writer.println("#!/bin/sh");
152
-                    writer.println("TOOL=`which gconftool-2`");
153
-                    writer.println("if [ \"${TOOL}\" != \"\" ]; then");
154
-                    writer
155
-                            .println("\t"
156
-                                    + command
157
-                                    + " --set --type=bool /desktop/gnome/url-handlers/irc/enabled true");
158
-                    writer
159
-                            .println("\t"
160
-                                    + command
161
-                                    + " --set --type=string /desktop/gnome/url-handlers/irc/command \"\\\""
162
-                                    + location + "/DMDirc.sh\\\" -e -c %s\"");
163
-                    writer
164
-                            .println("\t"
165
-                                    + command
166
-                                    + " --set --type=bool /desktop/gnome/url-handlers/irc/need-terminal false");
167
-                    writer.println("fi");
168
-                    writer.println("if [ ! -e \"" + filename + "\" ]; then");
169
-                    writer.println("\tmkdir -p \"" + filename + "\"");
170
-                    writer.println("fi");
171
-                    writer.println("echo \"[Protocol]\" > " + filename
172
-                            + "irc.protocol");
173
-                    writer.println("echo \"exec=\"" + location
174
-                            + "/DMDirc.sh\" -e -c %u\" >> " + filename
175
-                            + "irc.protocol");
176
-                    writer.println("echo \"protocol=irc\" >> " + filename
177
-                            + "irc.protocol");
178
-                    writer.println("echo \"input=none\" >> " + filename
179
-                            + "irc.protocol");
180
-                    writer.println("echo \"output=none\" >> " + filename
181
-                            + "irc.protocol");
182
-                    writer.println("echo \"helper=true\" >> " + filename
183
-                            + "irc.protocol");
184
-                    writer.println("echo \"listing=false\" >> " + filename
185
-                            + "irc.protocol");
186
-                    writer.println("echo \"reading=false\" >> " + filename
187
-                            + "irc.protocol");
188
-                    writer.println("echo \"writing=false\" >> " + filename
189
-                            + "irc.protocol");
190
-                    writer.println("echo \"makedir=false\" >> " + filename
191
-                            + "irc.protocol");
192
-                    writer.println("echo \"deleting=false\" >> " + filename
193
-                            + "irc.protocol");
194
-                    writer.println("chmod a+x " + filename + "irc.protocol");
195
-                    writer.println("exit 0;");
196
-                    writer.close();
197
-
198
-                    final File protocolFile = new File(location
199
-                            + "/protocolHandlers.sh");
200
-                    protocolFile.setExecutable(true);
201
-
202
-                    try {
203
-                        final Process gconfProcess = Runtime.getRuntime().exec(
204
-                                new String[] { "/bin/sh",
205
-                                        location + "/protocolHandlers.sh" });
206
-                        new StreamReader(gconfProcess.getInputStream()).start();
207
-                        new StreamReader(gconfProcess.getErrorStream()).start();
208
-                        try {
209
-                            gconfProcess.waitFor();
210
-                        } catch (final InterruptedException e) {
211
-                        }
212
-                        protocolFile.delete();
213
-                    } catch (final SecurityException e) {
214
-                        step.addText(" - Error adding Protocol Handler: "
215
-                                + e.getMessage());
216
-                    } catch (final IOException e) {
217
-                        step.addText(" - Error adding Protocol Handler: "
218
-                                + e.getMessage());
219
-                    }
220
-                    return;
221
-
222
-                default:
223
-                    step
224
-                            .addText(" - Error creating shortcut. Not applicable to this Operating System");
225
-                    return;
226
-            }
227
-            final File outFile = new File(filename);
228
-            if (!outFile.getParentFile().exists()) {
229
-                outFile.getParentFile().mkdir();
230
-            }
231
-            writer = new PrintWriter(outFile);
232
-            writeFile(writer, location);
233
-
234
-            outFile.setExecutable(true);
235
-        } catch (final IOException e) {
236
-            step.addText(" - Error creating shortcut: " + e.toString());
237
-        } catch (final SecurityException e) {
238
-            step.addText(" - Error creating shortcut: " + e.toString());
239
-        } finally {
240
-            if (writer != null) {
241
-                writer.close();
242
-            }
243
-        }
244
-    }
245
-
246
-    /**
247
-     * Write the .desktop file
248
-     * 
249
-     * @param writer
250
-     *            PrintWriter to write to
251
-     * @param location
252
-     *            Location of installed files
253
-     * @throws IOException
254
-     *             if an error occurs when writing
255
-     */
256
-    private void writeFile(final PrintWriter writer, final String location)
257
-            throws IOException {
258
-        writer.println("[Desktop Entry]");
259
-        writer.println("Categories=Network;IRCClient;");
260
-        writer.println("Comment=DMDirc IRC Client");
261
-        writer.println("Encoding=UTF-8");
262
-        // writer.println("Exec=java -jar "+location+"/DMDirc.jar");
263
-        writer.println("Exec=" + location + "/DMDirc.sh");
264
-        writer.println("GenericName=IRC Client");
265
-        writer.println("Icon=" + location + "/icon.svg");
266
-        if (isRoot()) {
267
-            writer.println("Name=DMDirc (Global)");
268
-        } else {
269
-            writer.println("Name=DMDirc");
270
-        }
271
-        writer.println("StartupNotify=true");
272
-        writer.println("Terminal=false");
273
-        writer.println("TerminalOptions=");
274
-        writer.println("Type=Application");
275
-    }
276
-
277
-    /** {@inheritDoc} */
278
-    @Override
279
-    public void postInstall(final String location) {
280
-        new File(location + "/DMDirc.sh").setExecutable(true, !isRoot());
281
-    }
282
-}

+ 0
- 169
src/com/dmdirc/installer/Main.java Ver fichero

@@ -1,169 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import com.dmdirc.installer.cliparser.BooleanParam;
26
-import com.dmdirc.installer.cliparser.CLIParser;
27
-import com.dmdirc.installer.cliparser.StringParam;
28
-import com.dmdirc.installer.ui.InstallerDialog;
29
-import com.dmdirc.installer.ui.StepConfirm;
30
-import com.dmdirc.installer.ui.StepError;
31
-import com.dmdirc.installer.ui.StepInstall;
32
-import com.dmdirc.installer.ui.StepSettings;
33
-import com.dmdirc.installer.ui.StepWelcome;
34
-
35
-/**
36
- * Main installer entry point.
37
- */
38
-public final class Main {
39
-
40
-    /** Wizard dialog. */
41
-    private static InstallerDialog wizardDialog;
42
-    /** Installer. */
43
-    private static Installer myInstaller;
44
-    /** CLI Parser. */
45
-    private static CLIParser cli = CLIParser.getCLIParser();
46
-
47
-    /**
48
-     * Creates and Displays the Installer wizard.
49
-     */
50
-    private Main() {
51
-        try {
52
-            InstallerDialog.initUISettings();
53
-        } catch (UnsupportedOperationException ex) {
54
-            //Ignore, revert to default
55
-        }
56
-
57
-        String releaseName = "DMDirc";
58
-        if (cli.getParamNumber("-release") > 0) {
59
-            releaseName = releaseName + " " + cli.getParam("-release").
60
-                    getStringValue();
61
-        }
62
-
63
-        setWizardFrame(new InstallerDialog(releaseName + " Installer"));
64
-        getWizardFrame().addWizardListener(new InstallerListener(this));
65
-        getWizardFrame().addStepListener(new InstallerListener(this));
66
-
67
-        final String osName = System.getProperty("os.name");
68
-        wizardDialog.addStep(new StepWelcome(releaseName));
69
-        if (osName.startsWith("Mac OS")) {
70
-            wizardDialog.addStep(
71
-                    new StepError(
72
-                    "Sorry, OSX Installation should be done using the downloadable dmg file, not this installer.\n\n"));
73
-        } else {
74
-            if (CLIParser.getCLIParser().getParamNumber("-unattended") == 0) {
75
-                wizardDialog.addStep(new StepSettings());
76
-                wizardDialog.addStep(new StepConfirm());
77
-            }
78
-            wizardDialog.addStep(new StepInstall());
79
-        }
80
-    }
81
-
82
-    /**
83
-     * Disposes of the current installer.
84
-     */
85
-    public void disposeOfInstaller() {
86
-        final Thread temp = myInstaller;
87
-        myInstaller = null;
88
-        if (temp != null) {
89
-            temp.interrupt();
90
-        }
91
-    }
92
-
93
-    /**
94
-     * Get the Installer object for this OS.
95
-     *
96
-     * @return The installer for this OS
97
-     */
98
-    public static synchronized Installer getInstaller() {
99
-        if (myInstaller == null) {
100
-            final String osName = System.getProperty("os.name");
101
-            if (osName.startsWith("Windows")) {
102
-                myInstaller = new WindowsInstaller();
103
-            } else if(!osName.startsWith("Mac OS")) {
104
-                myInstaller = new LinuxInstaller();
105
-            }
106
-        }
107
-
108
-        return myInstaller;
109
-    }
110
-
111
-    /**
112
-     * Setup the cli parser.
113
-     * This clears the current CLIParser params and creates new ones.
114
-     */
115
-    private static void setupCLIParser() {
116
-        cli.clear();
117
-        cli.add(new StringParam('h', "help", "Get Help"));
118
-        cli.setHelp(cli.getParam("-help"));
119
-        cli.add(new BooleanParam((char) 0, "isroot", "Installing as Root"));
120
-        cli.add(new StringParam('r', "release", "Release Name"));
121
-        cli.add(new StringParam('d', "directory", "Default install directory"));
122
-        cli.add(new BooleanParam('u', "unattended",
123
-                                 "Perform an unattended installation"));
124
-        cli.add(new BooleanParam((char) 0, "no-shortcut-desktop",
125
-                                 "Don't offer a desktop shortcut as the default"));
126
-        cli.add(new BooleanParam((char) 0, "no-shortcut-menu",
127
-                                 "Don't offer a menu shortcut as the default"));
128
-        cli.add(new BooleanParam((char) 0, "no-shortcut-quicklaunch",
129
-                                 "Don't offer a quick launch shortcut as the default"));
130
-        cli.add(new BooleanParam((char) 0, "no-shortcut-protocol",
131
-                                 "Don't offer to handle irc:// links as the default"));
132
-    }
133
-
134
-    /**
135
-     * Get the WizardFrame.
136
-     *
137
-     * @return The current wizardDialog
138
-     */
139
-    public static synchronized InstallerDialog getWizardFrame() {
140
-        if (wizardDialog == null) {
141
-            new Main();
142
-        }
143
-        return wizardDialog;
144
-    }
145
-
146
-    /**
147
-     * Set the WizardFrame.
148
-     *
149
-     * @param dialog The new WizardDialog
150
-     */
151
-    private static void setWizardFrame(final InstallerDialog dialog) {
152
-        wizardDialog = dialog;
153
-    }
154
-
155
-    /**
156
-     * Run the installer.
157
-     *
158
-     * @param args Command line arguments
159
-     */
160
-    public static void main(final String[] args) {
161
-        setupCLIParser();
162
-        if (cli.wantsHelp(args)) {
163
-            cli.showHelp("DMDirc installer Help", "[options [--]]");
164
-            System.exit(0);
165
-        }
166
-        cli.parseArgs(args, false);
167
-        getWizardFrame().display();
168
-    }
169
-}

+ 0
- 64
src/com/dmdirc/installer/Settings.java Ver fichero

@@ -1,64 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-/**
26
- * Simple interface describing available settings for the installer.
27
- */
28
-public interface Settings {
29
-
30
-    /**
31
-     * Returns the state of the shortcutMenu checkbox.
32
-     *
33
-     * @return shortcutMenu checkbox state
34
-     */
35
-    boolean getShortcutMenuState();
36
-
37
-    /**
38
-     * Returns the state of the shortcutDesktop checkbox.
39
-     *
40
-     * @return shortcutDesktop checkbox state
41
-     */
42
-    boolean getShortcutDesktopState();
43
-
44
-    /**
45
-     * Returns the state of the shortcutDesktop checkbox.
46
-     *
47
-     * @return shortcutDesktop checkbox state
48
-     */
49
-    boolean getShortcutQuickState();
50
-
51
-    /**
52
-     * Returns the state of the shortcutProtocol checkbox.
53
-     *
54
-     * @return shortcutDesktop checkbox state
55
-     */
56
-    boolean getShortcutProtocolState();
57
-
58
-    /**
59
-     * Returns the location chosen for installation.
60
-     *
61
-     * @return location chosen for installation.
62
-     */
63
-    String getInstallLocation();
64
-}

+ 0
- 53
src/com/dmdirc/installer/Step.java Ver fichero

@@ -1,53 +0,0 @@
1
-/*
2
- * 
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- * 
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- * 
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer;
25
-
26
-import java.awt.Image;
27
-
28
-/**
29
- * Simple step interface.
30
- */
31
-public interface Step {
32
-
33
-    /**
34
-     * Returns the name of this step.
35
-     * 
36
-     * @return Step name
37
-     */
38
-    String getStepName();
39
-    
40
-    /**
41
-     * Returns the description for this step.
42
-     * 
43
-     * @return Step description
44
-     */
45
-    String getStepDescription();
46
-    
47
-    /**
48
-     * Returns the icon for this step.
49
-     * 
50
-     * @return Step icon
51
-     */
52
-    Image getIcon();
53
-}

+ 0
- 44
src/com/dmdirc/installer/StepListener.java Ver fichero

@@ -1,44 +0,0 @@
1
-/*
2
- * 
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- * 
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- * 
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer;
25
-
26
-/**
27
- * Step listeners, listens for changes regarding steps.
28
- */
29
-public interface StepListener {
30
-
31
-    /**
32
-     * Called when a step is about to be displayed.
33
-     * 
34
-     * @param step Step to be displayed
35
-     */
36
-    void stepAboutToDisplay(final Step step);
37
-
38
-    /**
39
-     * Called when a step is hidden.
40
-     * 
41
-     * @param step
42
-     */
43
-    void stepHidden(final Step step);
44
-}

+ 0
- 117
src/com/dmdirc/installer/StreamReader.java Ver fichero

@@ -1,117 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import java.io.BufferedReader;
26
-import java.io.IOException;
27
-import java.io.InputStream;
28
-import java.io.InputStreamReader;
29
-
30
-/**
31
- * Simple stream reader to read a stream and add it to a text step
32
- */
33
-public class StreamReader extends Thread {
34
-
35
-    /** This is the Input Stream we are reading */
36
-    private final InputStream stream;
37
-    /** This is the output Prefix */
38
-    private String prefix = null;
39
-    /** This is the StringBuffer to store data in if wanted */
40
-    private StringBuffer data = null;
41
-    /** This is the Step we are outputting to, */
42
-    private TextStep step = null;
43
-
44
-    /**
45
-     * Create a new Stream Reader
46
-     *
47
-     * @param stream The stream to read
48
-     */
49
-    public StreamReader(final InputStream stream) {
50
-        this.stream = stream;
51
-    }
52
-
53
-    /**
54
-     * Create a new Stream Reader that saves what it reads
55
-     *
56
-     * @param stream The stream to read
57
-     * @param data The stringbuffer to store the output in
58
-     * @since 0.6
59
-     */
60
-    public StreamReader(final InputStream stream, final StringBuffer data) {
61
-        this.stream = stream;
62
-        this.data = data;
63
-    }
64
-
65
-    /**
66
-     * Create a new Stream Reader that outputs what it reads
67
-     *
68
-     * @param stream The stream to read
69
-     * @param prefix Prefix of outputed messages
70
-     * @param step Step to output to (null = console)
71
-     */
72
-    public StreamReader(final InputStream stream, final String prefix,
73
-                        final TextStep step) {
74
-        this.stream = stream;
75
-        this.prefix = prefix;
76
-        this.step = step;
77
-
78
-        if (step == null) {
79
-            System.out.printf("[%s] Started%n", prefix);
80
-        } else {
81
-            step.addText(String.format(" - -[%s] Started", prefix));
82
-        }
83
-    }
84
-
85
-    /** {@inheritDoc} */
86
-    @Override
87
-    public void run() {
88
-        final BufferedReader reader = new BufferedReader(new InputStreamReader(
89
-                stream));
90
-        try {
91
-            String line;
92
-            while ((line = reader.readLine()) != null) {
93
-                if (data != null) {
94
-                    if (data.length() > 0) {
95
-                        data.append('\n');
96
-                    }
97
-                    data.append(line);
98
-                }
99
-                if (prefix != null) {
100
-                    if (step == null) {
101
-                        System.out.printf("[%s] %s%n", prefix, line);
102
-                    } else {
103
-                        step.addText(String.format(" - -[%s] %s", prefix, line));
104
-                    }
105
-                }
106
-            }
107
-        } catch (IOException e) {
108
-            e.printStackTrace();
109
-        } finally {
110
-            try {
111
-                stream.close();
112
-            } catch (IOException e) {
113
-                e.printStackTrace();
114
-            }
115
-        }
116
-    }
117
-}

+ 0
- 44
src/com/dmdirc/installer/TextStep.java Ver fichero

@@ -1,44 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-/**
26
- * Quick access methods for a step to have a controllable text field.
27
- */
28
-public interface TextStep {
29
-
30
-    /**
31
-     * Add text to the infolabel on this step
32
-     *
33
-     * @param text Text to add to infoLabel
34
-     */
35
-    void addText(final String text);
36
-
37
-    /**
38
-     * Sets the text in the infolabel on this step
39
-     *
40
-     * @param text Text to set the infoLabel to
41
-     */
42
-    void setText(final String text);
43
-
44
-}

+ 0
- 337
src/com/dmdirc/installer/WindowsInstaller.java Ver fichero

@@ -1,337 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-import com.dmdirc.installer.cliparser.CLIParser;
26
-
27
-import java.io.File;
28
-import java.io.IOException;
29
-import java.util.ArrayList;
30
-
31
-/**
32
- * Installs DMDirc on windows
33
- *
34
- * @author Shane Mc Cormack
35
- */
36
-public class WindowsInstaller extends Installer {
37
-
38
-    /** {@inheritDoc} */
39
-    @Override
40
-    public String defaultInstallLocation() {
41
-        String result = "";
42
-        if (CLIParser.getCLIParser().getParamNumber("-directory") > 0) {
43
-            result = CLIParser.getCLIParser().getParam("-directory")
44
-                    .getStringValue();
45
-        }
46
-        if (result.isEmpty()) {
47
-            String filename = System.getenv("PROGRAMFILES");
48
-            if (filename == null) {
49
-                if (isVista()) {
50
-                    filename = System.getProperty("user.home")
51
-                            + "\\Desktop\\DMDirc";
52
-                } else {
53
-                    filename = "C:\\Program Files";
54
-                }
55
-            }
56
-            result = filename + "\\DMDirc";
57
-        }
58
-        return result;
59
-    }
60
-
61
-    /** {@inheritDoc} */
62
-    @Override
63
-    public boolean validFile(final String filename) {
64
-        return !filename.equalsIgnoreCase("setup.exe")
65
-                && !filename.equalsIgnoreCase("jre.exe")
66
-                && !filename.equalsIgnoreCase("wget.exe")
67
-                && !filename.equalsIgnoreCase("wgetoutput")
68
-                && !filename.equalsIgnoreCase("shortcut.exe");
69
-    }
70
-
71
-    /**
72
-     * Are we running vista? -_-
73
-     *
74
-     * @return True if this is vista.
75
-     */
76
-    public boolean isVista() {
77
-        return System.getProperty("os.name").indexOf("Vista") >= 0;
78
-    }
79
-
80
-    /**
81
-     * Are we running NT?
82
-     *
83
-     * @return True if this is NT.
84
-     */
85
-    public boolean isNT() {
86
-        final String osName = System.getProperty("os.name");
87
-        return osName.indexOf("NT") >= 0 || osName.indexOf("2000") >= 0
88
-                || osName.indexOf("2003") >= 0 || osName.indexOf("XP") >= 0;
89
-    }
90
-
91
-    /** {@inheritDoc} */
92
-    @Override
93
-    public boolean supportsShortcut(final ShortcutType shortcutType) {
94
-        switch (shortcutType) {
95
-            case QUICKLAUNCH:
96
-                // Only windows 95 doesn't have quick launch
97
-                return !(System.getProperty("os.name").indexOf("95") >= 0);
98
-            case DESKTOP:
99
-            case MENU:
100
-            case UNINSTALLER:
101
-            case PROTOCOL:
102
-                // All versions of windows have desktop, menu, uninstaller and
103
-                // protocol
104
-                return true;
105
-            default:
106
-                // Anything else that gets added should be false until the
107
-                // relevent
108
-                // code is added
109
-                return false;
110
-        }
111
-    }
112
-
113
-    /** {@inheritDoc} */
114
-    @Override
115
-    public String getMenuName() {
116
-        return "Start menu";
117
-    }
118
-
119
-    /**
120
-     * Add a registry key.
121
-     *
122
-     * @param key
123
-     *            Key to add.
124
-     */
125
-    public void addRegistryKey(final String key) {
126
-        step.addText(" - Adding Key: " + key);
127
-        final String[] addKey = new String[] { "reg.exe", "add", key, "/f" };
128
-        execAndWait(addKey);
129
-    }
130
-
131
-    /**
132
-     * Modify a registry value.
133
-     *
134
-     * @param key
135
-     *            Key to use.
136
-     * @param value
137
-     *            Value to modify.
138
-     * @param data
139
-     *            Data for key.
140
-     */
141
-    public void editRegistryValue(final String key, final String value,
142
-            final String data) {
143
-        editRegistryValue(key, value, "REG_SZ", data);
144
-    }
145
-
146
-    /**
147
-     * Modify a registry value.
148
-     *
149
-     * @param key
150
-     *            Key to use.
151
-     * @param value
152
-     *            Value to modify.
153
-     * @param type
154
-     *            Type of data.
155
-     * @param data
156
-     *            Data for key.
157
-     */
158
-    public void editRegistryValue(final String key, final String value,
159
-            final String type, final String data) {
160
-        final ArrayList<String> params = new ArrayList<String>();
161
-        step.addText(" - Editing value: " + key + "\\" + value);
162
-        params.add("reg.exe");
163
-        params.add("add");
164
-        params.add(key);
165
-        params.add("/f");
166
-        if (value.isEmpty()) {
167
-            params.add("/ve");
168
-        } else {
169
-            params.add("/v");
170
-            params.add(value);
171
-        }
172
-        params.add("/t");
173
-        params.add(type);
174
-        if (!data.isEmpty()) {
175
-            params.add("/d");
176
-            params.add(data);
177
-        }
178
-
179
-        execAndWait(params.toArray(new String[params.size()]));
180
-    }
181
-
182
-    /**
183
-     * Execute and wait for the requested command
184
-     *
185
-     * @param cmd
186
-     *            Command array to execute/
187
-     * @return return value from command, or -1 if there was an error.
188
-     */
189
-    private int execAndWait(final String[] cmd) {
190
-        try {
191
-            final Process myProcess = Runtime.getRuntime().exec(cmd);
192
-            new StreamReader(myProcess.getInputStream()).start();
193
-            new StreamReader(myProcess.getErrorStream()).start();
194
-            try {
195
-                myProcess.waitFor();
196
-            } catch (final InterruptedException e) {
197
-                //Ignore, handled below
198
-            }
199
-            if (myProcess.exitValue() != 0) {
200
-                step.addText("\t - Error: Unknown Reason");
201
-            }
202
-            return myProcess.exitValue();
203
-        } catch (final SecurityException e) {
204
-            step.addText("\t - Error: " + e.getMessage());
205
-        } catch (final IOException e) {
206
-            step.addText("\t - Error: " + e.getMessage());
207
-        }
208
-
209
-        return -1;
210
-    }
211
-
212
-    /** {@inheritDoc} */
213
-    @Override
214
-    public void setupShortcut(final String location,
215
-            final ShortcutType shortcutType) {
216
-        // Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
217
-
218
-        if (!supportsShortcut(shortcutType)) {
219
-            step
220
-                    .addText(" - Error creating shortcut. Not applicable to this Operating System");
221
-            return;
222
-        }
223
-
224
-        if (new File("Shortcut.exe").exists()) {
225
-            String filename = "";
226
-            File dir;
227
-
228
-            switch (shortcutType) {
229
-                case DESKTOP:
230
-                    if (isNT() || isVista()) {
231
-                        filename = System.getProperty("user.home")
232
-                                + "\\Desktop";
233
-                    } else {
234
-                        filename = System.getenv("WINDIR") + "\\Desktop";
235
-                    }
236
-                    break;
237
-
238
-                case MENU:
239
-                    if (isVista()) {
240
-                        filename = System.getenv("APPDATA")
241
-                                + "\\Microsoft\\Windows";
242
-                    } else {
243
-                        filename = System.getProperty("user.home");
244
-                    }
245
-                    filename += "\\Start Menu\\Programs\\DMDirc";
246
-                    break;
247
-
248
-                case QUICKLAUNCH:
249
-                    if (isVista()) {
250
-                        filename = System.getProperty("user.home")
251
-                                + "\\AppData\\Roaming\\Microsoft\\Internet Explorer\\Quick Launch";
252
-                    } else {
253
-                        filename = System.getProperty("user.home")
254
-                                + "\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch";
255
-                    }
256
-                    break;
257
-
258
-                case UNINSTALLER:
259
-                    // Registry hax!
260
-                    final String key = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DMDirc";
261
-                    addRegistryKey(key);
262
-                    editRegistryValue(key, "Comments", "DMDirc IRC Client");
263
-                    editRegistryValue(key, "DisplayName", "DMDirc IRC Client");
264
-                    editRegistryValue(key, "DisplayIcon", location
265
-                            + "\\icon.ico");
266
-                    editRegistryValue(key, "UninstallString", location
267
-                            + "\\Uninstaller.exe");
268
-                    editRegistryValue(key, "Publisher", "DMDirc.com");
269
-                    editRegistryValue(key, "URLInfoAbout",
270
-                            "http://www.DMDirc.com/");
271
-                    editRegistryValue(key, "URLUpdateInfo",
272
-                            "http://www.DMDirc.com/");
273
-                    editRegistryValue(key, "InstallDir", location);
274
-                    editRegistryValue(key, "InstalledTime", String
275
-                            .valueOf(System.currentTimeMillis()));
276
-                    return;
277
-
278
-                case PROTOCOL:
279
-                    // Add needed keys.
280
-                    addRegistryKey("HKCR\\irc");
281
-                    addRegistryKey("HKCR\\irc\\DefaultIcon");
282
-                    addRegistryKey("HKCR\\irc\\Shell");
283
-                    addRegistryKey("HKCR\\irc\\Shell\\open");
284
-                    addRegistryKey("HKCR\\irc\\Shell\\open\\command");
285
-                    // Now the values
286
-                    editRegistryValue("HKCR\\irc", "", "URL:IRC Protocol");
287
-                    editRegistryValue("HKCR\\irc", "URL Protocol", "");
288
-                    editRegistryValue("HKCR\\irc", "EditFlags", "REG_BINARY",
289
-                            "02000000");
290
-                    editRegistryValue("HKCR\\irc\\DefaultIcon", "", location
291
-                            + "\\icon.ico");
292
-                    editRegistryValue("HKCR\\irc\\Shell\\open\\command", "",
293
-                            "\\\"" + location + "\\DMDirc.exe\\\" -e -c %1");
294
-                    return;
295
-
296
-                default:
297
-                    step
298
-                            .addText(" - Error creating shortcut. Not applicable to this Operating System");
299
-                    return;
300
-            }
301
-
302
-            if (filename.length() == 0) {
303
-                step
304
-                        .addText(" - Error creating shortcut. Not applicable to this System");
305
-                return;
306
-            }
307
-
308
-            // Check the dir exists
309
-            dir = new File(filename);
310
-            if (!dir.exists()) {
311
-                dir.mkdir();
312
-            }
313
-
314
-            // Delete an older shortcut
315
-            final File oldFile = new File(filename + "\\DMDirc.lnk");
316
-            if (oldFile.exists()) {
317
-                oldFile.delete();
318
-            }
319
-
320
-            // final String thisDirName = new File("").getAbsolutePath();
321
-            final String[] command = new String[] {
322
-                    // thisDirName+"/Shortcut.exe",
323
-                    "Shortcut.exe",
324
-                    "/F:" + filename + "\\DMDirc.lnk",
325
-                    "/A:C",
326
-                    // "/T:"+location+"\\DMDirc.bat",
327
-                    // "/T:javaw.exe",
328
-                    // "/P:-jar DMDirc.jar",
329
-                    "/T:" + location + "\\DMDirc.exe", "/W:" + location,
330
-                    "/I:" + location + "\\icon.ico", "/D:DMDirc IRC Client" };
331
-            execAndWait(command);
332
-        } else {
333
-            step
334
-                    .addText(" - Error creating shortcut: Unable to find Shortcut.exe");
335
-        }
336
-    }
337
-}

+ 0
- 39
src/com/dmdirc/installer/WizardListener.java Ver fichero

@@ -1,39 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer;
24
-
25
-/**
26
- * Wizard interface, notifications on change of step and closing.
27
- */
28
-public interface WizardListener {
29
-    
30
-    /** 
31
-     * Called when the wizard finishes. 
32
-     */
33
-    void wizardFinished();
34
-    
35
-    /**
36
-     * Called when the wizard is cancelled.
37
-     */
38
-    void wizardCancelled();
39
-}

+ 0
- 93
src/com/dmdirc/installer/cliparser/BooleanParam.java Ver fichero

@@ -1,93 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Shane Mc Cormack
3
- * 
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- * 
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- * 
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.cliparser;
24
-
25
-/**
26
- * Command Line argument type.
27
- */
28
-public class BooleanParam extends CLIParam {
29
-    /** The value of this param. */
30
-    private boolean myValue = false;
31
-
32
-    /**
33
-     * Create a new BooleanParam.
34
-     * 
35
-     * @param chr
36
-     *            Single Character flag for this param.
37
-     * @param str
38
-     *            String flag for this param.
39
-     * @param desc
40
-     *            Description of this flag.
41
-     */
42
-    public BooleanParam(final char chr, final String str, final String desc) {
43
-        super(chr, str, desc);
44
-    }
45
-
46
-    /**
47
-     * Set the value of this param to the value given by a string.
48
-     * 
49
-     * @param value
50
-     *            String taken from command line to use as value.
51
-     * @return true if value was valid, else false.
52
-     */
53
-    @Override
54
-    public boolean setValue(final String value) {
55
-        // if no value, or an empty value is given, toggle the value
56
-        if (value == null || value.isEmpty()) {
57
-            myValue = !myValue;
58
-            return true;
59
-            // Check if value is a word that means "true"
60
-        } else if (value.equals("1") || value.equalsIgnoreCase("true")
61
-                || value.equalsIgnoreCase("yes")) {
62
-            myValue = true;
63
-            return true;
64
-            // Check if value is a word that means "false"
65
-        } else if (value.equals("0") || value.equalsIgnoreCase("false")
66
-                || value.equalsIgnoreCase("no")) {
67
-            myValue = false;
68
-            return true;
69
-            // The value is not a valid boolean value.
70
-        } else {
71
-            return false;
72
-        }
73
-    }
74
-
75
-    /**
76
-     * Get the value of this param.
77
-     * 
78
-     * @return Value of this parameter
79
-     */
80
-    public boolean getValue() {
81
-        return myValue;
82
-    }
83
-
84
-    /**
85
-     * Return the value of this param as a string.
86
-     * 
87
-     * @return The value of this param as a string.
88
-     */
89
-    @Override
90
-    public String getStringValue() {
91
-        return String.valueOf(getValue());
92
-    }
93
-}

+ 0
- 91
src/com/dmdirc/installer/cliparser/CLIParam.java Ver fichero

@@ -1,91 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Shane Mc Cormack
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.cliparser;
24
-
25
-/**
26
- * Command Line argument type.
27
- */
28
-public abstract class CLIParam {
29
-
30
-    /** Single Character flag for this param. */
31
-    private final char charFlag;
32
-    /** String flag for this param. */
33
-    private final String stringFlag;
34
-    /** Description of this flag. */
35
-    private final String description;
36
-    /** Number of times this param has been given. */
37
-    private int number;
38
-
39
-    /**
40
-     * Create a new CLIParam.
41
-     *
42
-     * @param chr Single Character flag for this param.
43
-     * @param str String flag for this param.
44
-     * @param desc Description of this flag.
45
-     */
46
-    protected CLIParam(final char chr, final String str, final String desc) {
47
-        charFlag = chr;
48
-        stringFlag = str;
49
-        description = desc;
50
-    }
51
-
52
-    /**
53
-     * Get the single character flag for this param.
54
-     */
55
-    public final char getChr() { return charFlag; }
56
-
57
-    /**
58
-     * Get the string flag for this param.
59
-     */
60
-    public final String getString() { return stringFlag; }
61
-
62
-    /**
63
-     * Get the description for this param.
64
-     */
65
-    public final String getDescription() { return description; }
66
-
67
-    /**
68
-     * Get the number of times this value has been given.
69
-     */
70
-    public final int getNumber() { return number; }
71
-
72
-    /**
73
-     * Increment the number of times this value has been given.
74
-     */
75
-    public final void incNumber() { ++number; }
76
-
77
-    /**
78
-     * Set the value of this param to the value given by a string.
79
-     *
80
-     * @param value String taken from command line to use as value.
81
-     * @return true if value was valid, else false.
82
-     */
83
-    public abstract boolean setValue(final String value);
84
-
85
-    /**
86
-     * Return the value of this param as a string.
87
-     *
88
-     * @return The value of this param as a string.
89
-     */
90
-    public abstract String getStringValue();
91
-}

+ 0
- 274
src/com/dmdirc/installer/cliparser/CLIParser.java Ver fichero

@@ -1,274 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Shane Mc Cormack
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.cliparser;
24
-
25
-import java.util.ArrayList;
26
-import java.util.HashMap;
27
-import java.util.List;
28
-import java.util.Map;
29
-
30
-/**
31
- * Command Line argument parser.
32
- */
33
-public class CLIParser {
34
-    /** Singleton instance of CLIParser. */
35
-    private static CLIParser me;
36
-
37
-    /** Singleton instance of CLIParser. */
38
-    CLIParam helpParam = null;
39
-
40
-    /**
41
-     * Known arguments.
42
-     * This hashtable stores the arguments with their flags as the key.
43
-     */
44
-    private final Map<String, CLIParam> params = new HashMap<String, CLIParam>();
45
-
46
-    /**
47
-     * Known arguments.
48
-     * This ArrayList stores every param type. (used for help)
49
-     */
50
-    private final List<CLIParam> paramList = new ArrayList<CLIParam>();
51
-
52
-    /**
53
-     * Redundant Strings.
54
-     * This ArrayList stores redundant strings found whilst parsing the params.
55
-     */
56
-    private final List<String> redundant = new ArrayList<String>();
57
-
58
-    /**
59
-     * Get a reference to the CLIParser.
60
-     *
61
-     * @return CLI parser instance
62
-     */
63
-    public static synchronized CLIParser getCLIParser() {
64
-        if (me == null) {
65
-            me = new CLIParser();
66
-        }
67
-        return me;
68
-    }
69
-
70
-    /** Private constructor for CLIParser to prevent non-singleton instance. */
71
-    private CLIParser() {
72
-    }
73
-
74
-    /** Clear known params from the hashtable. */
75
-    public void clear() {
76
-        params.clear();
77
-        paramList.clear();
78
-        redundant.clear();
79
-    }
80
-
81
-    /**
82
-     * Add a CLIParam to the cliparser.
83
-     *
84
-     * @param param
85
-     *            CLIParam sub-class to use as a parameter.
86
-     * @return true if added, false if already exists.
87
-     */
88
-    public boolean add(final CLIParam param) {
89
-        final boolean validChar = param.getChr() == 0
90
-                || !params.containsKey(String.valueOf(param.getChr()));
91
-        final boolean validString = param.getString().isEmpty()
92
-                || !params.containsKey("-" + param.getString());
93
-        if (validChar && validString) {
94
-            if (param.getChr() != 0) {
95
-                params.put(String.valueOf(param.getChr()), param);
96
-            }
97
-            if (!param.getString().isEmpty()) {
98
-                params.put("-" + param.getString(), param);
99
-            }
100
-            paramList.add(param);
101
-            return true;
102
-        } else {
103
-            return false;
104
-        }
105
-    }
106
-
107
-    /**
108
-     * Get the number of times a param was given.
109
-     * In the case of params with both a char and string value, this number is
110
-     * the total for both.
111
-     *
112
-     * @param flag
113
-     *            Flag to get count for
114
-     * @return number, or -1 if the param is invalud
115
-     */
116
-    public int getParamNumber(final String flag) {
117
-        if (params.containsKey(flag)) {
118
-            return params.get(flag).getNumber();
119
-        } else {
120
-            return -1;
121
-        }
122
-    }
123
-
124
-    /**
125
-     * Get a CLIParam object for a given flag.
126
-     *
127
-     * @param flag
128
-     *            Flag to get param for
129
-     * @return CLIParam object, or null if there is none.
130
-     */
131
-    public CLIParam getParam(final String flag) {
132
-        if (params.containsKey(flag)) {
133
-            return params.get(flag);
134
-        } else {
135
-            return null;
136
-        }
137
-    }
138
-
139
-    /**
140
-     * Get the list of params.
141
-     *
142
-     * @return list of params.
143
-     */
144
-    public List<CLIParam> getParamList() {
145
-        return paramList;
146
-    }
147
-
148
-    /**
149
-     * Get the list of redundant strings.
150
-     *
151
-     * @return list of redundant strings.
152
-     */
153
-    public List<String> getRedundant() {
154
-        final List<String> result = new ArrayList<String>();
155
-        for (final String item : redundant) {
156
-            result.add(item);
157
-        }
158
-        return result;
159
-    }
160
-
161
-    /**
162
-     * Set the "help" command.
163
-     *
164
-     * @param param
165
-     *            Param to look for in wantsHelp.
166
-     */
167
-    public void setHelp(final CLIParam param) {
168
-        helpParam = param;
169
-    }
170
-
171
-    /**
172
-     * Check if the help parameter has been passed to the CLI.
173
-     *
174
-     * @param args Command line arguments to parse
175
-     *
176
-     * @return true iif help param is passed
177
-     */
178
-    public boolean wantsHelp(final String[] args) {
179
-        if (helpParam == null) {
180
-            return false;
181
-        }
182
-        for (final String arg : args) {
183
-            if (arg.length() > 1 && arg.charAt(0) == '-') {
184
-                final String name = arg.substring(1);
185
-                if (name.equals("-")) {
186
-                    return false;
187
-                } else {
188
-                    final CLIParam param = getParam(name);
189
-                    if (param == helpParam) {
190
-                        return true;
191
-                    }
192
-                }
193
-            }
194
-        }
195
-        return false;
196
-    }
197
-
198
-    /**
199
-     * Show the help
200
-     */
201
-    public void showHelp(final String title, final String usage) {
202
-        System.out.println(title);
203
-        System.out.println("------------------");
204
-        System.out.println(usage);
205
-        System.out.println(" ");
206
-        for (final CLIParam param : getParamList()) {
207
-            if (param.getChr() == 0) {
208
-                System.out.print("   ");
209
-            } else {
210
-                System.out.print("-" + param.getChr() + " ");
211
-            }
212
-            if (param.getString().isEmpty()) {
213
-                System.out.print("\t\t");
214
-            } else {
215
-                System.out.print("--" + param.getString() + " ");
216
-            }
217
-            System.out.println("\t" + param.getDescription());
218
-        }
219
-    }
220
-
221
-    /**
222
-     * Given a string array of arguments, parse as CLI Params.
223
-     *
224
-     * @param args
225
-     *            Arguments to pass
226
-     * @param strict
227
-     *            if True, will terminate if a given param is invalid.
228
-     */
229
-    public void parseArgs(final String[] args, final boolean strict) {
230
-        CLIParam lastParam = null;
231
-        boolean allRedundant = false;
232
-        for (String arg : args) {
233
-            if (arg.length() > 1 && arg.charAt(0) == '-' && !allRedundant) {
234
-                if (lastParam != null) {
235
-                    lastParam.setValue("");
236
-                }
237
-                final String name = arg.substring(1);
238
-                if (name.equals("-")) {
239
-                    allRedundant = true;
240
-                } else {
241
-                    lastParam = getParam(name);
242
-                    if (lastParam == null) {
243
-                        System.out.println("Unknown Param: -" + name);
244
-                        if (helpParam != null) {
245
-                            String command = "";
246
-                            if (helpParam.getString().isEmpty()) {
247
-                                command = String.valueOf(helpParam.getChr());
248
-                            } else if (helpParam.getChr() != 0) {
249
-                                command = helpParam.getString();
250
-                            }
251
-                            if (!command.isEmpty()) {
252
-                                System.out.println("Use " + command
253
-                                        + " to get help.");
254
-                            }
255
-                        }
256
-                        if (strict) {
257
-                            System.exit(1);
258
-                        }
259
-                    } else {
260
-                        lastParam.incNumber();
261
-                    }
262
-                }
263
-            } else {
264
-                if (arg.charAt(0) == '\\' && arg.length() > 1) {
265
-                    arg = arg.substring(1);
266
-                }
267
-                if (lastParam == null || allRedundant
268
-                        || !lastParam.setValue(arg)) {
269
-                    redundant.add(arg);
270
-                }
271
-            }
272
-        }
273
-    }
274
-}

+ 0
- 81
src/com/dmdirc/installer/cliparser/IntegerParam.java Ver fichero

@@ -1,81 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Shane Mc Cormack
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.cliparser;
24
-
25
-/**
26
- * Command Line argument type.
27
- */
28
-public class IntegerParam extends CLIParam {
29
-    /** The value of this param. */
30
-    private int myValue = 0;
31
-
32
-    /**
33
-     * Create a new IntegerParam.
34
-     *
35
-     * @param chr
36
-     *            Single Character flag for this param.
37
-     * @param str
38
-     *            String flag for this param.
39
-     * @param desc
40
-     *            Description of this flag.
41
-     */
42
-    public IntegerParam(final char chr, final String str, final String desc) {
43
-        super(chr, str, desc);
44
-    }
45
-
46
-    /**
47
-     * Set the value of this param to the value given by a string.
48
-     *
49
-     * @param value
50
-     *            String taken from command line to use as value.
51
-     * @return true if value was valid, else false.
52
-     */
53
-    @Override
54
-    public boolean setValue(final String value) {
55
-        try {
56
-            myValue = Integer.parseInt(value);
57
-            return true;
58
-        } catch (final NumberFormatException nfe) {
59
-            return false;
60
-        }
61
-    }
62
-
63
-    /**
64
-     * Get the value of this param.
65
-     *
66
-     * @return Value of this parameter
67
-     */
68
-    public int getValue() {
69
-        return myValue;
70
-    }
71
-
72
-    /**
73
-     * Return the value of this param as a string.
74
-     *
75
-     * @return The value of this param as a string.
76
-     */
77
-    @Override
78
-    public String getStringValue() {
79
-        return "" + getValue();
80
-    }
81
-}

+ 0
- 72
src/com/dmdirc/installer/cliparser/StringParam.java Ver fichero

@@ -1,72 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Shane Mc Cormack
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.cliparser;
24
-
25
-/**
26
- * Command Line argument type.
27
- */
28
-public class StringParam extends CLIParam {
29
-
30
-    /** The value of this param. */
31
-    private String myValue = "";
32
-
33
-    /**
34
-    * Create a new StringParam.
35
-    *
36
-    * @param chr Single Character flag for this param.
37
-    * @param str String flag for this param.
38
-    * @param desc Description of this flag.
39
-    */
40
-    public StringParam(final char chr, final String str, final String desc) {
41
-        super(chr, str, desc);
42
-    }
43
-
44
-    /**
45
-    * Set the value of this param to the value given by a string.
46
-    *
47
-    * @param value String taken from command line to use as value.
48
-    * @return true if value was valid, else false.
49
-    */
50
-    public boolean setValue(final String value) {
51
-        myValue = value;
52
-        return true;
53
-    }
54
-
55
-    /**
56
-    * Get the value of this param.
57
-    *
58
-    * @return Value of this parameter
59
-    */
60
-    public String getValue() {
61
-        return myValue;
62
-    }
63
-
64
-    /**
65
-    * Return the value of this param as a string.
66
-    *
67
-    * @return The value of this param as a string.
68
-    */
69
-    public String getStringValue() {
70
-        return getValue();
71
-    }
72
-}

+ 0
- 101
src/com/dmdirc/installer/ui/EtchedLineBorder.java Ver fichero

@@ -1,101 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- * 
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- * 
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import java.awt.Component;
26
-import java.awt.Graphics;
27
-
28
-import javax.swing.border.EtchedBorder;
29
-
30
-import static com.dmdirc.installer.ui.InstallerDialog.SMALL_GAP;
31
-
32
-/**
33
- * An etched line border.
34
- */
35
-class EtchedLineBorder extends EtchedBorder {
36
-
37
-    /**
38
-     * A version number for this class. It should be changed whenever the class
39
-     * structure is changed (or anything else that would prevent serialized
40
-     * objects being unserialized with the new class).
41
-     */
42
-    private static final long serialVersionUID = 1;
43
-    /** Border side. */
44
-    private final BorderSide side;
45
-
46
-    /** Border side. */
47
-    public enum BorderSide {
48
-
49
-        /** Creates a border at the top. */
50
-        TOP,
51
-        /** Creates a border at the bottom. */
52
-        BOTTOM,
53
-    };
54
-
55
-    /**
56
-     * Creates a new etched line border.
57
-     * 
58
-     * @param type Etch type
59
-     * @param side Border side
60
-     */
61
-    public EtchedLineBorder(final int type, final BorderSide side) {
62
-        super(type);
63
-
64
-        this.side = side;
65
-    }
66
-
67
-    /** {@inheritDoc} */
68
-    @Override
69
-    public void paintBorder(final Component c, final Graphics g, final int x,
70
-                            final int y, final int width, final int height) {
71
-        g.translate(x, y);
72
-
73
-        g.setColor(
74
-                etchType == LOWERED ? getShadowColor(c) : getHighlightColor(c));
75
-        switch (side) {
76
-            case TOP:
77
-                g.drawLine(-SMALL_GAP, -SMALL_GAP, width + SMALL_GAP, -SMALL_GAP);
78
-                break;
79
-            case BOTTOM:
80
-                g.drawLine(-SMALL_GAP, height + SMALL_GAP, width + SMALL_GAP, height + SMALL_GAP);
81
-                break;
82
-            default:
83
-                break;
84
-        }
85
-
86
-        g.setColor(
87
-                etchType == LOWERED ? getHighlightColor(c) : getShadowColor(c));
88
-        switch (side) {
89
-            case TOP:
90
-                g.drawLine(-SMALL_GAP, -SMALL_GAP - 1, width + SMALL_GAP, -SMALL_GAP - 1);
91
-                break;
92
-            case BOTTOM:
93
-                g.drawLine(-SMALL_GAP, height + SMALL_GAP - 1, width + SMALL_GAP, height + SMALL_GAP - 1);
94
-                break;
95
-            default:
96
-                break;
97
-        }
98
-
99
-        g.translate(-x, -y);
100
-    }
101
-}

+ 0
- 371
src/com/dmdirc/installer/ui/InstallerDialog.java Ver fichero

@@ -1,371 +0,0 @@
1
-/*
2
- *
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer.ui;
25
-
26
-import com.dmdirc.installer.Step;
27
-import com.dmdirc.installer.StepListener;
28
-import com.dmdirc.installer.WizardListener;
29
-import com.dmdirc.ui.CoreUIUtils;
30
-import com.dmdirc.util.ListenerList;
31
-
32
-import java.awt.BorderLayout;
33
-import java.awt.Dimension;
34
-import java.awt.Toolkit;
35
-import java.awt.event.ActionEvent;
36
-import java.awt.event.ActionListener;
37
-import java.awt.event.WindowAdapter;
38
-import java.awt.event.WindowEvent;
39
-import java.util.ArrayList;
40
-import java.util.List;
41
-
42
-import javax.swing.BorderFactory;
43
-import javax.swing.JFrame;
44
-import javax.swing.JOptionPane;
45
-import javax.swing.UIManager;
46
-import javax.swing.UnsupportedLookAndFeelException;
47
-
48
-/**
49
- * Installer dialog, showing the steps required to install DMDirc.
50
- */
51
-public class InstallerDialog extends JFrame implements ActionListener {
52
-
53
-    private static final long serialVersionUID = -2001827768443747849L;
54
-    private final TitlePanel title;
55
-    private final WizardPanel wizard;
56
-    private final WizardControlPanel control;
57
-    private final ListenerList listeners;
58
-    /** Small UI Gap. */
59
-    public static final int SMALL_GAP = 5;
60
-
61
-    /**
62
-     * Instantiates a new installer dialog
63
-     *
64
-     * @param dialogTitle
65
-     */
66
-    public InstallerDialog(final String dialogTitle) {
67
-        super(dialogTitle);
68
-        title = new TitlePanel(null);
69
-        wizard = new WizardPanel(this);
70
-        control = new WizardControlPanel();
71
-        listeners = new ListenerList();
72
-
73
-        setLayout(new BorderLayout(SMALL_GAP, SMALL_GAP));
74
-
75
-
76
-        title.setBorder(BorderFactory.createCompoundBorder(
77
-                BorderFactory.createEmptyBorder(SMALL_GAP, SMALL_GAP, SMALL_GAP,
78
-                SMALL_GAP), title.getBorder()));
79
-        wizard.setBorder(BorderFactory.createCompoundBorder(
80
-                BorderFactory.createEmptyBorder(SMALL_GAP, SMALL_GAP, SMALL_GAP,
81
-                SMALL_GAP), wizard.getBorder()));
82
-        control.setBorder(BorderFactory.createCompoundBorder(
83
-                BorderFactory.createEmptyBorder(SMALL_GAP, SMALL_GAP, SMALL_GAP,
84
-                SMALL_GAP), control.getBorder()));
85
-
86
-        add(title, BorderLayout.NORTH);
87
-        add(wizard, BorderLayout.CENTER);
88
-        add(control, BorderLayout.SOUTH);
89
-
90
-        setIconImage(Toolkit.getDefaultToolkit().createImage(Thread.
91
-                currentThread().getContextClassLoader().getResource(
92
-                "com/dmdirc/res/icon.png")));
93
-        setPreferredSize(new Dimension(400, 350));
94
-        setMaximumSize(new Dimension(400, 350));
95
-
96
-        control.getPrevButton().addActionListener(this);
97
-        control.getNextButton().addActionListener(this);
98
-    }
99
-
100
-    /**
101
-     * Adds a step.
102
-     *
103
-     * @param step Step to add
104
-     */
105
-    public void addStep(final SwingStep step) {
106
-        wizard.addStep(step);
107
-    }
108
-
109
-    /**
110
-     * Displays the installer.
111
-     */
112
-    public void display() {
113
-        wizard.display();
114
-        title.setStep(wizard.getCurrentStep());
115
-        control.setTotal(wizard.getTotalSteps());
116
-        control.setProgress(wizard.getCurrentStepIndex());
117
-        addWindowListener(new WindowAdapter() {
118
-
119
-            /** {@inheritDoc} */
120
-            @Override
121
-            public void windowClosing(final WindowEvent e) {
122
-                fireWizardCancelled();
123
-            }
124
-        });
125
-
126
-        pack();
127
-        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
128
-        CoreUIUtils.centreWindow(this);
129
-        setVisible(true);
130
-        fireStepAboutToBeDisplayed(wizard.getStep(wizard.getCurrentStepIndex()));
131
-    }
132
-
133
-    /**
134
-     * Displays the installer with these steps added.
135
-     *
136
-     * @param steps Steps to add
137
-     */
138
-    public void display(final List<Step> steps) {
139
-        final List<SwingStep> swingSteps = new ArrayList<SwingStep>();
140
-        for (Step step : steps) {
141
-            if (step instanceof SwingStep) {
142
-                swingSteps.add((SwingStep) step);
143
-            }
144
-        }
145
-        display();
146
-    }
147
-
148
-    /**
149
-     * Enables the next step.
150
-     *
151
-     * @param enable true to enable false to disable
152
-     */
153
-    public void enableNextStep(final boolean enable) {
154
-        control.getNextButton().setEnabled(enable);
155
-    }
156
-
157
-    /**
158
-     * Enables the previous step.
159
-     *
160
-     * @param enable true to enable false to disable
161
-     */
162
-    public void enablePreviousStep(final boolean enable) {
163
-        control.getPrevButton().setEnabled(enable);
164
-    }
165
-
166
-    /**
167
-     * shows the cancel confirmation.
168
-     *
169
-     * @return true if confirmed
170
-     */
171
-    public boolean showCancelConfirmation() {
172
-        return JOptionPane.showConfirmDialog(this,
173
-                                             "Are you sure you want to cancel?",
174
-                                             "Cancel confirmation",
175
-                                             JOptionPane.YES_NO_OPTION,
176
-                                             JOptionPane.WARNING_MESSAGE) ==
177
-               JOptionPane.YES_OPTION;
178
-    }
179
-
180
-    /**
181
-     * Gets the specified step for the installer.
182
-     *
183
-     * @param step Index of the step
184
-     *
185
-     * @return Requested step
186
-     */
187
-    public Step getStep(final int step) {
188
-        return wizard.getStep(step);
189
-    }
190
-
191
-    /**
192
-     * Gets the specified step for the installer.
193
-     *
194
-     * @param name Name of the step
195
-     *
196
-     * @return Requested step
197
-     */
198
-    public Step getStep(final String name) {
199
-        return wizard.getStep(name);
200
-    }
201
-
202
-    /**
203
-     * Returns the current step.
204
-     *
205
-     * @return Current step
206
-     */
207
-    public Step getCurrentStep() {
208
-        return wizard.getCurrentStep();
209
-    }
210
-
211
-    /**
212
-     * Returns the index of the current step.
213
-     *
214
-     * @return Current step's index
215
-     */
216
-    public int getCurrentStepIndex() {
217
-        return wizard.getCurrentStepIndex();
218
-    }
219
-
220
-    /**
221
-     * Returns the name of the current step.
222
-     *
223
-     * @return Current step's name
224
-     */
225
-    public String getCurrentStepName() {
226
-        return wizard.getCurrentStepName();
227
-    }
228
-
229
-    /**
230
-     * Informs listeners a step is about to be displayed.
231
-     *
232
-     * @param step Step to be displayed
233
-     */
234
-    void fireStepAboutToBeDisplayed(final Step step) {
235
-        for (StepListener listener : listeners.get(StepListener.class)) {
236
-            listener.stepAboutToDisplay(step);
237
-        }
238
-    }
239
-
240
-    /**
241
-     * Informs listeners a step is about to be hidden.
242
-     *
243
-     * @param step Step to be hidden
244
-     */
245
-    void fireStepHidden(final Step step) {
246
-        for (StepListener listener : listeners.get(StepListener.class)) {
247
-            listener.stepHidden(step);
248
-        }
249
-    }
250
-
251
-    /**
252
-     * Adds a step listener to this installer.
253
-     *
254
-     * @param listener Listener to add
255
-     */
256
-    public void addStepListener(final StepListener listener) {
257
-        listeners.add(StepListener.class, listener);
258
-    }
259
-
260
-    /**
261
-     * Removes a step listener from this installer.
262
-     *
263
-     * @param listener Listener to remove
264
-     */
265
-    public void removeStepListener(final StepListener listener) {
266
-        listeners.remove(StepListener.class, listener);
267
-
268
-    }
269
-
270
-    /**
271
-     * Informs listeners this installer has been cancelled.
272
-     */
273
-    void fireWizardCancelled() {
274
-        for (WizardListener listener : listeners.get(WizardListener.class)) {
275
-            listener.wizardCancelled();
276
-        }
277
-    }
278
-
279
-    /**
280
-     * Informs listeners this installer has been completed.
281
-     */
282
-    void fireWizardFinished() {
283
-        for (WizardListener listener : listeners.get(WizardListener.class)) {
284
-            listener.wizardFinished();
285
-        }
286
-    }
287
-
288
-    /**
289
-     * Adds a wizard listeners to this installer.
290
-     *
291
-     * @param listener Listener to add
292
-     */
293
-    public void addWizardListener(final WizardListener listener) {
294
-        listeners.add(WizardListener.class, listener);
295
-    }
296
-
297
-    /**
298
-     * Removes  a wizard listener from this installer
299
-     *
300
-     * @param listener Listener to remove
301
-     */
302
-    public void removeWizardListener(final WizardListener listener) {
303
-        listeners.remove(WizardListener.class, listener);
304
-    }
305
-
306
-    /**
307
-     * Initialises any settings required by this UI (this is always called
308
-     * before any aspect of the UI is instansiated).
309
-     *
310
-     * @throws UnsupportedOperationException If unable to switch to the system
311
-     * look and feel
312
-     */
313
-    public static void initUISettings() {
314
-
315
-        try {
316
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
317
-        } catch (InstantiationException ex) {
318
-            throw new UnsupportedOperationException("Unable to switch to the " +
319
-                                                    "system look and feel", ex);
320
-        } catch (ClassNotFoundException ex) {
321
-            throw new UnsupportedOperationException("Unable to switch to the " +
322
-                                                    "system look and feel", ex);
323
-        } catch (UnsupportedLookAndFeelException ex) {
324
-            throw new UnsupportedOperationException("Unable to switch to the " +
325
-                                                    "system look and feel", ex);
326
-        } catch (IllegalAccessException ex) {
327
-            throw new UnsupportedOperationException("Unable to switch to the " +
328
-                                                    "system look and feel", ex);
329
-        }
330
-
331
-        UIManager.put("swing.useSystemFontSettings", true);
332
-        UIManager.put("swing.boldMetal", false);
333
-    }
334
-
335
-    /**
336
-     * {@inheritDoc}
337
-     *
338
-     * @param e Action performed
339
-     */
340
-    @Override
341
-    public void actionPerformed(final ActionEvent e) {
342
-        final int currentStep = wizard.getCurrentStepIndex();
343
-        Step hiddenStep = null;
344
-        Step shownStep = null;
345
-        if (e.getSource() == control.getPrevButton()) {
346
-            wizard.previousStep();
347
-            hiddenStep = wizard.getStep(currentStep);
348
-            shownStep = wizard.getStep(currentStep - 1);
349
-        } else if (e.getSource() == control.getNextButton()) {
350
-            if ("Finish".equals(control.getNextButton().getText())) {
351
-                fireWizardFinished();
352
-                shownStep = wizard.getStep(currentStep);
353
-                dispose();
354
-            } else {
355
-                wizard.nextStep();
356
-                hiddenStep = wizard.getStep(currentStep);
357
-                shownStep = wizard.getStep(currentStep + 1);
358
-            }
359
-        } else {
360
-            return;
361
-        }
362
-        title.setStep(shownStep);
363
-        if (shownStep != null) {
364
-            fireStepAboutToBeDisplayed(shownStep);
365
-        }
366
-        if (hiddenStep != null) {
367
-            fireStepHidden(hiddenStep);
368
-        }
369
-        control.setProgress(wizard.getCurrentStepIndex());
370
-    }
371
-}

+ 0
- 95
src/com/dmdirc/installer/ui/StepConfirm.java Ver fichero

@@ -1,95 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import com.dmdirc.installer.TextStep;
26
-
27
-import java.awt.BorderLayout;
28
-import java.awt.Image;
29
-import javax.swing.SwingUtilities;
30
-
31
-/**
32
- * This confirms the settings chosen in the previous step
33
- */
34
-public final class StepConfirm extends SwingStep implements TextStep {
35
-
36
-    /**
37
-     * A version number for this class. It should be changed whenever the class
38
-     * structure is changed (or anything else that would prevent serialized
39
-     * objects being unserialized with the new class).
40
-     */
41
-    private static final long serialVersionUID = 2;
42
-    /** Text area showing the install information */
43
-    private final TextLabel infoLabel = new TextLabel("");
44
-
45
-    /**
46
-     * Creates a new instance of StepConfirm.
47
-     */
48
-    public StepConfirm() {
49
-        super();
50
-        setLayout(new BorderLayout());
51
-        add(infoLabel, BorderLayout.CENTER);
52
-    }
53
-
54
-    /** {@inheritDoc} */
55
-    @Override
56
-    public String getStepName() {
57
-        return "Confirm";
58
-    }
59
-
60
-    /** {@inheritDoc} */
61
-    @Override
62
-    public Image getIcon() {
63
-        return null;
64
-    }
65
-
66
-    /** {@inheritDoc} */
67
-    @Override
68
-    public String getStepDescription() {
69
-        return "";
70
-    }
71
-
72
-    /** {@inheritDoc} */
73
-    @Override
74
-    public void addText(final String text) {
75
-        SwingUtilities.invokeLater(new Runnable() {
76
-
77
-            @Override
78
-            public void run() {
79
-                infoLabel.setText(infoLabel.getText() + text);
80
-            }
81
-        });
82
-    }
83
-
84
-    /** {@inheritDoc} */
85
-    @Override
86
-    public void setText(final String text) {
87
-        SwingUtilities.invokeLater(new Runnable() {
88
-
89
-            @Override
90
-            public void run() {
91
-                infoLabel.setText(text);
92
-            }
93
-        });
94
-    }
95
-}

+ 0
- 75
src/com/dmdirc/installer/ui/StepError.java Ver fichero

@@ -1,75 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import java.awt.BorderLayout;
26
-import java.awt.Image;
27
-
28
-/**
29
- * This step shows an unable to install error
30
- */
31
-public final class StepError extends SwingStep {
32
-
33
-    /**
34
-     * A version number for this class. It should be changed whenever the class
35
-     * structure is changed (or anything else that would prevent serialized
36
-     * objects being unserialized with the new class).
37
-     */
38
-    private static final long serialVersionUID = 2;
39
-
40
-    /**
41
-     * Creates a new instance of StepError with a default error message.
42
-     */
43
-    public StepError() {
44
-        this("Sorry, it is not possible to install DMDirc on this system at this time.\n\n");
45
-    }
46
-
47
-    /**
48
-     * Creates a new instance of StepError with a given error message.
49
-     *
50
-     * @param message Error message to show.
51
-     */
52
-    public StepError(final String message) {
53
-        super();
54
-        setLayout(new BorderLayout());
55
-        add(new TextLabel(message), BorderLayout.CENTER);
56
-    }
57
-
58
-    /** {@inheritDoc} */
59
-    @Override
60
-    public String getStepName() {
61
-        return "Error";
62
-    }
63
-
64
-    /** {@inheritDoc} */
65
-    @Override
66
-    public Image getIcon() {
67
-        return null;
68
-    }
69
-
70
-    /** {@inheritDoc} */
71
-    @Override
72
-    public String getStepDescription() {
73
-        return "";
74
-    }
75
-}

+ 0
- 104
src/com/dmdirc/installer/ui/StepInstall.java Ver fichero

@@ -1,104 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import com.dmdirc.installer.TextStep;
26
-
27
-import java.awt.BorderLayout;
28
-import java.awt.Image;
29
-
30
-import java.awt.Insets;
31
-import javax.swing.JScrollPane;
32
-import javax.swing.SwingUtilities;
33
-
34
-/**
35
- * This confirms the settings chosen in the previous step
36
- */
37
-public final class StepInstall extends SwingStep implements TextStep {
38
-
39
-    /**
40
-     * A version number for this class. It should be changed whenever the class
41
-     * structure is changed (or anything else that would prevent serialized
42
-     * objects being unserialized with the new class).
43
-     */
44
-    private static final long serialVersionUID = 2;
45
-    /** Text area showing the install information */
46
-    private final TextLabel infoLabel = new TextLabel("Beginning Install");
47
-    /** Scroll pane holding text area */
48
-    final JScrollPane scrollPane;
49
-
50
-    /**
51
-     * Creates a new instance of StepInstall.
52
-     */
53
-    public StepInstall() {
54
-        super();
55
-        setLayout(new BorderLayout());
56
-        scrollPane = new JScrollPane(infoLabel,
57
-                                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
58
-                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
59
-        infoLabel.setMargin(new Insets(5, 5, 5, 5));
60
-        add(scrollPane, BorderLayout.CENTER);
61
-    }
62
-
63
-    /** {@inheritDoc} */
64
-    @Override
65
-    public String getStepName() {
66
-        return "Install";
67
-    }
68
-
69
-    /** {@inheritDoc} */
70
-    @Override
71
-    public Image getIcon() {
72
-        return null;
73
-    }
74
-
75
-    /** {@inheritDoc} */
76
-    @Override
77
-    public String getStepDescription() {
78
-        return "";
79
-    }
80
-
81
-    /** {@inheritDoc} */
82
-    @Override
83
-    public synchronized void addText(final String text) {
84
-        SwingUtilities.invokeLater(new Runnable() {
85
-
86
-            @Override
87
-            public void run() {
88
-                infoLabel.setText(infoLabel.getText() + text + "\n");
89
-            }
90
-        });
91
-    }
92
-
93
-    /** {@inheritDoc} */
94
-    @Override
95
-    public synchronized void setText(final String text) {
96
-        SwingUtilities.invokeLater(new Runnable() {
97
-
98
-            @Override
99
-            public void run() {
100
-                infoLabel.setText(text);
101
-            }
102
-        });
103
-    }
104
-}

+ 0
- 417
src/com/dmdirc/installer/ui/StepLayout.java Ver fichero

@@ -1,417 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import com.dmdirc.installer.Step;
26
-
27
-import java.awt.Component;
28
-import java.awt.Container;
29
-import java.awt.Dimension;
30
-import java.awt.Insets;
31
-import java.awt.LayoutManager2;
32
-import java.io.Serializable;
33
-import java.util.ArrayList;
34
-import java.util.List;
35
-
36
-/**
37
- * Adjusted Card layout.
38
- */
39
-public class StepLayout implements LayoutManager2, Serializable {
40
-
41
-    /**
42
-     * A version number for this class. It should be changed whenever the class
43
-     * structure is changed (or anything else that would prevent serialized
44
-     * objects being unserialized with the new class).
45
-     */
46
-    private static final long serialVersionUID = 2;
47
-    /** Cards vector. */
48
-    private final List<SwingStep> steps;
49
-    /** Current step. */
50
-    private int currentStep;
51
-    /** Vertical gap. */
52
-    private int vGap;
53
-    /** Horiontal gap. */
54
-    private int hGap;
55
-
56
-    /**
57
-     * Instantiates a new step layout.
58
-     */
59
-    public StepLayout() {
60
-        this(0, 0);
61
-    }
62
-
63
-    /**
64
-     * Instantiates a new step layout.
65
-     *
66
-     * @param parent Parent component
67
-     */
68
-    public StepLayout(final Container parent) {
69
-        this(0, 0, parent);
70
-    }
71
-
72
-    /**
73
-     * Instantiates a new step layout with the specified gaps.
74
-     *
75
-     * @param hGap Horizontal gap
76
-     * @param vGap Vertical gap
77
-     */
78
-    public StepLayout(final int hGap, final int vGap) {
79
-        this(hGap, vGap, null);
80
-    }
81
-
82
-    /**
83
-     * Instantiates a new step layout with the specified gaps.
84
-     *
85
-     * @param hGap Horizontal gap
86
-     * @param vGap Vertical gap
87
-     * @param parent Parent component
88
-     */
89
-    public StepLayout(final int hGap, final int vGap, final Container parent) {
90
-        steps = new ArrayList<SwingStep>();
91
-        currentStep = -1;
92
-        this.hGap = hGap;
93
-        this.vGap = vGap;
94
-    }
95
-
96
-    /**
97
-     * Returns the number of steps in the layout.
98
-     *
99
-     * @return number of steps >= 0
100
-     */
101
-    public int size() {
102
-        return steps.size();
103
-    }
104
-
105
-    /**
106
-     * Checks if the layout is empty
107
-     *
108
-     * @return true iif the layout has no steps
109
-     */
110
-    public boolean isEmpty() {
111
-        return steps.isEmpty();
112
-    }
113
-
114
-    /**
115
-     * Returns the specified step from the layout.
116
-     *
117
-     * @param index Step to retrieve
118
-     *
119
-     * @return Step
120
-     */
121
-    public Step getStep(final int index) {
122
-        return steps.get(index);
123
-    }
124
-
125
-    /**
126
-     * Returns the step list.
127
-     *
128
-     * @return List of steps
129
-     */
130
-    public List<SwingStep> getSteps() {
131
-        return steps;
132
-    }
133
-
134
-    /**
135
-     * Returns the current step index.
136
-     *
137
-     * @return Current step index
138
-     */
139
-    public int getCurrentStepIndex() {
140
-        return currentStep;
141
-    }
142
-
143
-    /**
144
-     * Returns the current step name.
145
-     *
146
-     * @return Current step name
147
-     */
148
-    public String getCurrentStepName() {
149
-        return steps.get(currentStep).getStepName();
150
-    }
151
-
152
-    /**
153
-     * Returns the current step name.
154
-     *
155
-     * @return Current step name
156
-     */
157
-    public Step getCurrentStep() {
158
-        return steps.get(currentStep);
159
-    }
160
-
161
-    /**
162
-     * Show the first step.
163
-     *
164
-     * @param parent Parent container
165
-     */
166
-    public void first(final Container parent) {
167
-        show(0, parent);
168
-    }
169
-
170
-    /**
171
-     * Show the last step.
172
-     *
173
-     * @param parent Parent container
174
-     */
175
-    public void last(final Container parent) {
176
-        show(parent.getComponentCount() - 1, parent);
177
-    }
178
-
179
-    /**
180
-     * Show the next step.
181
-     *
182
-     * @param parent Parent container
183
-     */
184
-    public void next(final Container parent) {
185
-        show(currentStep + 1, parent);
186
-    }
187
-
188
-    /**
189
-     * Show the previous step.
190
-     *
191
-     * @param parent Parent container
192
-     */
193
-    public void previous(final Container parent) {
194
-        show(currentStep - 1, parent);
195
-    }
196
-
197
-    /**
198
-     * Show the specified step.
199
-     *
200
-     * @param step Step to show
201
-     * @param parent Parent container
202
-     */
203
-    public void show(final Step step, final Container parent) {
204
-        show(steps.indexOf(step), parent);
205
-    }
206
-
207
-    /**
208
-     * Show the step at the specified index.
209
-     *
210
-     * @param step Step to show
211
-     * @param parent Parent container
212
-     */
213
-    public void show(final int step, final Container parent) {
214
-        int stepNumber = step;
215
-        if (stepNumber == -1) {
216
-            if (stepNumber >= steps.size()) {
217
-                stepNumber = steps.size() - 1;
218
-            } else {
219
-                stepNumber = 0;
220
-            }
221
-        }
222
-        synchronized (parent.getTreeLock()) {
223
-            final int componentCount = parent.getComponentCount();
224
-            for (int i = 0; i < componentCount; i++) {
225
-                final Component comp = parent.getComponent(i);
226
-                if (comp.isVisible()) {
227
-                    comp.setVisible(false);
228
-                    break;
229
-                }
230
-            }
231
-            if (componentCount > 0) {
232
-                currentStep = stepNumber;
233
-                parent.getComponent(currentStep).setVisible(true);
234
-                parent.validate();
235
-            }
236
-        }
237
-    }
238
-
239
-    /** {@inheritDoc} */
240
-    @Override
241
-    public void addLayoutComponent(final Component comp,
242
-                                   final Object constraints) {
243
-        if (!(comp instanceof Step)) {
244
-            throw new IllegalArgumentException(
245
-                    "Component must be an instance of Step");
246
-        }
247
-        addLayoutComponent((SwingStep) comp);
248
-    }
249
-
250
-    /**
251
-     * {@inheritDoc}
252
-     *
253
-     * @deprecated Use addLayoutComponent(Component, Object) or
254
-     * addLayoutComponent(Component)
255
-     *
256
-     * @see addLayoutComponent(Component)
257
-     * @see addLayoutComponent(Component, Object)
258
-     */
259
-    @Override
260
-    @Deprecated
261
-    public void addLayoutComponent(final String name, final Component comp) {
262
-        if (!(comp instanceof Step)) {
263
-            throw new IllegalArgumentException(
264
-                    "Component must be an instance of Step");
265
-        }
266
-        addLayoutComponent((SwingStep) comp);
267
-    }
268
-
269
-    /**
270
-     * Adds a component to the layout.
271
-     *
272
-     * @param step Component to add
273
-     */
274
-    public void addLayoutComponent(final SwingStep step) {
275
-        synchronized (step.getTreeLock()) {
276
-            if (!steps.isEmpty()) {
277
-                step.setVisible(false);
278
-            }
279
-            steps.add(step);
280
-        }
281
-    }
282
-
283
-    /** {@inheritDoc} */
284
-    @Override
285
-    public void removeLayoutComponent(final Component comp) {
286
-        synchronized (comp.getTreeLock()) {
287
-            if (comp.isVisible()) {
288
-                comp.setVisible(false);
289
-            }
290
-            next(comp.getParent());
291
-            steps.remove(comp);
292
-        }
293
-    }
294
-
295
-    /**
296
-     * {@inheritDoc}
297
-     *
298
-     * @return Returns the preferred size of the container
299
-     */
300
-    @Override
301
-    public Dimension preferredLayoutSize(final Container parent) {
302
-        synchronized (parent.getTreeLock()) {
303
-            final Insets insets = parent.getInsets();
304
-            final int componentCount = parent.getComponentCount();
305
-            int width = 0;
306
-            int height = 0;
307
-
308
-            for (int i = 0; i < componentCount; i++) {
309
-                final Component comp = parent.getComponent(i);
310
-                final Dimension preferredDimension = comp.getPreferredSize();
311
-
312
-                width = Math.max(width, preferredDimension.width);
313
-                height = Math.max(height, preferredDimension.height);
314
-            }
315
-            return new Dimension(insets.left + insets.right + width + hGap * 2,
316
-                                 insets.top + insets.bottom + height + vGap * 2);
317
-        }
318
-    }
319
-
320
-    /**
321
-     * {@inheritDoc}
322
-     *
323
-     * @return Returns the minimum size of the container
324
-     */
325
-    @Override
326
-    public Dimension minimumLayoutSize(final Container parent) {
327
-        synchronized (parent.getTreeLock()) {
328
-            final Insets insets = parent.getInsets();
329
-            final int componentCount = parent.getComponentCount();
330
-            int width = 0;
331
-            int height = 0;
332
-
333
-            for (int i = 0; i < componentCount; i++) {
334
-                final Component comp = parent.getComponent(i);
335
-                final Dimension minimumDimension = comp.getMinimumSize();
336
-
337
-                width = Math.max(width, minimumDimension.width);
338
-                height = Math.max(height, minimumDimension.height);
339
-            }
340
-            return new Dimension(insets.left + insets.right + width + hGap * 2,
341
-                                 insets.top + insets.bottom + height + vGap * 2);
342
-        }
343
-    }
344
-
345
-    /**
346
-     * {@inheritDoc}
347
-     *
348
-     * @param parent Container to get the size for
349
-     *
350
-     * @return Returns the maximum size of the container
351
-     */
352
-    @Override
353
-    public Dimension maximumLayoutSize(final Container parent) {
354
-        return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
355
-    }
356
-
357
-    /**
358
-     * {@inheritDoc}
359
-     *
360
-     * @param target Container to get the alignment from
361
-     *
362
-     * @return Alignment
363
-     */
364
-    @Override
365
-    public float getLayoutAlignmentX(final Container target) {
366
-        return 0.5f;
367
-    }
368
-
369
-    /**
370
-     * {@inheritDoc}
371
-     *
372
-     * @param target Container to get the alignment from
373
-     *
374
-     * @return Alignment
375
-     */
376
-    @Override
377
-    public float getLayoutAlignmentY(final Container target) {
378
-        return 0.5f;
379
-    }
380
-
381
-    /**
382
-     * {@inheritDoc}
383
-     *
384
-     * @param target  Container to invalidate
385
-     */
386
-    @Override
387
-    public void invalidateLayout(final Container target) {
388
-        //Ignore
389
-    }
390
-
391
-    /** {@inheritDoc} */
392
-    @Override
393
-    public void layoutContainer(final Container parent) {
394
-        synchronized (parent.getTreeLock()) {
395
-            final Insets insets = parent.getInsets();
396
-            final int componentCount = parent.getComponentCount();
397
-            Component comp = null;
398
-            boolean currentFound = false;
399
-
400
-            for (int i = 0; i < componentCount; i++) {
401
-                comp = parent.getComponent(i);
402
-                comp.setBounds(hGap + insets.left, vGap + insets.top,
403
-                               parent.getWidth() - (hGap * 2 + insets.left +
404
-                                                    insets.right), parent.
405
-                        getHeight() - (vGap * 2 +
406
-                                       insets.top + insets.bottom));
407
-                if (comp.isVisible()) {
408
-                    currentFound = true;
409
-                }
410
-            }
411
-
412
-            if (!currentFound && componentCount > 0) {
413
-                parent.getComponent(0).setVisible(true);
414
-            }
415
-        }
416
-    }
417
-}

+ 0
- 168
src/com/dmdirc/installer/ui/StepSettings.java Ver fichero

@@ -1,168 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import com.dmdirc.installer.DefaultSettings;
26
-import com.dmdirc.installer.Main;
27
-import com.dmdirc.installer.Settings;
28
-import com.dmdirc.installer.Installer.ShortcutType;
29
-
30
-import java.awt.GridBagConstraints;
31
-import java.awt.GridBagLayout;
32
-import java.awt.Image;
33
-import java.awt.Insets;
34
-
35
-import javax.swing.Box;
36
-import javax.swing.JCheckBox;
37
-import javax.swing.JTextField;
38
-
39
-/**
40
- * Queries the user for where to install dmdirc, and if they want to setup shortcuts
41
- */
42
-public final class StepSettings extends SwingStep implements Settings {
43
-
44
-    /**
45
-     * A version number for this class. It should be changed whenever the class
46
-     * structure is changed (or anything else that would prevent serialized
47
-     * objects being unserialized with the new class).
48
-     */
49
-    private static final long serialVersionUID = 3;
50
-    /** Menu Shorcuts checkbox. */
51
-    private final JCheckBox shortcutMenu = new JCheckBox("Create " + Main.
52
-            getInstaller().getMenuName() + " shortcut");
53
-    /** Desktop Shorcuts checkbox. */
54
-    private final JCheckBox shortcutDesktop = new JCheckBox(
55
-            "Create desktop shortcut");
56
-    /** Quick-Launch Shorcuts checkbox. */
57
-    private final JCheckBox shortcutQuick = new JCheckBox(
58
-            "Create Quick Launch shortcut");
59
-    /** Register IRC:// protocol. */
60
-    private final JCheckBox shortcutProtocol = new JCheckBox(
61
-            "Make DMDirc handle irc:// links");
62
-    /** Install Location input. */
63
-    private final JTextField location = new JTextField(Main.getInstaller().
64
-            defaultInstallLocation(), 20);
65
-
66
-    /**
67
-     * Creates a new instance of StepSettings.
68
-     */
69
-    public StepSettings() {
70
-        super();
71
-
72
-        final DefaultSettings defaultSettings = new DefaultSettings();
73
-        shortcutMenu.setSelected(defaultSettings.getShortcutMenuState());
74
-        shortcutDesktop.setSelected(defaultSettings.getShortcutDesktopState());
75
-        shortcutQuick.setSelected(defaultSettings.getShortcutQuickState());
76
-        shortcutProtocol.setSelected(defaultSettings.getShortcutProtocolState());
77
-
78
-        final GridBagConstraints constraints = new GridBagConstraints();
79
-        setLayout(new GridBagLayout());
80
-
81
-        constraints.weightx = 1.0;
82
-        constraints.fill = GridBagConstraints.BOTH;
83
-        constraints.gridx = 0;
84
-        constraints.gridy = 0;
85
-        constraints.gridwidth = 2;
86
-        add(new TextLabel("Here you can choose options for the install."
87
-                + "\n\nInstall Location:"), constraints);
88
-
89
-        constraints.fill = GridBagConstraints.HORIZONTAL;
90
-        constraints.gridx = 1;
91
-        constraints.gridy = 1;
92
-        add(location, constraints);
93
-
94
-        constraints.gridwidth = 2;
95
-        constraints.gridx = 0;
96
-        constraints.insets = new Insets(InstallerDialog.SMALL_GAP, 0, 0, 0);
97
-
98
-        if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
99
-            constraints.gridy = (constraints.gridy + 1);
100
-            add(shortcutMenu, constraints);
101
-        }
102
-        if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)) {
103
-            constraints.gridy = (constraints.gridy + 1);
104
-            add(shortcutDesktop, constraints);
105
-        }
106
-        if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)) {
107
-            constraints.gridy = (constraints.gridy + 1);
108
-            add(shortcutQuick, constraints);
109
-        }
110
-        if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)) {
111
-            constraints.gridy = (constraints.gridy + 1);
112
-            add(shortcutProtocol, constraints);
113
-        }
114
-
115
-        constraints.gridy = (constraints.gridy + 1);
116
-        constraints.weighty = 1.0;
117
-        constraints.fill = GridBagConstraints.BOTH;
118
-        add(Box.createVerticalGlue(), constraints);
119
-    }
120
-
121
-    /** {@inheritDoc} */
122
-    @Override
123
-    public String getStepName() {
124
-        return "Settings";
125
-    }
126
-
127
-    /** {@inheritDoc} */
128
-    @Override
129
-    public Image getIcon() {
130
-        return null;
131
-    }
132
-
133
-    /** {@inheritDoc} */
134
-    @Override
135
-    public String getStepDescription() {
136
-        return "";
137
-    }
138
-
139
-    /** {@inheritDoc} */
140
-    @Override
141
-    public boolean getShortcutMenuState() {
142
-        return shortcutMenu.isSelected();
143
-    }
144
-
145
-    /** {@inheritDoc} */
146
-    @Override
147
-    public boolean getShortcutDesktopState() {
148
-        return shortcutDesktop.isSelected();
149
-    }
150
-
151
-    /** {@inheritDoc} */
152
-    @Override
153
-    public boolean getShortcutQuickState() {
154
-        return shortcutQuick.isSelected();
155
-    }
156
-
157
-    /** {@inheritDoc} */
158
-    @Override
159
-    public boolean getShortcutProtocolState() {
160
-        return shortcutProtocol.isSelected();
161
-    }
162
-
163
-    /** {@inheritDoc} */
164
-    @Override
165
-    public String getInstallLocation() {
166
-        return location.getText().trim();
167
-    }
168
-}

+ 0
- 77
src/com/dmdirc/installer/ui/StepWelcome.java Ver fichero

@@ -1,77 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-package com.dmdirc.installer.ui;
23
-
24
-import java.awt.BorderLayout;
25
-import java.awt.Image;
26
-import java.awt.Toolkit;
27
-
28
-/**
29
- * Tells the user what this application does
30
- */
31
-public final class StepWelcome extends SwingStep {
32
-
33
-    /**
34
-     * A version number for this class. It should be changed whenever the class
35
-     * structure is changed (or anything else that would prevent serialized
36
-     * objects being unserialized with the new class).
37
-     */
38
-    private static final long serialVersionUID = 2;
39
-
40
-    /**
41
-     * Creates a new instance of StepWelcome.
42
-     *
43
-     * @param releaseName 
44
-     */
45
-    public StepWelcome(final String releaseName) {
46
-        super();
47
-
48
-        setLayout(new BorderLayout());
49
-
50
-        add(new TextLabel(
51
-                "Welcome to the " + releaseName + " installer. This program "
52
-                + "will install DMDirc on this computer.\n\nDMDirc is a "
53
-                + "cross-platform IRC client developed by Chris Smith, Shane "
54
-                + "Mc Cormack and Gregory Holmes. DMDirc is released for free "
55
-                + "under the MIT licence; for more information, please visit "
56
-                + "www.DMDirc.com.\n\nClick \"Next\" to continue, or close "
57
-                + "this program to cancel the installation."), BorderLayout.CENTER);
58
-    }
59
-
60
-    /** {@inheritDoc} */
61
-    @Override
62
-    public String getStepName() {
63
-        return "Welcome";
64
-    }
65
-
66
-    /** {@inheritDoc} */
67
-    @Override
68
-    public Image getIcon() {
69
-        return Toolkit.getDefaultToolkit().createImage(ClassLoader.getSystemResource("com/dmdirc/res/icon.png"));
70
-    }
71
-
72
-    /** {@inheritDoc} */
73
-    @Override
74
-    public String getStepDescription() {
75
-        return "";
76
-    }
77
-}

+ 0
- 34
src/com/dmdirc/installer/ui/SwingStep.java Ver fichero

@@ -1,34 +0,0 @@
1
-/*
2
- * 
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- * 
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- * 
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer.ui;
25
-
26
-import com.dmdirc.installer.Step;
27
-
28
-import javax.swing.JPanel;
29
-
30
-/**
31
- * Extention of basic Step to make it a JPanel.
32
- */
33
-public abstract class SwingStep extends JPanel implements Step {
34
-}

+ 0
- 74
src/com/dmdirc/installer/ui/TextLabel.java Ver fichero

@@ -1,74 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.installer.ui;
24
-
25
-import java.awt.Insets;
26
-
27
-import javax.swing.JTextPane;
28
-import javax.swing.text.DefaultStyledDocument;
29
-
30
-/**
31
- * Dyamnic text label.
32
- */
33
-public class TextLabel extends JTextPane {
34
-
35
-    /**
36
-     * A version number for this class. It should be changed whenever the
37
-     * class structure is changed (or anything else that would prevent
38
-     * serialized objects being unserialized with the new class).
39
-     */
40
-    private static final long serialVersionUID = 1;
41
-
42
-    /**
43
-     * Creates a new instance of TextLabel.
44
-     */
45
-    public TextLabel() {
46
-        this(null, true);
47
-    }
48
-
49
-    /**
50
-     * Creates a new instance of TextLabel.
51
-     *
52
-     * @param text Text to display
53
-     */
54
-    public TextLabel(final String text) {
55
-        this(text, true);
56
-    }
57
-
58
-    /**
59
-     * Creates a new instance of TextLabel.
60
-     *
61
-     * @param text Text to display
62
-     * @param justified Justify the text?
63
-     */
64
-    public TextLabel(final String text, final boolean justified) {
65
-        super(new DefaultStyledDocument());
66
-
67
-        setOpaque(false);
68
-        setEditable(false);
69
-        setHighlighter(null);
70
-        setMargin(new Insets(0, 0, 0, 0));
71
-
72
-        setText(text);
73
-    }
74
-}

+ 0
- 91
src/com/dmdirc/installer/ui/TitlePanel.java Ver fichero

@@ -1,91 +0,0 @@
1
-/*
2
- *
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer.ui;
25
-
26
-import com.dmdirc.installer.Step;
27
-import com.dmdirc.installer.ui.EtchedLineBorder.BorderSide;
28
-
29
-import java.awt.BorderLayout;
30
-import java.awt.Color;
31
-
32
-import javax.swing.ImageIcon;
33
-import javax.swing.JLabel;
34
-import javax.swing.JPanel;
35
-import javax.swing.border.EtchedBorder;
36
-
37
-/**
38
- * Simple title panel for a wizard.
39
- */
40
-public class TitlePanel extends JPanel {
41
-
42
-    private static final long serialVersionUID = 7173184984913948951L;
43
-    private final JLabel title;
44
-    private final JLabel image;
45
-
46
-    /**
47
-     * Instantiates a new title panel.
48
-     *
49
-     * @param step Initial title text
50
-     */
51
-    public TitlePanel(final Step step) {
52
-        super(new BorderLayout());
53
-
54
-        title = new JLabel();
55
-        image = new JLabel();
56
-
57
-        setStep(step);
58
-
59
-        title.setFont(title.getFont().deriveFont((float) (title.getFont().
60
-                getSize() * 1.5)));
61
-        title.setForeground(Color.BLACK);
62
-        add(title, BorderLayout.CENTER);
63
-        add(image, BorderLayout.EAST);
64
-        setBackground(Color.WHITE);
65
-        setBorder(new EtchedLineBorder(EtchedBorder.RAISED, BorderSide.BOTTOM));
66
-    }
67
-
68
-    /**
69
-     * Sets the title text.
70
-     *
71
-     * @param step new title text
72
-     */
73
-    public void setStep(final Step step) {
74
-        if (step == null) {
75
-            title.setText("");
76
-            image.setIcon(null);
77
-            return;
78
-        }
79
-
80
-        if ("".equals(step.getStepDescription())) {
81
-            title.setText(step.getStepName());
82
-        } else {
83
-            title.setText(step.getStepName() + "\n" + step.getStepDescription());
84
-        }
85
-        if (step.getIcon() == null) {
86
-            image.setIcon(null);
87
-        } else {
88
-            image.setIcon(new ImageIcon(step.getIcon()));
89
-        }
90
-    }
91
-}

+ 0
- 143
src/com/dmdirc/installer/ui/WizardControlPanel.java Ver fichero

@@ -1,143 +0,0 @@
1
-/*
2
- *
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer.ui;
25
-
26
-import com.dmdirc.installer.ui.EtchedLineBorder.BorderSide;
27
-import java.awt.Dimension;
28
-import javax.swing.Box;
29
-import javax.swing.BoxLayout;
30
-import javax.swing.JButton;
31
-import javax.swing.JLabel;
32
-import javax.swing.JPanel;
33
-import javax.swing.border.EtchedBorder;
34
-
35
-/**
36
- * Simple Panel representing the control buttons for a wizard.
37
- */
38
-public class WizardControlPanel extends JPanel {
39
-
40
-    private static final long serialVersionUID = 7903362315297158222L;
41
-    private final JButton prev;
42
-    private final JButton next;
43
-    private final JLabel progress;
44
-    private int total;
45
-    private int step;
46
-
47
-    /**
48
-     * Instantiates a new wizard control panel.
49
-     */
50
-    public WizardControlPanel() {
51
-        this(0);
52
-    }
53
-
54
-    /**
55
-     * Instantiates a new wizard control panel using the specified number of
56
-     * steps.
57
-     *
58
-     * @param total Total number of steps
59
-     */
60
-    public WizardControlPanel(final int total) {
61
-        this.total = total;
62
-        this.step = 0;
63
-
64
-        prev = new JButton("\u00AB Previous");
65
-        next = new JButton("Next \u00BB");
66
-        progress = new JLabel();
67
-        updateProgressLabel();
68
-
69
-        prev.setPreferredSize(new Dimension(100, prev.getFont().getSize() + 2 * InstallerDialog.SMALL_GAP));
70
-        next.setPreferredSize(new Dimension(100, next.getFont().getSize() + 2 * InstallerDialog.SMALL_GAP));
71
-
72
-        setBorder(new EtchedLineBorder(EtchedBorder.LOWERED, BorderSide.TOP));
73
-        setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
74
-        add(progress);
75
-        add(Box.createHorizontalGlue());
76
-        add(prev);
77
-        add(Box.createHorizontalStrut(InstallerDialog.SMALL_GAP));
78
-        add(next);
79
-    }
80
-
81
-    /**
82
-     * Returns the previous button.
83
-     *
84
-     * @return Previous button
85
-     */
86
-    public JButton getPrevButton() {
87
-        return prev;
88
-    }
89
-
90
-    /**
91
-     * Returns the next button.
92
-     *
93
-     * @return Next button
94
-     */
95
-    public JButton getNextButton() {
96
-        return next;
97
-    }
98
-
99
-    /**
100
-     * Returns the progress label.
101
-     *
102
-     * @return Progress Label
103
-     */
104
-    public JLabel getProgressLabel() {
105
-        return progress;
106
-    }
107
-
108
-    /**
109
-     * Updates the progress label.
110
-     */
111
-    public void updateProgressLabel() {
112
-        progress.setText("Step " + step + " of " + total);
113
-    }
114
-
115
-    /**
116
-     * Sets the new total number of steps.
117
-     *
118
-     * @param total New total number of steps
119
-     */
120
-    public void setTotal(final int total) {
121
-        this.total = total;
122
-        updateProgressLabel();
123
-    }
124
-
125
-    /**
126
-     * Sets the current progress step.
127
-     *
128
-     * @param step Progress step
129
-     */
130
-    public void setProgress(final int step) {
131
-        this.step = step + 1;
132
-        updateProgressLabel();
133
-        if (step + 1 == total) {
134
-            next.setText("Finish");
135
-        } else if (step == 0) {
136
-            prev.setEnabled(false);
137
-        } else if (step > 0) {
138
-            prev.setEnabled(true);
139
-        } else {
140
-            next.setText("Next \u00BB");
141
-        }
142
-    }
143
-}

+ 0
- 181
src/com/dmdirc/installer/ui/WizardPanel.java Ver fichero

@@ -1,181 +0,0 @@
1
-/*
2
- *
3
- * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.installer.ui;
25
-
26
-import com.dmdirc.installer.Step;
27
-
28
-import java.util.List;
29
-import javax.swing.JPanel;
30
-
31
-/**
32
- * Wizard panel, displays and controls the flow of steps.
33
- */
34
-public class WizardPanel extends JPanel {
35
-
36
-    private static final long serialVersionUID = 7903362315297158222L;
37
-    private final StepLayout layout;
38
-    private final InstallerDialog dialog;
39
-
40
-    /**
41
-     * Instantiates a new wizard panel.
42
-     *
43
-     * @param dialog Parent installer dialog
44
-     */
45
-    public WizardPanel(final InstallerDialog dialog) {
46
-        super();
47
-
48
-        this.dialog = dialog;
49
-        layout = new StepLayout();
50
-        setLayout(layout);
51
-    }
52
-
53
-    /**
54
-     * Displays this panel with the specified steps.
55
-     *
56
-     * @param steps Steps to display
57
-     */
58
-    public void display(final List<SwingStep> steps) {
59
-       for (SwingStep step : steps) {
60
-           addStep(step);
61
-       }
62
-       display();
63
-    }
64
-
65
-    /**
66
-     * Displays this panel with the existing steps.
67
-     */
68
-    public void display() {
69
-        showFirst();
70
-    }
71
-
72
-    /**
73
-     * Returns the step specified.
74
-     *
75
-     * @param step Step index
76
-     *
77
-     * @return Step
78
-     */
79
-    public Step getStep(final int step) {
80
-        return layout.getStep(step);
81
-    }
82
-
83
-    /**
84
-     * Returns the step specified.
85
-     *
86
-     * @param stepName Step name
87
-     *
88
-     * @return Step
89
-     */
90
-    public Step getStep(final String stepName) {
91
-        for (SwingStep loopStep : layout.getSteps()) {
92
-            if (stepName.equals(loopStep.getStepName())) {
93
-                return loopStep;
94
-            }
95
-        }
96
-
97
-        return null;
98
-    }
99
-
100
-    /**
101
-     * Returns the current Step.
102
-     *
103
-     * @return Current step index
104
-     */
105
-    public int getCurrentStepIndex() {
106
-        return layout.getCurrentStepIndex();
107
-    }
108
-
109
-    /**
110
-     * Returns the current Step.
111
-     *
112
-     * @return Current step index
113
-     */
114
-    public String getCurrentStepName() {
115
-        return layout.getCurrentStepName();
116
-    }
117
-
118
-    /**
119
-     * Returns the current Step.
120
-     *
121
-     * @return Current step index
122
-     */
123
-    public Step getCurrentStep() {
124
-        return layout.getCurrentStep();
125
-    }
126
-
127
-    /**
128
-     * Returns the total number of steps.
129
-     *
130
-     * @return Total number of steps
131
-     */
132
-    public int getTotalSteps() {
133
-        return layout.getSteps().size();
134
-    }
135
-
136
-    /**
137
-     * Adds a step to this panel.
138
-     *
139
-     * @param step Step to add
140
-     */
141
-    public void addStep(final SwingStep step) {
142
-        add(step, step.getStepName());
143
-    }
144
-
145
-    /**
146
-     * Shows the first step.
147
-     */
148
-    public void showFirst() {
149
-        layout.first(this);
150
-    }
151
-
152
-    /**
153
-     * Shows the last step.
154
-     */
155
-    public void showLast() {
156
-        layout.last(this);
157
-    }
158
-
159
-    /**
160
-     * Shows the next step.
161
-     */
162
-    public void nextStep() {
163
-        layout.next(this);
164
-    }
165
-
166
-    /**
167
-     * Shows the previous step.
168
-     */
169
-    public void previousStep() {
170
-        layout.previous(this);
171
-    }
172
-
173
-    /**
174
-     * Shows the specified step.
175
-     *
176
-     * @param step Step index
177
-     */
178
-    public void showStep(final int step) {
179
-        layout.show(step, this);
180
-    }
181
-}

Loading…
Cancelar
Guardar