Lumaqq Startup Script
#! /Bin/bash
# Determine the type of the execution file. If it is a symbolic link, the target path of the link will be obtained. In previous versions, this task uses
# Readlink-F command is complete. This method is slightly problematic. For example, your system may not have the readlink command or a lower version
# Readlink does not support the-F parameter, so readlink is used here. If readlink fails, the file command and one
# Obtain the target path through pattern matching. Currently, I'm not sure whether the file command on every Linux page returns the string symbolic link,
# If not, replace symbolic link to with the one returned by your file command.
Prefix =
If [-L "$0"]; then
Prefix = 'readlink-F $0'
If [$? -EQ 0]; then
Prefix = 'dirname $ prefix'
Else
Prefix = 'file $0'
Prefix =$ {prefix ## * symbolic link}
Prefix = 'dirname $ prefix'
Fi
Else
Prefix = 'dirname $0'
Fi
# Here I will determine whether the obtained path is an absolute path. If not
# Path. I need to perform some operations to obtain the absolute path.
Case $ prefix in
/*)
;;
*)
CD $ prefix
Prefix = 'pwd'
;;
Esac
# Check whether the. lumaqq directory exists in your user directory. If not,
# One will be automatically created, and all QQ-related information of the user will be saved in this
# Directory, so on a machine with multiple users, you should set this directory
# Become your readable
If [! -E $ home/. lumaqq]; then
Mkdir $ home/. lumaqq
Fi
# Here are some links to some lumaqq directories and files.
# The-F parameter, so even if you move the lumaqq directory to another place
# The next operation will not be affected
CD $ home/. lumaqq
Ln-SF $ prefix/log4j. properties $ home/. lumaqq/log4j. Properties
Ln-SF $ prefix/XML
Ln-SF $ prefix/sound
Ln-SF $ prefix/qqwry. dat $ home/. lumaqq/qqwry. dat
# Here I set Java to the class path. The lib directory under the lumaqq installation directory
# Contains all jar files to be used. These files must be added to the class path.
CP =
For I in $ prefix/lib/*. jar; do
CP = $ I: $ CP
Done
# This operation is started. For your convenience, try three cases. First, check whether your installation has the JRE version. If yes
# Use the built-in JRE. If it fails, check whether java_home is set. If it is set, use java_home. If it still fails,
# Find an available JRE under/usr. If there is no under/usr, search for jre under/OPT. If there is no under/OPT,
# Search for the JRE in the user's home directory. If the JRE still cannot be found, it will actually fail.
If [-e $ prefix/Java]; then
$ Prefix/Java/bin/Java-djava. Library. Path = $ prefix/SWT-classpath $ CP edu. Tsinghua. lumaqq. lumaqq "$ home/. lumaqq "&
Elif [! -Z $ java_home]; then
$ Java_home/bin/Java-djava. Library. Path = $ prefix/SWT-classpath $ CP edu. Tsinghua. lumaqq. lumaqq "$ home/. lumaqq "&
Else
Found = 0
For I in 'Find/usr-name "Java" | grep bin'; do
If [-X "$ I"]; then
$ I-djava. Library. Path = $ prefix/SWT-classpath $ CP edu. Tsinghua. lumaqq. lumaqq "$ home/. lumaqq "&
Found = 1
Break
Fi
Done
If [$ found-EQ 0]; then
For I in 'Find/opt-name "Java" | grep bin'; do
If [-X "$ I"]; then
$ I-djava. Library. Path = $ prefix/SWT-classpath $ CP edu. Tsinghua. lumaqq. lumaqq "$ home/. lumaqq "&
Found = 1
Break
Fi
Done
Fi
If [$ found-EQ 0]; then
For I in 'Find $ home-name "Java" | grep bin'; do
If [-X "$ I"]; then
$ I-djava. Library. Path = $ prefix/SWT-classpath $ CP edu. Tsinghua. lumaqq. lumaqq "$ home/. lumaqq "&
Break
Fi
Done
Fi
Fi