Skip to content

Batch files fix etc #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/*.zip
/temp/
/test-lib/
**/*.class
8 changes: 6 additions & 2 deletions bin/initdb.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ setlocal

set JAVA_OPTS=-Xmx64m

rem Guess SQLITED_HOME if not defined
rem set SQLITED_HOME
set "CURRENT_DIR=%cd%"
set "SQLITED_HOME=%CURRENT_DIR%"
cd /d %~dp0
cd ..
set "SQLITED_HOME=%cd%"
cd /d %CURRENT_DIR%

if exist "%SQLITED_HOME%\bin\sqlited.bat" goto okHome
cd ..
set "SQLITED_HOME=%cd%"
Expand Down
8 changes: 4 additions & 4 deletions bin/sqlited.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ rem Sqlited script for the SQLite Server
rem ---------------------------------------------------------------------------
setlocal

rem Guess SQLITED_HOME if not defined
rem set SQLITED_HOME
set "CURRENT_DIR=%cd%"
set "SQLITED_HOME=%CURRENT_DIR%"
if exist "%SQLITED_HOME%\bin\sqlited.bat" goto okHome
cd /d %~dp0
cd ..
set "SQLITED_HOME=%cd%"
cd /d "%CURRENT_DIR%"
cd /d %CURRENT_DIR%

if exist "%SQLITED_HOME%\bin\sqlited.bat" goto okHome
echo The SQLITED_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
Expand Down
8 changes: 4 additions & 4 deletions bin/startup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ setlocal

set JAVA_OPTS=-Xmx256m

rem Guess SQLITED_HOME if not defined
rem set SQLITED_HOME
set "CURRENT_DIR=%cd%"
set "SQLITED_HOME=%CURRENT_DIR%"
if exist "%SQLITED_HOME%\bin\sqlited.bat" goto okHome
cd /d %~dp0
cd ..
set "SQLITED_HOME=%cd%"
cd /d "%CURRENT_DIR%"
cd /d %CURRENT_DIR%

if exist "%SQLITED_HOME%\bin\sqlited.bat" goto okHome
echo The SQLITED_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
Expand Down
8 changes: 6 additions & 2 deletions docs/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ Require OracleJDK or openJDK 7+, Apache Maven 3.6.1+, and modern OS such as Cent
macOS 10.13.x, or Windows 8.1 above.
First we must set the JAVA_HOME environment variable, then add MAVEN_HOME/bin append to PATH.

## Build on CentOS 7
## Build binary distribution with maven
mvn clean package
The zip file can be found under target directory

## Build on CentOS 7 with source
```bash
tar -xzvf ./sqlited-x.y.z.tar.gz
cd sqlite-server-sqlited-x.y.z
chmod +x bin/*.sh
./bin/build.sh clean test jar
```

## Build on Windows 8.1
## Build on Windows with unzipped source
```shell
cd sqlite-server-sqlited-x.y.z
.\bin\build.bat clean test jar
Expand Down
94 changes: 81 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,88 @@
<sqlite-jdbc.version>3.30.1</sqlite-jdbc.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<excludes>
<exclude>logback.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>

<finalName>${project.artifactId}-${project.version}-bin</finalName>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<excludes>
<exclude>logback.xml</exclude>
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>

<dependencies>
Expand Down
55 changes: 55 additions & 0 deletions src/main/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>sqlite-server-*.jar</include>
<include>sqlite-jdbc-*.jar</include>
<include>slf4j-api-*.jar</include>
<include>logback-core-*.jar</include>
<include>logback-classic-*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/bin</directory>
<outputDirectory>/bin</outputDirectory>
<excludes>
<exclude>**/build.*</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/conf</directory>
<outputDirectory>/conf</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/docs</directory>
<outputDirectory>/docs</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README.md</include>
</includes>
</fileSet>
</fileSets>
</assembly>
3 changes: 1 addition & 2 deletions src/main/java/org/sqlite/server/SQLiteAuthMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void init(String user, String storePassword) {

public abstract String getName();

@Override
public abstract boolean equals(Object o);
public abstract boolean authenticate(Object o);

}
3 changes: 1 addition & 2 deletions src/main/java/org/sqlite/server/pg/CleartextPassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public byte[] encode() {
return ConvertUtils.hexBytes(this.storePassword);
}

@Override
public boolean equals(Object o) {
public boolean authenticate(Object o) {
if (this == o) {
return true;
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/sqlite/server/pg/MD5Password.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public byte[] encode() {
}
}

@Override
public boolean equals(Object o) {
public boolean authenticate(Object o) {
if (this == o) {
return true;
}
Expand All @@ -104,7 +103,7 @@ public boolean equals(Object o) {
String md5s = (String)o;
try {
byte[] md5 = md5s.getBytes(ENCODING);
return (equals(md5));
return (Arrays.equals(encode(), md5));
} catch (UnsupportedEncodingException e) {
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/sqlite/server/pg/PgProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static void checkParamLength(int expected, int got) throws IOException {
}
}

@Override

protected void process() throws IOException {
PgServer server = getServer();
SQLiteWorker worker = this.worker;
Expand Down Expand Up @@ -382,7 +382,7 @@ protected void process() throws IOException {
this.needFlush = true;

String password = readString();
if (!this.authMethod.equals(password)) {
if (!this.authMethod.authenticate(password)) {
sendErrorAuth();
break;
}
Expand Down Expand Up @@ -606,6 +606,7 @@ protected void process() throws IOException {
break;
}
default:
// TODO: This should be an error condition, should fail and fix for unknown message from normal use
server.trace(log, "Unsupported message: type {}(c) {}", (char) x, x);
break;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/sqlite/server/pg/TrustAuthMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public String genStorePassword(String user, String password) {
return null;
}

@Override
public boolean equals(Object o) {
public boolean authenticate(Object o) {
return true;
}

Expand Down