Unix Startup Script

From VuzeWiki
Jump to: navigation, search

Linux/Unix Startup Script[edit]


From time to time, azureus startup script will need to be changed to handle new features or to fix existing bugs. Since we can't just overwrite your old ./azureus script (especially if you modified it or installed Azureus via a distro), this page is meant to walk you through what you need to do.

Manually updating your start script[edit]

If you downloaded and installed Azureus from SourceForge, Vuze, or Zudeo, AND you have made no modifications to the startup script, you can safely replace the new one with the old one. When there is a new startup script available, you will be informed via a message box. Simply copy the new one over the old one and re-run azureus.

If you manually edited your azureus script only to set the JAVA_PROGRAM_DIR or PROGRAM_DIR variables, or to set java runtime settings, copy or make note of those lines from your edited script. Then, copy in the new script, edit it and paste those lines back in.

If you've done major changes to the script, the first thing you need to do is find your existing startup script version. Search the script for "SCRIPT_VERSION=". If there are no matches, you have version 0. Read the sections describing the changes between your version and the latest version to get and idea of what you need to change (and why).

Note to distros[edit]

Please keep your script up to date. While you may not need all the directory scanning and version verification script code, you may need to know if you have to set new variables or pass in new parameters. (For example, Version 1 adds and entry LD_LIBRARY_PATH so that Azureus can display a browser window)

The latest script[edit]



VERSION 1[edit]

The primary reason for this change is to allow azureus to insert shell script commands before and after azureus runs. The initial use of this is to find where your Gecko Engine/XULRunner is and add it to your LD_LIBRARY_PATH. The secondary use of this is to allow Azureus to restart/update via a script action, instead of the older, clunkier way of trying to run Java over again.

1) Set SCRIPT_VERSION string


2) You need to add the following function to your script:

	${JAVA_PROGRAM_DIR}java "${JAVA_ARGS}" -cp "${CLASSPATH}" -Djava.library.path="${PROGRAM_DIR}" -Dazureus.install.path="${PROGRAM_DIR}" -Dazureus.script.version="${SCRIPT_VERSION}" -Dazureus.script="$0" ${1} > ~/azScript
	if [ -f ~/azScript ]; then
		chmod +x ~/azScript
		. ~/azScript
		rm ~/azScript

3) Just before running azureus (launching java), add the following line. Note that this should be AFTER you set LD_LIBRARY_PATH (if you do that)

runJavaOutput "org.gudy.azureus2.platform.unix.ScriptBeforeStartup";

4) Add two java system properties when launching azureus:

-Dazureus.script.version="${SCRIPT_VERSION}" -Dazureus.script="$0"

5) Just after running azureus, add this line:

runJavaOutput "org.gudy.azureus2.platform.unix.ScriptAfterShutdown";

VERSION 2[edit]

Version 2 passes all the command line arguments to the "runJavaOutput()" function. This is needed because ScriptBeforeStartup will check to see if Azureus is running, and if it is, pass the parameters to it.

1) Set SCRIPT_VERSION string


2) Update the runJavaOutput function you created in version 1 to:

	# assume we can write to the user's home..

		-cp "${CLASSPATH}" \
		-Djava.library.path="${PROGRAM_DIR}" \
		-Dazureus.install.path="${PROGRAM_DIR}" \
		-Dazureus.script="$0" \
		"$@" > ~/azScript
	if [ -f ~/azScript ]; then
		chmod +x ~/azScript
		. ~/azScript
		rm ~/azScript

(The difference is that ${1} was turned into "$@")

3) Update the two runJavaOutput calls to:

runJavaOutput "org.gudy.azureus2.platform.unix.ScriptBeforeStartup" "$@";


runJavaOutput "org.gudy.azureus2.platform.unix.ScriptAfterShutdown" "$@";

("$@" was appended to the call)