浏览代码

Fix retard-os line endings.

Fixes issue 4093

Change-Id: I2174856d027fc280075c6d873d163fd2ae8bf00f
Reviewed-on: http://gerrit.dmdirc.com/1206
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4rc1
Shane Mc Cormack 14 年前
父节点
当前提交
f2bb8357b3
共有 6 个文件被更改,包括 302 次插入302 次删除
  1. 25
    25
      build-functions.sh
  2. 62
    62
      build-installer.xml
  3. 23
    23
      build-plugins.xml
  4. 24
    24
      build.xml
  5. 109
    109
      createPluginJar.sh
  6. 59
    59
      updateBundledPlugins.sh

+ 25
- 25
build-functions.sh 查看文件

@@ -1,26 +1,26 @@
1
-#!/bin/bash
2
-# Provides functions that are used in multiple scripts in the build process
3
-
4
-function safe_mktemp {
5
-	if [ -x "`which mktemp`" ] ; then
6
-		TMPDIR=`mktemp -d`
7
-	else
8
-		if [ -d "$TMP" ] ; then
9
-			# We're running under Windows then use the global TMP location
10
-			TMPDIR="$TMP/$1-`date +%s`-$$-$RANDOM"
11
-		else
12
-			TMPDIR="`pwd`/build/temp/$1-$$-$RANDOM"
13
-		fi
14
-		# this is fragile
15
-		if [ -d "$TMPDIR" ] ; then
16
-			echo "no suitable temp folder found"
17
-			exit 2
18
-		fi
19
-		mkdir -p "$TMPDIR"  
20
-		if [ ! -d "$TMPDIR" ] ; then
21
-			echo "no suitable temp folder found"
22
-			exit 2
23
-		fi
24
-	fi
25
-	echo $TMPDIR
1
+#!/bin/bash
2
+# Provides functions that are used in multiple scripts in the build process
3
+
4
+function safe_mktemp {
5
+	if [ -x "`which mktemp`" ] ; then
6
+		TMPDIR=`mktemp -d`
7
+	else
8
+		if [ -d "$TMP" ] ; then
9
+			# We're running under Windows then use the global TMP location
10
+			TMPDIR="$TMP/$1-`date +%s`-$$-$RANDOM"
11
+		else
12
+			TMPDIR="`pwd`/build/temp/$1-$$-$RANDOM"
13
+		fi
14
+		# this is fragile
15
+		if [ -d "$TMPDIR" ] ; then
16
+			echo "no suitable temp folder found"
17
+			exit 2
18
+		fi
19
+		mkdir -p "$TMPDIR"  
20
+		if [ ! -d "$TMPDIR" ] ; then
21
+			echo "no suitable temp folder found"
22
+			exit 2
23
+		fi
24
+	fi
25
+	echo $TMPDIR
26 26
 }

+ 62
- 62
build-installer.xml 查看文件

@@ -1,62 +1,62 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project name="DMDirc-installer" default="default" basedir=".">
3
-    <description>Tasks to build the DMDirc installer.</description>
4
-
5
-    <target name="installer"
6
-            description="Build the installer.">
7
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
8
-            <arg value="release.sh"/>
9
-            <arg value="this"/>
10
-        </exec>
11
-
12
-        <condition property="installer.success">
13
-            <equals arg1="${installer.result}" arg2="0" />
14
-        </condition>
15
-
16
-        <echo message="Installer build finished."/>
17
-        <echo message="Completed build files can be found in:"/>
18
-        <echo message="    ${installer.output.dir}"/>
19
-        <echo message=""/>
20
-    </target>
21
-
22
-    <target name="installer-stable"
23
-            description="Build the installer for a stable release.">
24
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
25
-            <arg value="release.sh"/>
26
-            <arg value="-t"/>
27
-            <arg value="-c"/>
28
-            <arg value="STABLE"/>
29
-            <arg value="--upload"/>
30
-        </exec>
31
-
32
-        <condition property="installer.success">
33
-            <equals arg1="${installer.result}" arg2="0" />
34
-        </condition>
35
-
36
-        <echo message="Installer build finished."/>
37
-        <echo message="Completed build files can be found in:"/>
38
-        <echo message="    ${installer.output.dir}"/>
39
-        <echo message=""/>
40
-    </target>
41
-
42
-    <target name="installer-unstable"
43
-            description="Build the installer for an unstable release.">
44
-        <exec executable="bash" dir="installer" resultproperty="installer.result">
45
-            <arg value="release.sh"/>
46
-            <arg value="-t"/>
47
-            <arg value="-c"/>
48
-            <arg value="UNSTABLE"/>
49
-        </exec>
50
-
51
-        <condition property="installer.success">
52
-            <equals arg1="${installer.result}" arg2="0" />
53
-        </condition>
54
-
55
-        <echo message="Installer build finished."/>
56
-        <echo message="Completed build files can be found in:"/>
57
-        <echo message="    ${installer.output.dir}"/>
58
-        <echo message=""/>
59
-    </target>
60
-
61
-
62
-</project>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project name="DMDirc-installer" default="default" basedir=".">
3
+    <description>Tasks to build the DMDirc installer.</description>
4
+
5
+    <target name="installer"
6
+            description="Build the installer.">
7
+        <exec executable="bash" dir="installer" resultproperty="installer.result">
8
+            <arg value="release.sh"/>
9
+            <arg value="this"/>
10
+        </exec>
11
+
12
+        <condition property="installer.success">
13
+            <equals arg1="${installer.result}" arg2="0" />
14
+        </condition>
15
+
16
+        <echo message="Installer build finished."/>
17
+        <echo message="Completed build files can be found in:"/>
18
+        <echo message="    ${installer.output.dir}"/>
19
+        <echo message=""/>
20
+    </target>
21
+
22
+    <target name="installer-stable"
23
+            description="Build the installer for a stable release.">
24
+        <exec executable="bash" dir="installer" resultproperty="installer.result">
25
+            <arg value="release.sh"/>
26
+            <arg value="-t"/>
27
+            <arg value="-c"/>
28
+            <arg value="STABLE"/>
29
+            <arg value="--upload"/>
30
+        </exec>
31
+
32
+        <condition property="installer.success">
33
+            <equals arg1="${installer.result}" arg2="0" />
34
+        </condition>
35
+
36
+        <echo message="Installer build finished."/>
37
+        <echo message="Completed build files can be found in:"/>
38
+        <echo message="    ${installer.output.dir}"/>
39
+        <echo message=""/>
40
+    </target>
41
+
42
+    <target name="installer-unstable"
43
+            description="Build the installer for an unstable release.">
44
+        <exec executable="bash" dir="installer" resultproperty="installer.result">
45
+            <arg value="release.sh"/>
46
+            <arg value="-t"/>
47
+            <arg value="-c"/>
48
+            <arg value="UNSTABLE"/>
49
+        </exec>
50
+
51
+        <condition property="installer.success">
52
+            <equals arg1="${installer.result}" arg2="0" />
53
+        </condition>
54
+
55
+        <echo message="Installer build finished."/>
56
+        <echo message="Completed build files can be found in:"/>
57
+        <echo message="    ${installer.output.dir}"/>
58
+        <echo message=""/>
59
+    </target>
60
+
61
+
62
+</project>

+ 23
- 23
build-plugins.xml 查看文件

@@ -1,23 +1,23 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project name="DMDirc-plugins" default="default" basedir=".">
3
-
4
-    <!-- Netbeans property files -->
5
-    <property file="nbproject/project.properties"/>
6
-    <property file="nbproject/private/private.properties"/>
7
-    <property file="${user.properties.file}"/>
8
-    
9
-    <target name="build-plugins" description="Build all plugins">
10
-        <exec executable="bash">
11
-            <arg value="createAllPluginJar.sh"/>
12
-            <arg value="${src.dir}/com/dmdirc/addons/"/>
13
-        </exec>
14
-    </target>
15
-
16
-    <target name="-update-bundled-plugins">
17
-       <exec executable="bash">
18
-            <arg value="updateBundledPlugins.sh"/>
19
-            <arg value="${dist.jar}"/>
20
-       </exec>
21
-    </target>
22
-    
23
-</project>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project name="DMDirc-plugins" default="default" basedir=".">
3
+
4
+    <!-- Netbeans property files -->
5
+    <property file="nbproject/project.properties"/>
6
+    <property file="nbproject/private/private.properties"/>
7
+    <property file="${user.properties.file}"/>
8
+    
9
+    <target name="build-plugins" description="Build all plugins">
10
+        <exec executable="bash">
11
+            <arg value="createAllPluginJar.sh"/>
12
+            <arg value="${src.dir}/com/dmdirc/addons/"/>
13
+        </exec>
14
+    </target>
15
+
16
+    <target name="-update-bundled-plugins">
17
+       <exec executable="bash">
18
+            <arg value="updateBundledPlugins.sh"/>
19
+            <arg value="${dist.jar}"/>
20
+       </exec>
21
+    </target>
22
+    
23
+</project>

+ 24
- 24
build.xml 查看文件

@@ -1,24 +1,24 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project name="DMDirc" default="default" basedir=".">
3
-    <description>Builds, tests, and runs the project DMDirc.</description>
4
-
5
-    <import file="nbproject/build-impl.xml"/>
6
-    <import file="build-installer.xml"/>
7
-    <import file="build-jar.xml"/>
8
-    <import file="build-plugins.xml"/>
9
-    <import file="build-reports.xml"/>
10
-    <import file="build-tests.xml"/>
11
-    <import file="build-versioning.xml"/>
12
-
13
-    <target name="-submodules" if="submodule.update">
14
-        <exec executable="bash">
15
-            <arg value="updateSubModules.sh"/>
16
-        </exec>
17
-    </target>
18
-
19
-    <target name="-pre-init" depends="-submodules"/>
20
-    <target name="-post-compile" depends="-write-version, build-plugins, -addpluginlibs"/>
21
-    <target name="-post-test-run" depends="-do-test-reports"/>
22
-    <target name="-post-jar" depends="-addjarlibs,-update-bundled-plugins"/>
23
-
24
-</project>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project name="DMDirc" default="default" basedir=".">
3
+    <description>Builds, tests, and runs the project DMDirc.</description>
4
+
5
+    <import file="nbproject/build-impl.xml"/>
6
+    <import file="build-installer.xml"/>
7
+    <import file="build-jar.xml"/>
8
+    <import file="build-plugins.xml"/>
9
+    <import file="build-reports.xml"/>
10
+    <import file="build-tests.xml"/>
11
+    <import file="build-versioning.xml"/>
12
+
13
+    <target name="-submodules" if="submodule.update">
14
+        <exec executable="bash">
15
+            <arg value="updateSubModules.sh"/>
16
+        </exec>
17
+    </target>
18
+
19
+    <target name="-pre-init" depends="-submodules"/>
20
+    <target name="-post-compile" depends="-write-version, build-plugins, -addpluginlibs"/>
21
+    <target name="-post-test-run" depends="-do-test-reports"/>
22
+    <target name="-post-jar" depends="-addjarlibs,-update-bundled-plugins"/>
23
+
24
+</project>

+ 109
- 109
createPluginJar.sh 查看文件

@@ -1,109 +1,109 @@
1
-#!/bin/bash
2
-# This script will create a plugin jar file for a given plugin.
3
-
4
-. build-functions.sh
5
-
6
-VALID_EXTS="class,png,exe,dll,html,css,js,gif,py"
7
-
8
-if [ "${1}" = "" -o "${2}" = "" ]; then
9
-	echo "Usage Example: ${0} com.dmdirc.addons.windowstatus WindowStatusPlugin"
10
-	echo "The above would create WindowStatusPlugin.jar in the plugins/ folder of the current dir"
11
-	exit;
12
-fi
13
-
14
-destdir=${PWD}
15
-srcdir=${PWD}/modules/plugins/
16
-pluginname=${1}
17
-foldername=${pluginname//.//}
18
-
19
-if [ "${REBUILDPLUGINS}" != "true" ]; then
20
-	newer=`find ${srcdir}/src/${foldername} -type f -newer ${destdir}/plugins/${2}.jar 2>&1 | wc -l`
21
-	
22
-	if [ $newer -eq 0 ]; then
23
-		echo "${2}.jar appears to be up-to-date";
24
-		exit 0;
25
-	fi
26
-fi;
27
-
28
-echo "Creating ${2}.jar for ${pluginname} (${foldername})"
29
-
30
-if [ ! -e modules/plugins/src/${foldername}/plugin.config ]; then
31
-	echo "no plugin.config found";
32
-	exit 0;
33
-fi
34
-
35
-#echo "looking for classes"
36
-TMPDIR=`safe_mktemp $foldername`
37
-#echo "Using temp dir: ${TMPDIR}"
38
-cd $TMPDIR
39
-
40
-mkdir META-INF
41
-if [ -e "${srcdir}/src/${foldername}/plugin.config" ]; then
42
-	cp "${srcdir}/src/${foldername}/plugin.config" META-INF/
43
-fi;
44
-
45
-if [ -d "${srcdir}/src/${foldername}/licences/" ]; then
46
-	cp -r "${srcdir}/src/${foldername}/licences/" META-INF/licences/
47
-fi;
48
-
49
-if [ -d "${srcdir}/src/${foldername}/identities/" ]; then
50
-        cp -r "${srcdir}/src/${foldername}/identities/" META-INF/identities/
51
-fi;
52
-
53
-
54
-# Do the same for plugin.config
55
-# This is rudimentary, it a version: section already exists (eg to specify
56
-# friendlyversion) then it won't add the number= key.
57
-if [ -e META-INF/plugin.config ]; then
58
-	VERSIONLINE=`grep -n "version:$" META-INF/plugin.config | cut -f 1 -d ':'`
59
-
60
-	if [ -z "$VERSIONLINE" ]; then
61
-		sed 's/keysections:/keysections:\n  version/g' META-INF/plugin.config > META-INF/plugin.config.temp
62
-		rm -Rf META-INF/plugin.config
63
-		mv META-INF/plugin.config.temp META-INF/plugin.config		
64
-	fi;
65
-
66
-	GIT=`which git`
67
-	REV=$(${GIT} --git-dir "${srcdir}/.git" describe --tags `${GIT} --git-dir "${srcdir}/.git" rev-list --max-count=1 HEAD -- "src/${foldername}"`);
68
-
69
-	echo "" >> META-INF/plugin.config
70
-	echo "" >> META-INF/plugin.config
71
-	echo "version:" >> META-INF/plugin.config;
72
-	echo "  number=$REV" >> META-INF/plugin.config;
73
-fi;
74
-
75
-foo=`echo $foldername | sed -e 's/\/[^\/]*$//g'`
76
-mkdir -p "$foo"
77
-cd "${foo}"
78
-ln -s "${destdir}/build/classes/${foldername}" .
79
-cd "$TMPDIR"
80
-mkdir -p "${destdir}/plugins/"
81
-
82
-rm -Rf "${destdir}/plugins/${2}.jar"
83
-jar -cvf "${srcdir}/src/${foldername}/${2}.jar" META-INF >/dev/null
84
-bit=""
85
-while [ 1 -eq 1 ]; do
86
-	bit=${bit}/*
87
-	ls ${foo}${bit}/* >/dev/null 2>&1
88
-	if [ ${?} -ne 0 ]; then
89
-		break;
90
-	else
91
-		DIR="${PWD}"
92
-		for prepackage in `ls "${srcdir}/src/${foldername}${bit}/prePackage.sh" 2>/dev/null`; do
93
-			cd `dirname "${prepackage}"`
94
-			/bin/sh "${prepackage}"
95
-			cd ${DIR}
96
-		done;
97
-
98
-		FILES="ls -1 "${foo}${bit}/"*.{${VALID_EXTS}}"
99
-                FILES=`eval ${FILES} 2>/dev/null`
100
-
101
-		jar -uvf "${srcdir}/src/${foldername}/${2}.jar" ${FILES} >/dev/null
102
-	fi
103
-done
104
-
105
-mv "${srcdir}/src/${foldername}/${2}.jar" "${destdir}/plugins/"
106
-
107
-cd "${srcdir}"
108
-rm -Rf ${TMPDIR}
109
-#echo "done";
1
+#!/bin/bash
2
+# This script will create a plugin jar file for a given plugin.
3
+
4
+. build-functions.sh
5
+
6
+VALID_EXTS="class,png,exe,dll,html,css,js,gif,py"
7
+
8
+if [ "${1}" = "" -o "${2}" = "" ]; then
9
+	echo "Usage Example: ${0} com.dmdirc.addons.windowstatus WindowStatusPlugin"
10
+	echo "The above would create WindowStatusPlugin.jar in the plugins/ folder of the current dir"
11
+	exit;
12
+fi
13
+
14
+destdir=${PWD}
15
+srcdir=${PWD}/modules/plugins/
16
+pluginname=${1}
17
+foldername=${pluginname//.//}
18
+
19
+if [ "${REBUILDPLUGINS}" != "true" ]; then
20
+	newer=`find ${srcdir}/src/${foldername} -type f -newer ${destdir}/plugins/${2}.jar 2>&1 | wc -l`
21
+	
22
+	if [ $newer -eq 0 ]; then
23
+		echo "${2}.jar appears to be up-to-date";
24
+		exit 0;
25
+	fi
26
+fi;
27
+
28
+echo "Creating ${2}.jar for ${pluginname} (${foldername})"
29
+
30
+if [ ! -e modules/plugins/src/${foldername}/plugin.config ]; then
31
+	echo "no plugin.config found";
32
+	exit 0;
33
+fi
34
+
35
+#echo "looking for classes"
36
+TMPDIR=`safe_mktemp $foldername`
37
+#echo "Using temp dir: ${TMPDIR}"
38
+cd $TMPDIR
39
+
40
+mkdir META-INF
41
+if [ -e "${srcdir}/src/${foldername}/plugin.config" ]; then
42
+	cp "${srcdir}/src/${foldername}/plugin.config" META-INF/
43
+fi;
44
+
45
+if [ -d "${srcdir}/src/${foldername}/licences/" ]; then
46
+	cp -r "${srcdir}/src/${foldername}/licences/" META-INF/licences/
47
+fi;
48
+
49
+if [ -d "${srcdir}/src/${foldername}/identities/" ]; then
50
+        cp -r "${srcdir}/src/${foldername}/identities/" META-INF/identities/
51
+fi;
52
+
53
+
54
+# Do the same for plugin.config
55
+# This is rudimentary, it a version: section already exists (eg to specify
56
+# friendlyversion) then it won't add the number= key.
57
+if [ -e META-INF/plugin.config ]; then
58
+	VERSIONLINE=`grep -n "version:$" META-INF/plugin.config | cut -f 1 -d ':'`
59
+
60
+	if [ -z "$VERSIONLINE" ]; then
61
+		sed 's/keysections:/keysections:\n  version/g' META-INF/plugin.config > META-INF/plugin.config.temp
62
+		rm -Rf META-INF/plugin.config
63
+		mv META-INF/plugin.config.temp META-INF/plugin.config		
64
+	fi;
65
+
66
+	GIT=`which git`
67
+	REV=$(${GIT} --git-dir "${srcdir}/.git" describe --tags `${GIT} --git-dir "${srcdir}/.git" rev-list --max-count=1 HEAD -- "src/${foldername}"`);
68
+
69
+	echo "" >> META-INF/plugin.config
70
+	echo "" >> META-INF/plugin.config
71
+	echo "version:" >> META-INF/plugin.config;
72
+	echo "  number=$REV" >> META-INF/plugin.config;
73
+fi;
74
+
75
+foo=`echo $foldername | sed -e 's/\/[^\/]*$//g'`
76
+mkdir -p "$foo"
77
+cd "${foo}"
78
+ln -s "${destdir}/build/classes/${foldername}" .
79
+cd "$TMPDIR"
80
+mkdir -p "${destdir}/plugins/"
81
+
82
+rm -Rf "${destdir}/plugins/${2}.jar"
83
+jar -cvf "${srcdir}/src/${foldername}/${2}.jar" META-INF >/dev/null
84
+bit=""
85
+while [ 1 -eq 1 ]; do
86
+	bit=${bit}/*
87
+	ls ${foo}${bit}/* >/dev/null 2>&1
88
+	if [ ${?} -ne 0 ]; then
89
+		break;
90
+	else
91
+		DIR="${PWD}"
92
+		for prepackage in `ls "${srcdir}/src/${foldername}${bit}/prePackage.sh" 2>/dev/null`; do
93
+			cd `dirname "${prepackage}"`
94
+			/bin/sh "${prepackage}"
95
+			cd ${DIR}
96
+		done;
97
+
98
+		FILES="ls -1 "${foo}${bit}/"*.{${VALID_EXTS}}"
99
+                FILES=`eval ${FILES} 2>/dev/null`
100
+
101
+		jar -uvf "${srcdir}/src/${foldername}/${2}.jar" ${FILES} >/dev/null
102
+	fi
103
+done
104
+
105
+mv "${srcdir}/src/${foldername}/${2}.jar" "${destdir}/plugins/"
106
+
107
+cd "${srcdir}"
108
+rm -Rf ${TMPDIR}
109
+#echo "done";

+ 59
- 59
updateBundledPlugins.sh 查看文件

@@ -1,59 +1,59 @@
1
-#!/bin/bash
2
-# updateBundledPlugins.sh <jar>
3
-# 
4
-# Reads the version of each bundled plugin in the specified jar, and writes
5
-# the names and versions to the jar's version.config file.
6
-
7
-. build-functions.sh
8
-
9
-jar=$1
10
-dir=`safe_mktemp $jar`
11
-config="$dir/com/dmdirc/version.config"
12
-jar="`pwd`/$jar"
13
-
14
-cd $dir
15
-# Read the jar's version.config out
16
-jar -xf $jar
17
-
18
-# Check for previous data
19
-startOffset=`grep -n "Begin updateBundledPlugins.sh" $config | head -n 1 | cut -f 1 -d ':'`
20
-endOffset=`grep -n "End updateBundledPlugins.sh" $config | tail -n 1 | cut -f 1 -d ':'`
21
-
22
-if [ -n "$startOffset" -a -n "$endOffset" ]; then
23
- # Previous data found, let's get rid of it
24
-
25
- head -n $(($startOffset-2)) $config >> $config.tmp;
26
- tail -n +$(($endOffset+1)) $config >> $config.tmp;
27
-
28
- mv $config.tmp $config;
29
-fi;
30
-
31
-# Add our new sections
32
-echo "" >> $config;
33
-echo "# --- Begin updateBundledPlugins.sh (`date`) --- " >> $config
34
-echo "keysections:" >> $config;
35
-echo "    bundledplugins_versions" >> $config;
36
-echo "" >> $config;
37
-echo "bundledplugins_versions:" >> $config;
38
-
39
-# For each plugin in the jar...
40
-for plugin in `ls plugins/* | cut -f 2 -d '/'`; do
41
- pluginName=${plugin%.jar}
42
-
43
- # Extract it to our temporary dir (can't extract zip files from stdin)
44
- jar -xf plugins/$plugin;
45
- # Read the plugin.config file and parse out the version number
46
- version=`cat META-INF/plugin.config | grep -1 version: | grep number= | cut -f 2 -d '='`;
47
-
48
- # And add the version to our version.config
49
- echo "    $pluginName=$version" >> $config;
50
-done;
51
-
52
-echo "# --- End updateBundledPlugins.sh --- " >> $config;
53
-
54
-# Update the version in the jar
55
-jar uf $jar -C $dir com/dmdirc/version.config;
56
-
57
-# Remove the temporary directory
58
-cd ..
59
-rm -rf $dir;
1
+#!/bin/bash
2
+# updateBundledPlugins.sh <jar>
3
+# 
4
+# Reads the version of each bundled plugin in the specified jar, and writes
5
+# the names and versions to the jar's version.config file.
6
+
7
+. build-functions.sh
8
+
9
+jar=$1
10
+dir=`safe_mktemp $jar`
11
+config="$dir/com/dmdirc/version.config"
12
+jar="`pwd`/$jar"
13
+
14
+cd $dir
15
+# Read the jar's version.config out
16
+jar -xf $jar
17
+
18
+# Check for previous data
19
+startOffset=`grep -n "Begin updateBundledPlugins.sh" $config | head -n 1 | cut -f 1 -d ':'`
20
+endOffset=`grep -n "End updateBundledPlugins.sh" $config | tail -n 1 | cut -f 1 -d ':'`
21
+
22
+if [ -n "$startOffset" -a -n "$endOffset" ]; then
23
+ # Previous data found, let's get rid of it
24
+
25
+ head -n $(($startOffset-2)) $config >> $config.tmp;
26
+ tail -n +$(($endOffset+1)) $config >> $config.tmp;
27
+
28
+ mv $config.tmp $config;
29
+fi;
30
+
31
+# Add our new sections
32
+echo "" >> $config;
33
+echo "# --- Begin updateBundledPlugins.sh (`date`) --- " >> $config
34
+echo "keysections:" >> $config;
35
+echo "    bundledplugins_versions" >> $config;
36
+echo "" >> $config;
37
+echo "bundledplugins_versions:" >> $config;
38
+
39
+# For each plugin in the jar...
40
+for plugin in `ls plugins/* | cut -f 2 -d '/'`; do
41
+ pluginName=${plugin%.jar}
42
+
43
+ # Extract it to our temporary dir (can't extract zip files from stdin)
44
+ jar -xf plugins/$plugin;
45
+ # Read the plugin.config file and parse out the version number
46
+ version=`cat META-INF/plugin.config | grep -1 version: | grep number= | cut -f 2 -d '='`;
47
+
48
+ # And add the version to our version.config
49
+ echo "    $pluginName=$version" >> $config;
50
+done;
51
+
52
+echo "# --- End updateBundledPlugins.sh --- " >> $config;
53
+
54
+# Update the version in the jar
55
+jar uf $jar -C $dir com/dmdirc/version.config;
56
+
57
+# Remove the temporary directory
58
+cd ..
59
+rm -rf $dir;

正在加载...
取消
保存