Compare commits
27 Commits
Author | SHA1 | Date |
---|---|---|
Jonas Letzbor | 6f12dec170 | |
Jonas Letzbor | c95e6a1b14 | |
Jonas Letzbor | aaf2073b51 | |
Jonas Letzbor | 017956ffef | |
Jonas Letzbor | 0090eec1c9 | |
Jonas Letzbor | 3e289e756a | |
Jonas Letzbor | 31dcd1ebe8 | |
Jonas Letzbor | 83d5f8c000 | |
Jonas Letzbor | b24dbd1dfb | |
Jonas Letzbor | b683978039 | |
Jonas Letzbor | 5a198decb4 | |
Jonas Letzbor | 3d63f17ca1 | |
Jonas Letzbor | 0c65ad04c7 | |
Jonas Letzbor | 9a0e00f474 | |
Jonas Letzbor | 6e25ffd730 | |
Jonas Letzbor | 48528d3cb2 | |
Jonas Letzbor | 8af05c8f0b | |
Jonas Letzbor | cac41b53be | |
Jonas Letzbor | 41f71857b7 | |
Jonas Letzbor | 84a827de40 | |
Jonas Letzbor | 8549ec30b1 | |
Jonas Letzbor | d6095d73f7 | |
Jonas Letzbor | cf4a97ac2c | |
Jonas Letzbor | f54ea5bdd6 | |
Jonas Letzbor | 17371561dd | |
Jonas Letzbor | 3ddf33803e | |
Jonas Letzbor | e521a25dd5 |
|
@ -1,2 +1,74 @@
|
||||||
## Release Folder ##
|
## Release and build folder ##
|
||||||
/01_Publish/
|
[Rr]elease/
|
||||||
|
[Bb]uild
|
||||||
|
|
||||||
|
# Eclipse #
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.recommenders
|
||||||
|
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# PyDev specific (Python IDE for Eclipse)
|
||||||
|
*.pydevproject
|
||||||
|
|
||||||
|
# CDT-specific (C/C++ Development Tooling)
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# CDT- autotools
|
||||||
|
.autotools
|
||||||
|
|
||||||
|
# Java annotation processor (APT)
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# PDT-specific (PHP Development Tools)
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
# sbteclipse plugin
|
||||||
|
.target
|
||||||
|
|
||||||
|
# Tern plugin
|
||||||
|
.tern-project
|
||||||
|
|
||||||
|
# TeXlipse plugin
|
||||||
|
.texlipse
|
||||||
|
|
||||||
|
# STS (Spring Tool Suite)
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
# Code Recommenders
|
||||||
|
.recommenders/
|
||||||
|
|
||||||
|
# Annotation Processing
|
||||||
|
.apt_generated/
|
||||||
|
.apt_generated_test/
|
||||||
|
|
||||||
|
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||||
|
.cache-main
|
||||||
|
.scala_dependencies
|
||||||
|
.worksheet
|
||||||
|
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.gradle
|
||||||
|
/gradle.properties
|
||||||
|
|
||||||
|
# Space for private notes
|
||||||
|
/notes
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>de.rpjosh.installer</name>
|
||||||
|
<comment>Project de.rpjosh.installer created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>0</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1672944921592</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,68 @@
|
||||||
|
pipeline {
|
||||||
|
|
||||||
|
agent {
|
||||||
|
// Use the kubernetes agent
|
||||||
|
kubernetes {
|
||||||
|
label 'java-17-gradle-8'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
container('java-17-gradle-8') {
|
||||||
|
|
||||||
|
script {
|
||||||
|
|
||||||
|
if (env.GIT_BRANCH != "main" && env.GIT_BRANCH != "master") {
|
||||||
|
// Only test to build the installer when we are not on the master branch
|
||||||
|
sh 'gradle --no-build-cache build'
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Get the version to release
|
||||||
|
def version = sh (
|
||||||
|
script: 'git describe --tags --abbrev=0',
|
||||||
|
returnStdout: true
|
||||||
|
).replace("\n", "")
|
||||||
|
if (version == null || version.allWhitespace) {
|
||||||
|
error("Commit is not tagged with a version")
|
||||||
|
}
|
||||||
|
def versionV = version.replaceFirst("v", "")
|
||||||
|
|
||||||
|
// Write the version into the version file
|
||||||
|
sh "echo ${versionV} > VERSION"
|
||||||
|
echo "Building and publishing version ${versionV}"
|
||||||
|
|
||||||
|
// Build and publish
|
||||||
|
withCredentials([
|
||||||
|
file(credentialsId: 'MAVEN_PUBLISH_SONATYPE_GRADLE_PROPERTIES', variable: 'SONATYPE_CREDENTIALS')
|
||||||
|
]) {
|
||||||
|
// Build and publish
|
||||||
|
sh 'cp \${SONATYPE_CREDENTIALS} ./gradle.properties'
|
||||||
|
sh 'gradle --no-build-cache build publishToMavenLocal publishToSonatype closeAndReleaseSonatypeStagingRepository --warning-mode all'
|
||||||
|
sh 'rm ./gradle.properties'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo "Build successfull"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean after build
|
||||||
|
cleanup {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
|
||||||
|
failure {
|
||||||
|
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
|
||||||
|
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
||||||
|
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
884
LICENSE
884
LICENSE
|
@ -1,232 +1,662 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
software for all its users.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
The precise terms and conditions for copying, distribution and modification follow.
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
TERMS AND CONDITIONS
|
and/or modify the software.
|
||||||
|
|
||||||
0. Definitions.
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
“This License” refers to version 3 of the GNU General Public License.
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
source code to the public.
|
||||||
|
|
||||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
code of the modified version.
|
||||||
|
|
||||||
1. Source Code.
|
An older license, called the Affero General Public License and
|
||||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
modification follow.
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that same work.
|
0. Definitions.
|
||||||
|
|
||||||
2. Basic Permissions.
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
"recipients" may be individuals or organizations.
|
||||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
4. Conveying Verbatim Copies.
|
earlier work or a work "based on" the earlier work.
|
||||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
on the Program.
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
To "propagate" a work means to do anything with it that, without
|
||||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
6. Conveying Non-Source Forms.
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
1. Source Code.
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
form of a work.
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
7. Additional Terms.
|
(kernel, window system, and so on) of the specific operating system
|
||||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
Source.
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
|
||||||
|
2. Basic Permissions.
|
||||||
8. Termination.
|
|
||||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
You may make, run and propagate covered works that you do not
|
||||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
of having them make modifications exclusively for you, or provide you
|
||||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
11. Patents.
|
|
||||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
makes it unnecessary.
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
measures.
|
||||||
|
|
||||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
12. No Surrender of Others' Freedom.
|
modification of the work as a means of enforcing, against the work's
|
||||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
You may convey verbatim copies of the Program's source code as you
|
||||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
15. Disclaimer of Warranty.
|
and you may offer support or warranty protection for a fee.
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
16. Limitation of Liability.
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
17. Interpretation of Sections 15 and 16.
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
END OF TERMS AND CONDITIONS
|
it, and giving a relevant date.
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
License to anyone who comes into possession of a copy. This
|
||||||
Copyright (C) <year> <name of author>
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
|
@ -1,57 +0,0 @@
|
||||||
# Eclipse #
|
|
||||||
.metadata
|
|
||||||
bin/
|
|
||||||
tmp/
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
.recommenders
|
|
||||||
|
|
||||||
# External tool builders
|
|
||||||
.externalToolBuilders/
|
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
|
||||||
*.launch
|
|
||||||
|
|
||||||
# PyDev specific (Python IDE for Eclipse)
|
|
||||||
*.pydevproject
|
|
||||||
|
|
||||||
# CDT-specific (C/C++ Development Tooling)
|
|
||||||
.cproject
|
|
||||||
|
|
||||||
# CDT- autotools
|
|
||||||
.autotools
|
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
|
||||||
.factorypath
|
|
||||||
|
|
||||||
# PDT-specific (PHP Development Tools)
|
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# Tern plugin
|
|
||||||
.tern-project
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
# STS (Spring Tool Suite)
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
# Code Recommenders
|
|
||||||
.recommenders/
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated/
|
|
||||||
.apt_generated_test/
|
|
||||||
|
|
||||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
|
||||||
.cache-main
|
|
||||||
.scala_dependencies
|
|
||||||
.worksheet
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
|
||||||
</classpath>
|
|
|
@ -1,6 +0,0 @@
|
||||||
#
|
|
||||||
# https://help.github.com/articles/dealing-with-line-endings/
|
|
||||||
#
|
|
||||||
# These are explicitly windows files and should use crlf
|
|
||||||
*.bat text eol=crlf
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# Ignore Gradle project-specific cache directory
|
|
||||||
.gradle
|
|
||||||
|
|
||||||
# Ignore Gradle build output directory
|
|
||||||
build
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>tk.rpjosh.installer</name>
|
|
||||||
<comment>Project tk.rpjosh.installer created by Buildship.</comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,118 +0,0 @@
|
||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*
|
|
||||||
* This generated file contains a sample Java Library project to get you started.
|
|
||||||
* For more details take a look at the Java Libraries chapter in the Gradle
|
|
||||||
* User Manual available at https://docs.gradle.org/6.6.1/userguide/java_library_plugin.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
// Apply the java-library plugin to add support for Java Library
|
|
||||||
id 'java-library'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Anpassungsmöglichkeiten //
|
|
||||||
|
|
||||||
version = "1.0.0"
|
|
||||||
group = "tk.rpjosh"
|
|
||||||
|
|
||||||
def version = "1.0.0"
|
|
||||||
|
|
||||||
// ----- //
|
|
||||||
|
|
||||||
|
|
||||||
sourceCompatibility = 11
|
|
||||||
targetCompatibility = 11
|
|
||||||
|
|
||||||
// create a single Jar with all Dependancies //
|
|
||||||
task fatJar(type: Jar) {
|
|
||||||
classifier = ''
|
|
||||||
manifest {
|
|
||||||
attributes( 'Implementation-Title': 'installer',
|
|
||||||
'Implementation-Version': version,
|
|
||||||
'Implementation-Group': project.group, )
|
|
||||||
}
|
|
||||||
|
|
||||||
archivesBaseName = "installer"
|
|
||||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
||||||
{
|
|
||||||
exclude "META-INF/*.SF"
|
|
||||||
exclude "META-INF/*.DSA"
|
|
||||||
exclude "META-INF/*.RSA"
|
|
||||||
}
|
|
||||||
|
|
||||||
with jar
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
manifest {
|
|
||||||
attributes( 'Implementation-Title': 'installer',
|
|
||||||
'Implementation-Version': version,
|
|
||||||
'Implementation-Group': project.group, )
|
|
||||||
}
|
|
||||||
classifier = 'javadoc'
|
|
||||||
from javadoc.destinationDir
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives fatJar
|
|
||||||
archives sourcesJar
|
|
||||||
archives javadocJar
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//java {
|
|
||||||
// withJavadocJar()
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// the created jar file will be copied automatically into the 01_Publish directory
|
|
||||||
task copyJar(type: Copy) {
|
|
||||||
|
|
||||||
from file("$buildDir/libs/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
|
|
||||||
into file("$buildDir/../../../01_Publish")
|
|
||||||
}
|
|
||||||
|
|
||||||
// build the maven repo file structure -> java doc can be used easily in eclipse
|
|
||||||
task copyJarToMaven (type: Copy) {
|
|
||||||
|
|
||||||
from file("$buildDir/libs/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
|
|
||||||
into file("$buildDir/../../../01_Publish/mavenRepo/tk/rpjosh/installer/" + version)
|
|
||||||
}
|
|
||||||
|
|
||||||
build.finalizedBy copyJar
|
|
||||||
build.finalizedBy copyJarToMaven
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Use jcenter for resolving dependencies.
|
|
||||||
// You can declare any Maven/Ivy/file repository here.
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// This dependency is exported to consumers, that is to say found on their compile classpath.
|
|
||||||
api 'org.apache.commons:commons-math3:3.6.1'
|
|
||||||
|
|
||||||
// Use JUnit test framework
|
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.github.vatbub/mslinks
|
|
||||||
api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.1'
|
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/commons-io/commons-io
|
|
||||||
api group: 'commons-io', name: 'commons-io', version: '2.10.0'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named('jar') {
|
|
||||||
manifest {
|
|
||||||
attributes( 'Implementation-Title': 'installer',
|
|
||||||
'Implementation-Version': version,
|
|
||||||
'Implementation-Group': 'tk.rpjosh', )
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,185 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## Gradle start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=`save "$@"`
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*
|
|
||||||
* The settings file is used to specify which projects to include in your build.
|
|
||||||
*
|
|
||||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
|
||||||
* in the user manual at https://docs.gradle.org/6.6.1/userguide/multi_project_builds.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
rootProject.name = 'tk.rpjosh.installer'
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
* This Java source file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
package tk.rpjosh.installer;
|
|
||||||
|
|
||||||
public class Library {
|
|
||||||
public boolean someLibraryMethod() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,182 +0,0 @@
|
||||||
package tk.rpjosh.installer;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.security.CodeSource;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
|
|
||||||
public class RunInConsole {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Öffnet das Programm in der Konsole, falls dieses noch nicht in solch einer ausgeführt wird
|
|
||||||
* @param keepOpen Ob die Konsole nach dem Durchlauf des Programms geschlossen werden soll
|
|
||||||
*/
|
|
||||||
public static void start(boolean keepOpen) {
|
|
||||||
start (keepOpen, null, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Öffnet das Programm in der Konsole, falls dieses noch nicht in solch einer ausgeführt wird
|
|
||||||
* @param args Mit welchen Parametern die Main-Methode beliefert werden soll
|
|
||||||
* @param keepOpen Ob die Konsole nach dem durchlauf des Programms geöffnet bleiben soll
|
|
||||||
*/
|
|
||||||
public static void start(String[] args, boolean keepOpen) {
|
|
||||||
start(keepOpen, args, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Öffnet das Programm in der Konsole
|
|
||||||
* @param args Mit welchen Parametern die Main-Methode beliefert werden soll
|
|
||||||
* @param keepOpen Ob die Konsole nach dem durchlauf des Programms geöffnet bleiben soll
|
|
||||||
* @param forceRestart Ob ein Neustart gemacht werden soll, wenn das Programm bereits in der Konsole läuft
|
|
||||||
* @param asAdmin Ob das Programm mit Administratorprivelegien gestartet werden soll (Powershell muss installiert sein)
|
|
||||||
*/
|
|
||||||
public static void start(String[] args, boolean keepOpen, boolean forceRestart, boolean asAdmin) {
|
|
||||||
start(keepOpen, args, forceRestart, asAdmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void start(boolean keepOpen, final String[] args, boolean forceRestart, boolean asAdmin) {
|
|
||||||
|
|
||||||
String executableName = getExecutableName();
|
|
||||||
|
|
||||||
// wird vermutlich in einer IDE ausgeführt
|
|
||||||
if (executableName == null) return;
|
|
||||||
// wird bereits in der Konsole ausgeführt
|
|
||||||
if (System.console() != null && !forceRestart) return;
|
|
||||||
|
|
||||||
startExecutableInConsole(executableName, keepOpen, asAdmin, args);
|
|
||||||
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Öffnen ein Konsolenfenster und startet in diesem die Jar-Datei
|
|
||||||
*
|
|
||||||
* @param executableName Der Name der Jar-Datei (ohne Pfad -> relativ)
|
|
||||||
* @param stayOpenAfterEnd Ob das Konsolenfenster nach dem vollständigen durchlauf der Jar-Datei geschlossen werden soll
|
|
||||||
* @param asAdmin Ob das Programm mit Administratorprivelegien gestartet werden soll (Powershell muss installiert sein)
|
|
||||||
*/
|
|
||||||
private static void startExecutableInConsole(String executableName, final boolean keepOpen, final boolean asAdmin, String[] args) {
|
|
||||||
|
|
||||||
String command = null;
|
|
||||||
|
|
||||||
// es müssen nun noch die Parameter ermittelt werden
|
|
||||||
String strArgs = "";
|
|
||||||
for (String currentArg: args) {
|
|
||||||
strArgs += "\"" + currentArg + "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (InstallConfig.getOsType()) {
|
|
||||||
case UNDETERMINED: break;
|
|
||||||
case WINDOWS:
|
|
||||||
if (!asAdmin) {
|
|
||||||
if (keepOpen) command = "cmd /c start cmd /k java -jar \"" + executableName + "\" " + strArgs;
|
|
||||||
else command = "cmd /c start java -jar \"" + executableName +"\" " + strArgs;
|
|
||||||
} else {
|
|
||||||
// da die Administratorkonsole im C:/Windows/System32 pfad geöffnet wird, muss der absolute Pfad der Jar-Datei ermittelt werden
|
|
||||||
executableName = new File(executableName).getAbsolutePath();
|
|
||||||
|
|
||||||
if (keepOpen) command = "powershell \"Start-Process cmd -Verb RunAs -ArgumentList '/C', 'start cmd /k java -jar \" " + executableName + "\" " + strArgs + "'";
|
|
||||||
else command = "powershell \"Start-Process cmd -Verb RunAs -ArgumentList '/C', 'java -jar \"" + executableName + "\" " + strArgs + "'";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LINUX:
|
|
||||||
|
|
||||||
executableName = new File(executableName).getAbsolutePath();
|
|
||||||
String terminal = null;
|
|
||||||
String terminalCommand = null;
|
|
||||||
|
|
||||||
// es muss zunächst ein installiertes Terminal "gefunden" werden, das geöffnet werden kann
|
|
||||||
try {
|
|
||||||
String[][] terminals = { { "gnome-terminal", "--"}, {"xterm", "-e"}, {"xfce4-terminal", "-e"}, {"tilix", "-e"}, {"konsole", "-e"}, {"terminal", "-e"}};
|
|
||||||
|
|
||||||
for (String currentTerminal[]: terminals) {
|
|
||||||
Process p = new ProcessBuilder("bash", "-c", "which " + currentTerminal[0]).start();
|
|
||||||
p.waitFor(5000, TimeUnit.SECONDS);
|
|
||||||
String output = "";
|
|
||||||
BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
||||||
output = buf.readLine();
|
|
||||||
|
|
||||||
if (output != null && !output.equals("")) { terminal = currentTerminal[0]; terminalCommand = currentTerminal[1]; break; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (terminal == null) break;
|
|
||||||
|
|
||||||
if (!asAdmin) {
|
|
||||||
if (keepOpen) new ProcessBuilder("bash", "-c", terminal + " " + terminalCommand + " /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "; exec bash'").start();
|
|
||||||
else new ProcessBuilder("bash", "-c", terminal + " " + terminalCommand + " /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "'").start();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (keepOpen) new ProcessBuilder("bash", "-c", terminal + " " + terminalCommand + " sudo /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "; exec bash'").start();
|
|
||||||
else new ProcessBuilder("bash", "-c", terminal + " " + terminalCommand + " sudo /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "'").start();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} catch (Exception ex) { }
|
|
||||||
break;
|
|
||||||
case MACOS: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (command != null) Runtime.getRuntime().exec(command);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Der Name der Jar-Datei <i> (BeMa_installer.jar) </i>
|
|
||||||
*/
|
|
||||||
public static String getExecutableName() {
|
|
||||||
|
|
||||||
String executableNameFromClass = null;
|
|
||||||
|
|
||||||
final CodeSource codeSource = RunInConsole.class.getProtectionDomain().getCodeSource();
|
|
||||||
if (codeSource == null) {
|
|
||||||
// es wird nichts geloggt
|
|
||||||
} else {
|
|
||||||
String path = codeSource.getLocation().getPath();
|
|
||||||
if (path == null || path.isEmpty()) {
|
|
||||||
// es wird nichts geloggt;
|
|
||||||
} else {
|
|
||||||
executableNameFromClass = new File(path).getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String nameFromJavaClassPath = System.getProperty("java.class.path");
|
|
||||||
String nameFromSunProperty = System.getProperty("sun.java.command");
|
|
||||||
|
|
||||||
if (isJarFile(executableNameFromClass)) return executableNameFromClass;
|
|
||||||
|
|
||||||
if (isJarFile(nameFromJavaClassPath)) return nameFromJavaClassPath;
|
|
||||||
|
|
||||||
if (isJarFile(nameFromSunProperty)) return nameFromSunProperty;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gibt zurück, ob es sich um eine .jar Datei handelt, und ob diese existiert
|
|
||||||
* @param name Name der Jar Datei
|
|
||||||
* @return Ob es sich um eine Jar-Datei handelt
|
|
||||||
*/
|
|
||||||
private static boolean isJarFile(final String name) {
|
|
||||||
|
|
||||||
if (name == null || !name.toLowerCase().endsWith(".jar")) return false;
|
|
||||||
|
|
||||||
// überprüfe, ob diese existiert
|
|
||||||
final File file = new File(name);
|
|
||||||
return file.exists() && file.isFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* This Java source file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
package tk.rpjosh.installer;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class LibraryTest {
|
|
||||||
@Test public void testSomeLibraryMethod() {
|
|
||||||
Library classUnderTest = new Library();
|
|
||||||
assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod());
|
|
||||||
}
|
|
||||||
}
|
|
32
README.md
32
README.md
|
@ -1,9 +1,9 @@
|
||||||
# Purpose
|
# Purpose
|
||||||
|
|
||||||
This project provides a simple installation tool for installing your java application under the operation systems *windows* and *linux*.
|
This project provides a simple installation tool for installing your java application for the operating systems *windows* and *linux*.
|
||||||
|
|
||||||
If you want to use a simple installer instead of the installation method the operating systems ships with (like *msi* or *dpkg packages*) feel free to use this installer.
|
If you want to use a simple installer instead of the installation method the operating systems ships with (like *msi* or *dpkg packages*) feel free to use this installer.
|
||||||
This installer can be used for a **single jar file** with a few dependencies.
|
It can be used for a **single jar file** with a few dependencies.
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
|
@ -11,16 +11,17 @@ This installer can be used for a **single jar file** with a few dependencies.
|
||||||
|
|
||||||
* quiet installation without opening a command prompt
|
* quiet installation without opening a command prompt
|
||||||
* installation of **fonts** from the source folder (*.tft*)
|
* installation of **fonts** from the source folder (*.tft*)
|
||||||
* the executable to install can be downloaded from a webserver.
|
* dynamic download of the jar file from a webserver.
|
||||||
Basic auth for downloading the executable is supported
|
Basic auth for downloading the executable is supported
|
||||||
* install the program *portable* in a single folder
|
* install the program *portable* in a single folder
|
||||||
* creating a **desktop** and a **start menu** entry with a custom icon
|
* creating a **desktop** and a **start menu** entry with a custom icon
|
||||||
* a **launch script** for opening the application will be provided
|
* a **launch script** for opening the application will be provided
|
||||||
|
* put your application into the autostart folder of the operating system *(for GUI applications)*
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
* besides the removal via the launch script an **uninstall** entry in the *contol center* will also be created
|
* besides the removal via the launch script an **uninstall** entry in the *contol center* will be created
|
||||||
* install the programm only for the current **user** -> no need of administrator rights
|
* installation of the programm only for the current **user** → no need of administrator rights
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
|
@ -28,34 +29,37 @@ Basic auth for downloading the executable is supported
|
||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
|
## How to get
|
||||||
|
|
||||||
|
You can build the library by yourself or use the provided version in the [Maven Central Repository](https://central.sonatype.com/artifact/de.rpjosh/installer).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
The usage of the library is very simple. See the below code snippet for a short example.
|
The usage of the library is very simple. See the below code snippet for a short example.
|
||||||
|
|
||||||
```
|
```java
|
||||||
InstallConfig conf = new InstallConfig (
|
InstallConfig conf = new InstallConfig (
|
||||||
"myCompany",
|
"myCompany",
|
||||||
"2.0.0",
|
"2.0.0",
|
||||||
"MyApplicationName",
|
"MyApplicationName",
|
||||||
"My long application name")
|
"My long application name")
|
||||||
;
|
;
|
||||||
// now you can specify the various options via the InstallConfig
|
// You can specify the various options via the InstallConfig object
|
||||||
conf.setDownloadURLForProgramm(URL, BASIC_AUTH_USER, BASIC_AUTH_PASSWORD);
|
conf.setDownloadURLForProgramm(URL, BASIC_AUTH_USER, BASIC_AUTH_PASSWORD);
|
||||||
... // see the javadoc for more options
|
... // see the javadoc for more options
|
||||||
|
|
||||||
// after configuring you can install the application
|
// After configuring you can install the application
|
||||||
Installer installer = new Installer(conf);
|
Installer installer = new Installer(conf);
|
||||||
installer.installProgramm(args);
|
installer.installProgramm(args);
|
||||||
|
|
||||||
// whether the installation was successful (0) or erroneous (<0)
|
// Whether the installation was successful (0) or erroneous (>0)
|
||||||
System.out.println(installer.getResponseCode());
|
System.out.println(installer.getResponseCode());
|
||||||
```
|
```
|
||||||
___
|
|
||||||
|
|
||||||
For a real life example you can take a look at the installer of [RPdb](https://git.rpjosh.tk/RPJosh/RPdb/src/branch/master/Program/Java/tk.rpjosh.rpdb.installer).
|
|
||||||
|
|
||||||
# License
|
# License
|
||||||
This project is licensed under the GPLv3. Please see the [LICENSE](LICENSE) file for an full license.
|
This project is licensed under the GPLv3. Please see the [LICENSE](LICENSE) file for a full license.
|
||||||
|
|
||||||
# Need help?
|
# Need help?
|
||||||
You can check out the 📖️ Javadocs for more informations.
|
You can check out the 📖️ Javadocs for more information.
|
||||||
|
|
||||||
If that didn't help you feel free to create an issue or open a pull request 📣️
|
If that didn't help you feel free to create an issue or open a pull request 📣️
|
|
@ -0,0 +1,171 @@
|
||||||
|
plugins {
|
||||||
|
// Apply the java-library plugin to add support for Java Library
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'signing'
|
||||||
|
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set version of programm //
|
||||||
|
|
||||||
|
version = project.file("./VERSION").text.trim()
|
||||||
|
def version = project.file("./VERSION").text.trim()
|
||||||
|
def publishToNexus = "publishToSonatype" in gradle.startParameter.taskNames
|
||||||
|
|
||||||
|
group = "de.rpjosh"
|
||||||
|
|
||||||
|
// ----- //
|
||||||
|
|
||||||
|
// Set correct encoding
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = 11
|
||||||
|
targetCompatibility = 11
|
||||||
|
|
||||||
|
// Create a single .jar with all dependencies
|
||||||
|
task fatJar(type: Jar) {
|
||||||
|
|
||||||
|
archiveClassifier = ''
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes( 'Implementation-Title': 'installer',
|
||||||
|
'Implementation-Version': version,
|
||||||
|
'Implementation-Group': project.group, )
|
||||||
|
}
|
||||||
|
|
||||||
|
archivesBaseName = "installer"
|
||||||
|
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
|
{
|
||||||
|
exclude "META-INF/*.SF"
|
||||||
|
exclude "META-INF/*.DSA"
|
||||||
|
exclude "META-INF/*.RSA"
|
||||||
|
}
|
||||||
|
with jar
|
||||||
|
destinationDirectory.set(layout.buildDirectory.dir("dist"))
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
archiveClassifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
//sourceSets.main.resources { srcDirs = ["src/main/java"]; exclude "**/*.java" }
|
||||||
|
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
manifest {
|
||||||
|
attributes( 'Implementation-Title': 'installer',
|
||||||
|
'Implementation-Version': version,
|
||||||
|
'Implementation-Group': project.group, )
|
||||||
|
}
|
||||||
|
archiveClassifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives fatJar
|
||||||
|
archives sourcesJar
|
||||||
|
archives javadocJar
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The created jar file will be copied automatically into the release directory
|
||||||
|
task copyJar(type: Copy) {
|
||||||
|
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
|
||||||
|
into file("$buildDir/../release")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the maven repo file structure -> Javadoc can be used easily in eclipse
|
||||||
|
task copyJarToMaven (type: Copy) {
|
||||||
|
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
|
||||||
|
into file("$buildDir/../release/mavenRepo/de/rpjosh/installer/" + version)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Publish to local maven repo
|
||||||
|
|
||||||
|
java {
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
nexusPublishing {
|
||||||
|
repositories {
|
||||||
|
sonatype{
|
||||||
|
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
|
||||||
|
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||||
|
|
||||||
|
// Or use System.getenv?
|
||||||
|
username= publishToNexus ? project.property("maven.sonatype.user") : "none"
|
||||||
|
password= publishToNexus ? project.property("maven.sonatype.password") : "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
javaPubl(MavenPublication) {
|
||||||
|
artifactId = 'installer'
|
||||||
|
from components.java
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name = 'Java-Installer'
|
||||||
|
description = 'A simple installation routine for your Java application'
|
||||||
|
url = 'https://git.rpjosh.de/RPJosh/Java-Installer'
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = 'The GNU AFFERO GENERAL PUBLIC LICENSE, Version 3'
|
||||||
|
url = 'https://www.gnu.org/licenses/agpl-3.0.html'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'RPJosh'
|
||||||
|
name = 'Jonas Letzbor'
|
||||||
|
email = 'RPjosh@rpjosh.de'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:https://git.rpjosh.de/RPJosh/Java-Installer.git'
|
||||||
|
developerConnection = 'scm:git:https://git.rpjosh.de/RPJosh/Java-Installer.git'
|
||||||
|
url = 'https://git.rpjosh.de/RPJosh/Java-Installer'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
def signingKey = publishToNexus ? project.property("maven.sonatype.signing.key") : ""
|
||||||
|
def signingPassword = publishToNexus ? project.property("maven.sonatype.signing.password") : ""
|
||||||
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||||
|
|
||||||
|
// Only sign the publications
|
||||||
|
sign publishing.publications.javaPubl
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build.finalizedBy copyJar
|
||||||
|
build.finalizedBy copyJarToMaven
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// https://mvnrepository.com/artifact/com.github.vatbub/mslinks
|
||||||
|
api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.2'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('jar') {
|
||||||
|
manifest {
|
||||||
|
attributes( 'Implementation-Title': 'installer',
|
||||||
|
'Implementation-Version': version,
|
||||||
|
'Implementation-Group': 'de.rpjosh', )
|
||||||
|
}
|
||||||
|
}
|
BIN
Program/tk.rpjosh.installer/gradle/wrapper/gradle-wrapper.jar → gradle/wrapper/gradle-wrapper.jar
vendored
100644 → 100755
BIN
Program/tk.rpjosh.installer/gradle/wrapper/gradle-wrapper.jar → gradle/wrapper/gradle-wrapper.jar
vendored
100644 → 100755
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,234 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
|
@ -1,89 +1,89 @@
|
||||||
@rem
|
@rem
|
||||||
@rem Copyright 2015 the original author or authors.
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
:omega
|
:omega
|
|
@ -0,0 +1 @@
|
||||||
|
rootProject.name = 'de.rpjosh.installer'
|
|
@ -1,19 +1,21 @@
|
||||||
package tk.rpjosh.installer;
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
/**
|
||||||
|
* Define configuration options for the installation
|
||||||
import tk.rpjosh.installer.InstallConfig.OSType;
|
*/
|
||||||
|
|
||||||
public class InstallConfig {
|
public class InstallConfig {
|
||||||
|
|
||||||
private String company;
|
private String company;
|
||||||
|
@ -26,7 +28,7 @@ public class InstallConfig {
|
||||||
ArrayList<String> directorysInAppData = new ArrayList<String>();
|
ArrayList<String> directorysInAppData = new ArrayList<String>();
|
||||||
Map<String, String> fontsToInstall = new HashMap<String, String>();
|
Map<String, String> fontsToInstall = new HashMap<String, String>();
|
||||||
|
|
||||||
// Alle Pfade, die vom Programm genutzt werden //
|
// All paths used by the program //
|
||||||
private String desktopDir = null;
|
private String desktopDir = null;
|
||||||
private String applicationDir = null;
|
private String applicationDir = null;
|
||||||
private String configDir = null;
|
private String configDir = null;
|
||||||
|
@ -39,30 +41,31 @@ public class InstallConfig {
|
||||||
private boolean offline = false;
|
private boolean offline = false;
|
||||||
private String portableMainDir = "";
|
private String portableMainDir = "";
|
||||||
|
|
||||||
private Data data;
|
private Logger logger;
|
||||||
|
|
||||||
/* Ordnerstruktur bei Portable:
|
/* File structure when portable:
|
||||||
.
|
.
|
||||||
+-- _Programm
|
+-- _Programm
|
||||||
| +-- _pics
|
| +-- _pics
|
||||||
| +-- BeMa.jar
|
| +-- MyProgram.jar
|
||||||
| +-- portable <- Dadurch wird portable ersichtlich
|
| +-- portable <- Through this file portable will be annotated
|
||||||
+-- _AppData
|
+-- _AppData
|
||||||
| +-- _config
|
| +-- _config
|
||||||
| | +-- conf.txt
|
| | +-- conf.txt
|
||||||
| +-- _logs
|
| +-- _logs
|
||||||
| | +-- BeMa.log
|
| | +-- MyProgram.log
|
||||||
| | +-- BeMa_Simple.log
|
| | +-- MyProgram_simple.log
|
||||||
+-- ShortcutToJar
|
+-- ShortcutToJar
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Programm zum Downloaden //
|
// Settings for program download //
|
||||||
protected String downloadURL = null;
|
protected String downloadURL = null;
|
||||||
protected boolean addVersion = false;
|
protected boolean addVersion = false;
|
||||||
protected String urlEnding = "";
|
protected String urlEnding = "";
|
||||||
protected char[] authUsername = null;
|
protected char[] authUsername = null;
|
||||||
protected char[] authPassword = null;
|
protected char[] authPassword = null;
|
||||||
|
protected boolean allowAskForBasicAuth = false;
|
||||||
|
|
||||||
private boolean createDesktopEntry = false;
|
private boolean createDesktopEntry = false;
|
||||||
private String desktopWindowsICO = "";
|
private String desktopWindowsICO = "";
|
||||||
|
@ -78,6 +81,9 @@ public class InstallConfig {
|
||||||
private boolean launchInBackground = true;
|
private boolean launchInBackground = true;
|
||||||
|
|
||||||
private int maxHeapSize = 0;
|
private int maxHeapSize = 0;
|
||||||
|
private int initialHeapSize = 0;
|
||||||
|
|
||||||
|
protected boolean killRunningInstances = true;
|
||||||
|
|
||||||
// ----- //
|
// ----- //
|
||||||
|
|
||||||
|
@ -103,26 +109,33 @@ public class InstallConfig {
|
||||||
protected String serviceRestart;
|
protected String serviceRestart;
|
||||||
protected Integer serviceRestartSec;
|
protected Integer serviceRestartSec;
|
||||||
|
|
||||||
|
// GUI autostart //
|
||||||
|
protected boolean createGuiAutostart;
|
||||||
|
protected String guiAutostartUser;
|
||||||
|
protected String guiAutostartFlags;
|
||||||
|
|
||||||
// ----- //
|
// ----- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a configuration object for the installation with all the necessary informations
|
* Creates a configuration object for the installation with all the required informations
|
||||||
*
|
*
|
||||||
* @param company the name of your company under which the application should be installed
|
* @param company Name of your company under which the application should be installed
|
||||||
* @param version the version
|
* @param version Version of the application
|
||||||
* @param applicationNameShort the short name of your application
|
* @param applicationNameShort Short name of your application
|
||||||
* @param applicationNameLong the long name of your application
|
* @param applicationNameLong Long name of your application
|
||||||
*/
|
*/
|
||||||
public InstallConfig(String company, String version, String applicationNameShort, String applicationNameLong) {
|
public InstallConfig(String company, String version, String applicationNameShort, String applicationNameLong) {
|
||||||
|
|
||||||
data = new Data(this);
|
logger = new Logger();
|
||||||
this.company = company;
|
this.company = company;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.applicationNameShort = applicationNameShort;
|
this.applicationNameShort = applicationNameShort;
|
||||||
this.applicationNameLong = applicationNameLong;
|
this.applicationNameLong = applicationNameLong;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the operating system //
|
/**
|
||||||
|
* Specifies an operation system
|
||||||
|
*/
|
||||||
public enum OSType {
|
public enum OSType {
|
||||||
UNDETERMINED, WINDOWS, LINUX, MACOS
|
UNDETERMINED, WINDOWS, LINUX, MACOS
|
||||||
}
|
}
|
||||||
|
@ -141,7 +154,7 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* When the debug mode is enabled, all error messages will be printed out exactly
|
* When the debug mode is enabled, all error messages will be printed out exactly
|
||||||
*
|
*
|
||||||
* @param debug if the debug mode should been enabled
|
* @param debug if the debug mode should be enabled
|
||||||
*/
|
*/
|
||||||
public void setDebug(boolean debug) { this.debug = debug; }
|
public void setDebug(boolean debug) { this.debug = debug; }
|
||||||
protected boolean getDebug() { return debug; }
|
protected boolean getDebug() { return debug; }
|
||||||
|
@ -160,15 +173,25 @@ public class InstallConfig {
|
||||||
protected String getApplicationNameShort() { return applicationNameShort; }
|
protected String getApplicationNameShort() { return applicationNameShort; }
|
||||||
protected String getApplicationNameLong() { return applicationNameLong; }
|
protected String getApplicationNameLong() { return applicationNameLong; }
|
||||||
|
|
||||||
protected Data getData() { return data; }
|
protected Logger getLogger() { return logger; }
|
||||||
protected boolean getIsUser() { return isUser; }
|
protected boolean getIsUser() { return isUser; }
|
||||||
protected boolean getIsPortable() { return isPortable; }
|
protected boolean getIsPortable() { return isPortable; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default all running instances will be killed before the installation starts.
|
||||||
|
* This behavior can be toggled through this method
|
||||||
|
*
|
||||||
|
* @param kill If the running instances should be killed
|
||||||
|
*/
|
||||||
|
public void setKillRunningInstance(boolean kill) {
|
||||||
|
this.killRunningInstances = kill;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The given fonts will be installed (the fonts has to be in the format .ttf)
|
* Setup fonts that should be installed (the fonts has to be in the .ttf format)
|
||||||
*
|
*
|
||||||
* @param fonts a map with all the fonts: the name without .ttf | location of the fonts within the jar file (with .ttf)
|
* @param fonts Map with all the fonts: the name without .ttf | location of the fonts within the jar file (with .ttf)
|
||||||
*/
|
*/
|
||||||
public void setFontsToInstall(Map<String, String> fonts) {
|
public void setFontsToInstall(Map<String, String> fonts) {
|
||||||
this.fontsToInstall = fonts;
|
this.fontsToInstall = fonts;
|
||||||
|
@ -177,45 +200,44 @@ public class InstallConfig {
|
||||||
protected Map<String, String> getFontsToInstall() { return this.fontsToInstall; }
|
protected Map<String, String> getFontsToInstall() { return this.fontsToInstall; }
|
||||||
|
|
||||||
|
|
||||||
// Executable to install //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the URL of the file to be installed. The executable will be downloaded from the specified URL
|
* Sets the URL of the file to be installed. The executable will be downloaded from the specified URL
|
||||||
*
|
*
|
||||||
* @param url the URL
|
* @param url URL
|
||||||
* @param basicAuthUser [ the user for the basic auth ]
|
* @param basicAuthUser Optional: user for the basic auth
|
||||||
* @param basicAuthPassword [ the passwort for the basic auth ]
|
* @param basicAuthPassword Optional: password for the basic auth
|
||||||
|
* @param askForBasicAuth When no basic auth credentials are provided and the request returns a 401 response, ask the user for credentials at the command line
|
||||||
*/
|
*/
|
||||||
public void setDownloadURLForProgramm(String url, char[] basicAuthUser, char[] basicAuthPassword) {
|
public void setDownloadURLForProgramm(String url, char[] basicAuthUser, char[] basicAuthPassword, boolean askForBasicAuth) {
|
||||||
this.downloadURL = url;
|
this.downloadURL = url;
|
||||||
this.authUsername = basicAuthUser;
|
this.authUsername = basicAuthUser;
|
||||||
this.authPassword = basicAuthPassword;
|
this.authPassword = basicAuthPassword;
|
||||||
offline = false;
|
this.allowAskForBasicAuth = askForBasicAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the URL of the file to be installed. The executable will be downloaded from the specified URL
|
* Sets the URL of the file to be installed. The executable will be downloaded from the specified URL
|
||||||
* In addition the operation system and the architecture will be added automatically to the URL (_windows_x64, _linux_arm32)
|
* In addition the operation system and the architecture will be added automatically to the URL (_windows_x64, _linux_arm32)
|
||||||
*
|
*
|
||||||
* @param url die URL (without file extension)
|
* @param url URL (without file extension)
|
||||||
* @param basicAuthUser [ the user for the basic auth ]
|
* @param basicAuthUser Optional: user for the basic auth
|
||||||
* @param basicAuthPassword [ the passwort for the basic auth ]
|
* @param basicAuthPassword Optional: password for the basic auth
|
||||||
* @param end die file ending of the file (.jar)
|
* @param askForBasicAuth When no basic auth credentials are provided and the request returns a 401 response, ask the user for credentials at the command line
|
||||||
|
* @param end File ending of the file (.jar)
|
||||||
*/
|
*/
|
||||||
public void setDownloadURLForProgramm(String url, char[] basicAuthUser, char[] basicAuthPassword, String end) {
|
public void setDownloadURLForProgramm(String url, char[] basicAuthUser, char[] basicAuthPassword, boolean askForBasicAuth, String end) {
|
||||||
this.downloadURL = url;
|
this.downloadURL = url;
|
||||||
this.authUsername = basicAuthUser;
|
this.authUsername = basicAuthUser;
|
||||||
this.authPassword = basicAuthPassword;
|
this.authPassword = basicAuthPassword;
|
||||||
this.urlEnding = end;
|
this.urlEnding = end;
|
||||||
this.addVersion = true;
|
this.addVersion = true;
|
||||||
|
this.allowAskForBasicAuth = askForBasicAuth;
|
||||||
offline = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs the executable from the local file systems instead of downloading the file
|
* Installs the executable from the local file systems instead of downloading the file
|
||||||
*
|
*
|
||||||
* @param path the path of the jar file in the file system
|
* @param path Path of the jar file in the file system
|
||||||
*/
|
*/
|
||||||
public void setDownloadOfflinePath(String path) {
|
public void setDownloadOfflinePath(String path) {
|
||||||
this.downloadURL = path;
|
this.downloadURL = path;
|
||||||
|
@ -231,11 +253,11 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Creates a desktop entry during the installation.
|
* Creates a desktop entry during the installation.
|
||||||
*
|
*
|
||||||
* - Windows: a entry will be created in the public desktop or in the user desktop directory (for a user installation).
|
* - Windows: an entry will be created in the public desktop or in the user desktop directory (for a user installation).
|
||||||
* also an entry in the start menu will be created.
|
* also an entry in the start menu will be created.
|
||||||
* - Linux: the desktop file will be registered into the start menu.
|
* - Linux: the desktop file will be registered into the start menu.
|
||||||
*
|
*
|
||||||
* The given picrute will be saved under the program directory under pics/desktop.png / pics/desktop.ico
|
* The given picture will be saved under the program directory under pics/desktop.png / pics/desktop.ico
|
||||||
*
|
*
|
||||||
* @param windowsICO [Windows] the path to the .ico file inside the jar file (resource/pic.ico). The optimum resolution is 256x256
|
* @param windowsICO [Windows] the path to the .ico file inside the jar file (resource/pic.ico). The optimum resolution is 256x256
|
||||||
* @param linuxPNG [Linux] the path of the .png file inside the jar file ...
|
* @param linuxPNG [Linux] the path of the .png file inside the jar file ...
|
||||||
|
@ -247,7 +269,7 @@ public class InstallConfig {
|
||||||
desktopWindowsICO = windowsICO;
|
desktopWindowsICO = windowsICO;
|
||||||
desktopLinuxPNG = linuxPNG;
|
desktopLinuxPNG = linuxPNG;
|
||||||
|
|
||||||
createProgramDirs(new ArrayList<String>() {{ add("pics/"); }});
|
createProgramDirs((List<String>) Arrays.asList(new String[] {"pics/"}));
|
||||||
desktopKeywords = keywords;
|
desktopKeywords = keywords;
|
||||||
}
|
}
|
||||||
protected String getDesktopWindowsICO() { return desktopWindowsICO; }
|
protected String getDesktopWindowsICO() { return desktopWindowsICO; }
|
||||||
|
@ -262,18 +284,18 @@ public class InstallConfig {
|
||||||
public void setDesktopCategories(String categories) { this.desktopCategories = categories; }
|
public void setDesktopCategories(String categories) { this.desktopCategories = categories; }
|
||||||
/**
|
/**
|
||||||
* [Linux] Sets the keywords for the application (desktop entry)
|
* [Linux] Sets the keywords for the application (desktop entry)
|
||||||
* @param keywords the keywords separated by a ';'
|
*
|
||||||
|
* @param keywords Keywords separated by a ';'
|
||||||
*/
|
*/
|
||||||
public void setDesktopKeywords (String keywords) { this.desktopKeywords = keywords; }
|
public void setDesktopKeywords (String keywords) { this.desktopKeywords = keywords; }
|
||||||
|
|
||||||
|
|
||||||
// Options for the launch of the application //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the application is launched from the command line, the program will be launched in the foreground normally.
|
* When the application is launched from the command line, the program will automatically be launched in the foreground by default.
|
||||||
* With the parameter --b can the program be launched in the foreground
|
* The default behavior in the start script can be configured with this method.
|
||||||
*
|
*
|
||||||
* @param runInBackground whether the program should be launched in background by default -{@literal >} for launching it in the foreground the parameter --f is required
|
* @param runInBackground Whether to launch the program in background by default -{@literal >} for launching it in the foreground the parameter --f is required.
|
||||||
|
* Otherwise '--b' must be provided
|
||||||
*/
|
*/
|
||||||
public void setRunInBackgroundByDefault(boolean runInBackground) {
|
public void setRunInBackgroundByDefault(boolean runInBackground) {
|
||||||
this.launchInBackground = runInBackground;
|
this.launchInBackground = runInBackground;
|
||||||
|
@ -284,25 +306,26 @@ public class InstallConfig {
|
||||||
* [Linux] Creates a unit file for systemd. All the given parameters are optional (except startAtBoot).
|
* [Linux] Creates a unit file for systemd. All the given parameters are optional (except startAtBoot).
|
||||||
* For the ..Exec.. parameters and the working directory you can use #~LaunchScript~#, #~AppPath~#, #~ConfigPath~# with a leading slash -{@literal >} /home/myPath/
|
* For the ..Exec.. parameters and the working directory you can use #~LaunchScript~#, #~AppPath~#, #~ConfigPath~# with a leading slash -{@literal >} /home/myPath/
|
||||||
*
|
*
|
||||||
* @param startAtBoot whether the service should start at boot time
|
* @param startAtBoot Whether the service should start at boot time
|
||||||
* @param unitDescription the description of the service
|
* @param unitDescription Description of the service
|
||||||
* @param unitAfter after which target the service should been started
|
* @param unitAfter After which target the service should been started
|
||||||
* @param unitStartLimitBurst the maximum number of start retries
|
* @param unitStartLimitBurst Maximum number of start retries
|
||||||
* @param unitStartLimitInterval the interval in seconds in which the maximum number of start retries should been summarized
|
* @param unitStartLimitInterval Interval in seconds, in which the maximum number of start retries should been summarized
|
||||||
* @param installWantedBy to which time of the boot process the service should been started -{@literal >} multi-user.target (normal) or graphical.target (when GUI is needed)
|
* @param installWantedBy To which time of the boot process the service should been started -{@literal >} multi-user.target (normal) or graphical.target (when GUI is needed)
|
||||||
* @param installAliasName an alias for the service name
|
* @param installAliasName Alias for the service name
|
||||||
* @param serviceWorkingDir the working directory of the service
|
* @param serviceWorkingDir Working directory of the service
|
||||||
* @param serviceUser the user for the service
|
* @param serviceUser User for the service
|
||||||
* @param serviceGroup the group for the service
|
* @param serviceGroup Group for the service
|
||||||
* @param serviceEnvironment the environment variables to set
|
* @param serviceEnvironment Environment variables to set
|
||||||
* @param serviceExecStartPre the commands to execute before the service starts. Use <LaunchScript> to replace the location of the launch script
|
* @param serviceExecStartPre Commands to execute before the service starts. Use {@literal <}LaunchScript{@literal >} to replace it with the real location of the launch script
|
||||||
* @param serviceExecStartPost the commands to execute after the service has started. Use <LaunchScript> to replace the location of the launch script
|
* @param serviceExecStartPost Commands to execute after the service has started. Use {@literal <}LaunchScript{@literal >} to replace the location of the launch script
|
||||||
* @param serviceTimeout the number of seconds which should been allowed to start / stop the service
|
* @param serviceTimeout Number of seconds to give the program for start / stop
|
||||||
* @param serviceType the type of the service -{@literal >} oneshot, simple, exec and forking
|
* @param serviceType Type of the service {@literal >} oneshot, simple, exec and forking
|
||||||
* @param serviceExecStart the start command. Please take in mind that only with the type "oneshot" multiple commands can be specified. Use <LaunchScript> to replace the location of the launch script
|
* @param serviceExecStart Start command. Please take in mind that only with the type "oneshot" multiple commands can be specified.
|
||||||
* @param serviceExecStop the stop command. Use #LaunchScript# to replace the location of the launch script
|
* Use #~LaunchScript~# to replace it with the real location of the launch script
|
||||||
* @param serviceRestart whether the service should been restarted when the execution failed -{@literal >} on-failure or always
|
* @param serviceExecStop Stop command. Use #~LaunchScript~# to replace this string with the location of the launch script
|
||||||
* @param serviceRestartSec the number of seconds to wait between a restart
|
* @param serviceRestart Whether the service should be restarted when the execution failed -{@literal >} 'on-failure' or 'always'
|
||||||
|
* @param serviceRestartSec Number of seconds to wait between restarts
|
||||||
*/
|
*/
|
||||||
public void createServiceUnitFile(
|
public void createServiceUnitFile(
|
||||||
boolean startAtBoot,
|
boolean startAtBoot,
|
||||||
|
@ -334,19 +357,30 @@ public class InstallConfig {
|
||||||
this.serviceRestartSec = serviceRestartSec;
|
this.serviceRestartSec = serviceRestartSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an auto start entry for your GUI application that will be started directly after the window manager
|
||||||
|
* / the desktop was loaded
|
||||||
|
*
|
||||||
|
* @param user [Linux] User for which the GUI should be started. This information is only required for linux
|
||||||
|
* @param startFlags Execution flags to add to the launch script like "--minimized"
|
||||||
|
*/
|
||||||
|
public void createGuiAutostart(String user, String startFlags) {
|
||||||
|
this.createGuiAutostart = true;
|
||||||
|
this.guiAutostartUser = user;
|
||||||
|
this.guiAutostartFlags= startFlags;
|
||||||
|
}
|
||||||
|
|
||||||
// Removal options //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Windows] The estimated size of the whole application which should been displayed to the user
|
* [Windows] Sets the estimated size of the whole application which should been displayed to the user
|
||||||
*
|
*
|
||||||
* @param estimatedSize the estimated size in megabyte
|
* @param estimatedSize Estimated size in megabyte
|
||||||
*/
|
*/
|
||||||
public void setEstimatedSize(double estimatedSize) {
|
public void setEstimatedSize(double estimatedSize) {
|
||||||
this.estimatedSize = (int) (estimatedSize * 1024);
|
this.estimatedSize = (int) (estimatedSize * 1024);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* [Windows] Returns the setted estimates size of the program
|
* [Windows] Returns the estimates size of the program that was set previously
|
||||||
* @return the estimated size in bytes
|
* @return the estimated size in bytes
|
||||||
*/
|
*/
|
||||||
protected int getEstimatedSize() { return estimatedSize; }
|
protected int getEstimatedSize() { return estimatedSize; }
|
||||||
|
@ -355,26 +389,23 @@ public class InstallConfig {
|
||||||
* [Windows] Icon for the removal of the application.
|
* [Windows] Icon for the removal of the application.
|
||||||
* A file (pics/uninstall.ico) will be created.
|
* A file (pics/uninstall.ico) will be created.
|
||||||
*
|
*
|
||||||
* @param windowsICO the path of the .ico file inside of the jar file (e.g. resource/uninstall.ico)
|
* @param windowsICO Path of the .ico file inside of the jar file (e.g. resource/uninstall.ico)
|
||||||
*/
|
*/
|
||||||
public void setIconForWindowsUninstaller(String windowsICO) {
|
public void setIconForWindowsUninstaller(String windowsICO) {
|
||||||
this.createIconForDeletion = true;
|
this.createIconForDeletion = true;
|
||||||
this.iconForDeletionPath = windowsICO;
|
this.iconForDeletionPath = windowsICO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Options for the installations //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs the program portable
|
* Installs the program portable
|
||||||
*
|
*
|
||||||
* @param dir the main directory for the portable installation (e.g. C:/Users/de03710/MyProgram/)
|
* @param dir Main directory for the portable installation (e.g. C:/Users/de03710/MyProgram/)
|
||||||
*/
|
*/
|
||||||
public void setPortable(String dir) {
|
public void setPortable(String dir) {
|
||||||
|
|
||||||
this.isPortable = true;
|
this.isPortable = true;
|
||||||
this.portableMainDir = dir;
|
this.portableMainDir = dir;
|
||||||
this.configDir = dir + "Appdata/";
|
this.configDir = dir + "AppData/";
|
||||||
this.applicationDir = dir + "Programm/";
|
this.applicationDir = dir + "Programm/";
|
||||||
|
|
||||||
isPortable = true;
|
isPortable = true;
|
||||||
|
@ -384,7 +415,7 @@ public class InstallConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Windows] Installs the program only for the actual user -{@literal >} administrator rights aren't necessary
|
* [Windows] Installs the program only for the current user -{@literal >} administrator rights aren't requried
|
||||||
*/
|
*/
|
||||||
public void setUserInstallation() {
|
public void setUserInstallation() {
|
||||||
|
|
||||||
|
@ -395,21 +426,18 @@ public class InstallConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Windows] creates a entry in the path variable for the program
|
* [Windows] Creates an entry in the path variable for the program
|
||||||
* TODO: create Launcher wie unter Linux
|
|
||||||
*/
|
*/
|
||||||
public void createPathEntry() {
|
public void createPathEntry() {
|
||||||
createPathVariable = true;
|
createPathVariable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Determine and create the application paths //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path of the desktop
|
* Returns the path of the desktop
|
||||||
*
|
*
|
||||||
* @return desktop path: /home/user/Desktop/ or C:/User/myUserName/Desktop/.
|
* @return desktop path: /home/user/Desktop/ or C:/User/myUserName/Desktop/.
|
||||||
* when no path could been determined, null will be returned
|
* When no path could been determined, null will be returned
|
||||||
*/
|
*/
|
||||||
protected String getDesktopDir() {
|
protected String getDesktopDir() {
|
||||||
|
|
||||||
|
@ -442,12 +470,12 @@ public class InstallConfig {
|
||||||
rtc = output + "/";
|
rtc = output + "/";
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("w", "Location of Desktop could not be determed. Using default Location: Desktop", "getDesktopDir");
|
logger.log("w", "Location of Desktop could not be determed. Using default Location: Desktop", "getDesktopDir");
|
||||||
rtc += "/Desktop/";
|
rtc += "/Desktop/";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
data.log("w", "Plattform is not supported", "getDesktopDir"); return null;
|
logger.log("w", "Plattform is not supported", "getDesktopDir"); return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.desktopDir = rtc;
|
this.desktopDir = rtc;
|
||||||
|
@ -475,7 +503,9 @@ public class InstallConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.configDir = rtc;
|
this.configDir = rtc;
|
||||||
this.initConfigDir();
|
if (!this.initConfigDir()) {
|
||||||
|
this.configDir = "";
|
||||||
|
}
|
||||||
|
|
||||||
return rtc;
|
return rtc;
|
||||||
}
|
}
|
||||||
|
@ -483,27 +513,35 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Creates the given directory in the configuration directory
|
* Creates the given directory in the configuration directory
|
||||||
*
|
*
|
||||||
* @param directorys a list with all the directorys to create. This are relative paths -{@literal >} logs/ or config/
|
* @param directorys List with all the directories to create. This are relative paths -{@literal >} logs/ or config/
|
||||||
*/
|
*/
|
||||||
public void createConfigDirs(ArrayList<String> directorys) {
|
public void createConfigDirs(List<String> directorys) {
|
||||||
|
|
||||||
directorysInConfig.addAll(directorys);
|
directorysInConfig.addAll(directorys);
|
||||||
directorysInConfig.add("");
|
directorysInConfig.add("");
|
||||||
initConfigDir();
|
initConfigDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initConfigDir() {
|
private boolean initConfigDir() {
|
||||||
|
|
||||||
if (!isInstallationStarted) return; // vor dem Start der Installation werden noch keine Ordner erstellt
|
if (!isInstallationStarted) return false; // before the start of the installation no folders will be created
|
||||||
|
|
||||||
String rtc = this.configDir;
|
String rtc = this.configDir;
|
||||||
|
|
||||||
|
// Create the root application directory
|
||||||
|
File configDirectory = new File(rtc);
|
||||||
|
if (!configDirectory.exists()) new File(rtc).mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (String direcotory: directorysInConfig) {
|
for (String direcotory: directorysInConfig) {
|
||||||
File currentDirectory = new File(rtc + direcotory);
|
File currentDirectory = new File(rtc + direcotory);
|
||||||
if (!currentDirectory.exists()) new File(rtc + direcotory).mkdirs();
|
if (!currentDirectory.exists()) new File(rtc + direcotory).mkdirs();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) { data.log("e", ex, "getConfigDir"); }
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception ex) { logger.log("e", ex, "getConfigDir"); }
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -531,7 +569,9 @@ public class InstallConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.applicationDir = rtc;
|
this.applicationDir = rtc;
|
||||||
initApplicationDir();
|
if (!initApplicationDir()) {
|
||||||
|
this.applicationDir = "";
|
||||||
|
};
|
||||||
|
|
||||||
return rtc;
|
return rtc;
|
||||||
}
|
}
|
||||||
|
@ -539,38 +579,49 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Creates the given directory in the application directory
|
* Creates the given directory in the application directory
|
||||||
*
|
*
|
||||||
* @param directorys a list with all the directorys to create. This are relative paths -{@literal >} logs/ or config/
|
* @param directorys a list with all the directories to create. This are relative paths -{@literal >} logs/ or config/
|
||||||
*/
|
*/
|
||||||
public void createProgramDirs(ArrayList<String> directorys) {
|
public void createProgramDirs(List<String> directorys) {
|
||||||
|
|
||||||
this.directorysInAppData.addAll(directorys);
|
this.directorysInAppData.addAll(directorys);
|
||||||
directorysInAppData.add("");
|
directorysInAppData.add("");
|
||||||
initApplicationDir(); // isn't done right here -> directories will be created before the installation and not now
|
initApplicationDir(); // isn't done right here -> directories will be created before the installation and not now
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initApplicationDir() {
|
protected boolean initApplicationDir() {
|
||||||
|
|
||||||
if (!isInstallationStarted) return; // before the installation no directory is been created
|
if (!isInstallationStarted) return false; // before the installation no directory is been created
|
||||||
|
|
||||||
// if an path entry should be added (only for windows) the path variable points to an own folder
|
// if an path entry should be added (only for windows) the path variable points to an own folder
|
||||||
if (InstallConfig.getOsType() == OSType.WINDOWS && this.createPathVariable && !directorysInAppData.contains("path/")) {
|
if (InstallConfig.getOsType() == OSType.WINDOWS && this.createPathVariable && !directorysInAppData.contains("path/")) {
|
||||||
directorysInAppData.add("path/");
|
directorysInAppData.add("path/");
|
||||||
}
|
}
|
||||||
|
if (isPortable) {
|
||||||
|
directorysInAppData.add("Programm/");
|
||||||
|
}
|
||||||
|
|
||||||
String rtc = this.applicationDir;
|
String rtc = this.applicationDir;
|
||||||
|
|
||||||
|
// Create the root application directory
|
||||||
|
File applicationDirectory = new File(rtc);
|
||||||
|
if (!applicationDirectory.exists()) new File(rtc).mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (String directory: directorysInAppData) {
|
for (String directory: directorysInAppData) {
|
||||||
File currentDirectory = new File(rtc + directory);
|
File currentDirectory = new File(rtc + directory);
|
||||||
if (!currentDirectory.exists()) new File(rtc + directory).mkdirs();
|
if (!currentDirectory.exists()) new File(rtc + directory).mkdirs();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) { data.log("e", ex, "initApplicationDir"); }
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception ex) { logger.log("e", ex, "initApplicationDir"); }
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the main directory of the portable installation
|
* Returns the main directory of the portable installation
|
||||||
*
|
*
|
||||||
* @return the path: C:/Users/de03710/BeMa/
|
* @return the path: C:/Users/de03710/RPdb/
|
||||||
*/
|
*/
|
||||||
protected String getPortableDir() {
|
protected String getPortableDir() {
|
||||||
return this.portableMainDir;
|
return this.portableMainDir;
|
||||||
|
@ -579,39 +630,40 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Extracts a file from the jar file and copy it to the given path
|
* Extracts a file from the jar file and copy it to the given path
|
||||||
*
|
*
|
||||||
* @param pathInJar the path in the jar file to extract: resource/48x48.png
|
* @param pathInJar Path in the jar file to extract: resource/48x48.png
|
||||||
* @param pathToWrite the destination path
|
* @param pathToWrite Destination path
|
||||||
* @param logError if an error message should be displayed
|
* @param logError Weather to display an error message
|
||||||
*
|
*
|
||||||
* @return if the resource was sucessfully extracted
|
* @return If the resource was successfully extracted
|
||||||
*/
|
*/
|
||||||
protected boolean getResource(String pathInJar, String pathToWrite, boolean logError) {
|
protected boolean getResource(String pathInJar, String pathToWrite, boolean logError) {
|
||||||
|
|
||||||
final File jarFile = new File(getLocationOfJarFile());
|
final File jarFile = new File(getLocationOfJarFile());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (jarFile.isFile()) {
|
if (jarFile.isFile()) {
|
||||||
InputStream in = getClass().getResourceAsStream("/" + pathInJar);
|
InputStream in = getClass().getResourceAsStream("/" + pathInJar);
|
||||||
FileUtils.copyInputStreamToFile(in, new File(pathToWrite));
|
|
||||||
|
File file = new File(pathToWrite);
|
||||||
|
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} catch (Exception ex ) {
|
} catch (Exception ex ) {
|
||||||
if (logError) data.log("w", ex, "getResource");
|
if (logError) logger.log("w", ex, "getResource");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts a file from the jar file and copy it to the given path
|
* Extracts a file from the jar file and copies it to the given path
|
||||||
*
|
*
|
||||||
* @param pathInJar the path in the jar file to extract: resource/48x48.png
|
* @param pathInJar Path in the jar file to extract: resource/48x48.png
|
||||||
* @param pathToWrite the destination path
|
* @param pathToWrite Destination path
|
||||||
*
|
*
|
||||||
* @return if the resource was sucessfully extracted
|
* @return if the resource was successfully extracted
|
||||||
*/
|
*/
|
||||||
protected boolean getResource(String pathInJar, String pathToWrite) {
|
protected boolean getResource(String pathInJar, String pathToWrite) {
|
||||||
return getResource(pathInJar, pathToWrite, true);
|
return getResource(pathInJar, pathToWrite, true);
|
||||||
|
@ -621,7 +673,7 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Returns the path to the actual jar file
|
* Returns the path to the actual jar file
|
||||||
*
|
*
|
||||||
* @return the absolute path to the jar file: C:/Users/myUserName/BeMa.jar.
|
* @return Absolute path to the jar file: C:/Users/myUserName/BeMa.jar.
|
||||||
* When no jar file was found (when launched in Eclipse) the path to the "extracted" jar file will be returned
|
* When no jar file was found (when launched in Eclipse) the path to the "extracted" jar file will be returned
|
||||||
*/
|
*/
|
||||||
protected String getLocationOfJarFile() {
|
protected String getLocationOfJarFile() {
|
||||||
|
@ -633,7 +685,7 @@ public class InstallConfig {
|
||||||
try {
|
try {
|
||||||
location = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath();
|
location = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath();
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
data.log("w", ex, "getLocationOfJarFile");
|
logger.log("w", ex, "getLocationOfJarFile");
|
||||||
location = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
location = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +696,7 @@ public class InstallConfig {
|
||||||
/**
|
/**
|
||||||
* Sets the path to the jar runtime path -{@literal >} overwrite for the portable installation
|
* Sets the path to the jar runtime path -{@literal >} overwrite for the portable installation
|
||||||
*
|
*
|
||||||
* @param location the absolute path to the jar file: C:/Users/de03710/BeMa.jar
|
* @param location Absolute path to the jar file: C:/Users/de03710/BeMa.jar
|
||||||
*/
|
*/
|
||||||
protected void setLocationOfJarFile(String location) {
|
protected void setLocationOfJarFile(String location) {
|
||||||
this.jarRuntimeLocation = location;
|
this.jarRuntimeLocation = location;
|
||||||
|
@ -652,13 +704,24 @@ public class InstallConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum heap size the JVM may consume (-Xmx)
|
* Sets the maximum heap size the JVM may consume (-Xmx)
|
||||||
* @param sizeInMb the maximum size in megabye
|
*
|
||||||
|
* @param sizeInMb Maximum size in megabyte
|
||||||
*/
|
*/
|
||||||
public void setMaxHeapSize(int sizeInMb) {
|
public void setMaxHeapSize(int sizeInMb) {
|
||||||
if (sizeInMb < 2) data.log("w", "The maximum heap size must be greater or equal 2 megabyte", "setMaxHeapSize");
|
if (sizeInMb < 2) logger.log("w", "The maximum heap size must be greater or equal 2 megabyte", "setMaxHeapSize");
|
||||||
else this.maxHeapSize = sizeInMb;
|
else this.maxHeapSize = sizeInMb;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Sets the initial heap size of the JVM (-Xms)
|
||||||
|
*
|
||||||
|
* @param sizeInMb Initial size in megabyte
|
||||||
|
*/
|
||||||
|
public void setInitialHeapSize(int sizeInMb) {
|
||||||
|
if (sizeInMb < 2) logger.log("w", "The initial heap size must be greater or equal 2 megabyte", "setInitialHeapSize");
|
||||||
|
else this.initialHeapSize = sizeInMb;
|
||||||
|
}
|
||||||
|
|
||||||
protected int getMaxHeapSize() { return maxHeapSize; }
|
protected int getMaxHeapSize() { return maxHeapSize; }
|
||||||
|
protected int getInitialHeapSize() { return initialHeapSize; }
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,12 +1,10 @@
|
||||||
package tk.rpjosh.installer;
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.ObjectInputFilter.Config;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
@ -14,9 +12,12 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
@ -25,10 +26,8 @@ import java.util.concurrent.TimeUnit;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import mslinks.ShellLink;
|
import mslinks.ShellLink;
|
||||||
import tk.rpjosh.installer.InstallConfig.OSType;
|
import de.rpjosh.installer.InstallConfig.OSType;
|
||||||
|
|
||||||
import static java.lang.System.setErr;
|
import static java.lang.System.setErr;
|
||||||
import static java.util.prefs.Preferences.systemRoot;
|
import static java.util.prefs.Preferences.systemRoot;
|
||||||
|
@ -36,36 +35,40 @@ import static java.util.prefs.Preferences.systemRoot;
|
||||||
public class Installer {
|
public class Installer {
|
||||||
|
|
||||||
private InstallConfig conf;
|
private InstallConfig conf;
|
||||||
private Data data;
|
private Logger logger;
|
||||||
|
|
||||||
public int error = 0;
|
public int error = 0;
|
||||||
|
|
||||||
public Installer(InstallConfig conf) {
|
public Installer(InstallConfig conf) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
this.data = conf.getData();
|
this.logger = conf.getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the installation of the program
|
* Starts the installation of the program
|
||||||
*
|
*
|
||||||
* @param args If the program has to be restarted you can specify here the parameters with which the program should been restarted.
|
* @param args If the program has to be restarted you can specify the parameters with which the program should bee restarted.
|
||||||
* These are normally the parameters which were specified when launching your installer
|
* These are normally the parameters which were specified when launching your installer
|
||||||
*/
|
*/
|
||||||
public void installProgramm(String[] args) {
|
public void installProgramm(String[] args) {
|
||||||
|
|
||||||
conf.isInstallationStarted = true;
|
conf.isInstallationStarted = true;
|
||||||
|
|
||||||
// überprüfe, ob Root rechte vorhanden sind
|
// Check if architecture is supported by this installer
|
||||||
|
if (InstallConfig.getOsType() != OSType.WINDOWS && InstallConfig.getOsType() != OSType.LINUX) {
|
||||||
|
error = 6;
|
||||||
|
System.err.println(Tr.get("installation_os_not_supported", System.getProperty("os.name")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if the user has root rights
|
||||||
if (!conf.getIsPortable() && !conf.getIsUser()) {
|
if (!conf.getIsPortable() && !conf.getIsUser()) {
|
||||||
if (!this.checkRoot()) {
|
if (!this.checkRoot()) {
|
||||||
System.out.println("Zur Installation dieses Programm werden Administrator / Root Rechte benötigt.\n\n"
|
System.out.println(Tr.get("root_rights_required"));
|
||||||
+ "Falls du keine solchen Rechte hast, kann das Programm auch portable oder nur für diesen Benutzer installiert werden.\n"
|
error = 1;
|
||||||
+ "Für eine weitere Hilfe führe dieses Programm mit dem Parameter --help aus.");
|
|
||||||
error = -1;
|
|
||||||
|
|
||||||
if ( (InstallConfig.getOsType() == OSType.WINDOWS || InstallConfig.getOsType() == OSType.LINUX) && !conf.getQuiet()) {
|
if ( (InstallConfig.getOsType() == OSType.WINDOWS || InstallConfig.getOsType() == OSType.LINUX) && !conf.getQuiet()) {
|
||||||
System.out.print("\nFalls du doch solche Rechte hast, kann das Programm automatisch versuchen, die Installation mit Administratorrechten zu starten.\n"
|
System.out.println(Tr.get("root_askForRestart") + ": ");
|
||||||
+ "Möchtest du das Programm mit Administratorrechten neustarten (Y/N)?: ");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
@ -76,96 +79,101 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in.ready()) {
|
if (in.ready()) {
|
||||||
if (in.readLine().toLowerCase().startsWith("y")) {
|
if (in.readLine().toLowerCase().startsWith("y") || in.readLine().toLowerCase().startsWith("j")) {
|
||||||
RunInConsole.start(args, true, true, true);
|
RunInConsole.start(args, true, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = -2; return;
|
in.close();
|
||||||
|
error = 2; return;
|
||||||
|
|
||||||
} catch (Exception ex) { data.log("e", ex, "installProgramm");
|
} catch (Exception ex) { logger.log("e", ex, "installProgramm");
|
||||||
error = -3; return;
|
error = 3; return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = -4; return;
|
error = 4; return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try { Thread.sleep(10); } catch (Exception ex) { }
|
try { Thread.sleep(10); } catch (Exception ex) { }
|
||||||
|
|
||||||
if (conf.getIsUser() && InstallConfig.getOsType() != OSType.WINDOWS) { System.out.println("A user installation is only available under windows"); error = -10; }
|
if (conf.getIsUser() && InstallConfig.getOsType() != OSType.WINDOWS) { System.err.println("userInstallation_notAvailable"); error = 10; return; }
|
||||||
|
|
||||||
System.out.println("\nStarting the installation of " + conf.getApplicationNameShort() + " (version " + conf.getVersion() + ").\n");
|
System.out.println(Tr.get("installation_start", conf.getApplicationNameShort(), conf.getVersion()) + "\n");
|
||||||
|
|
||||||
// all running instances will be killed
|
// All running instances will be killed
|
||||||
this.killRunningInstances();
|
if (conf.killRunningInstances) this.killRunningInstances();
|
||||||
|
|
||||||
System.out.print("Determine architekture and operating system: ");
|
System.out.print(Tr.get("installation_architekture") + ": ");
|
||||||
String aarch = this.getVersionOfProgramm();
|
String aarch = this.getVersionOfProgramm(); if (error != 0) return; // This could return an error
|
||||||
System.out.println(aarch);
|
System.out.println(aarch);
|
||||||
|
|
||||||
// copies or downloads the file
|
// copies or downloads the file
|
||||||
if (conf.downloadURL == null) {
|
if (conf.downloadURL == null) {
|
||||||
data.log("w", "no file to download or copy specified", "installProgramm");
|
logger.log("w", "no file to download or copy specified", "installProgramm");
|
||||||
error = -5;
|
error = 5;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String jarFile = "";
|
String jarFile = "";
|
||||||
|
|
||||||
if (!conf.getOffline()) {
|
if (!conf.getOffline()) {
|
||||||
System.out.print("Downloading file: ");
|
System.out.print(Tr.get("installation_download") + ": ");
|
||||||
jarFile = this.downloadFile(conf.downloadURL, conf.addVersion, conf.urlEnding);
|
jarFile = this.downloadFile(conf.downloadURL, conf.addVersion, conf.urlEnding, conf.getQuiet() ? false : conf.allowAskForBasicAuth);
|
||||||
if (error < 0) return;
|
if (error != 0) return;
|
||||||
System.out.println("\rDownloading file: successful downloaded");
|
System.out.println("\r" + Tr.get("installation_download_success") + " ");
|
||||||
} else {
|
} else {
|
||||||
File fileOffline = new File(conf.downloadURL);
|
File fileOffline = new File(conf.downloadURL);
|
||||||
|
|
||||||
if (!fileOffline.exists() || fileOffline.length() < ( 1024 * 1024)) {
|
if (!fileOffline.exists() || fileOffline.length() < ( 1024 * 1024)) {
|
||||||
System.out.println("The given file is invalid!");
|
System.err.println(Tr.get("installation_download_invalid"));
|
||||||
error = -11; return;
|
error = 11; return;
|
||||||
}
|
}
|
||||||
jarFile = fileOffline.getAbsolutePath();
|
jarFile = fileOffline.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf.getIsPortable()) {
|
if (conf.getIsPortable()) {
|
||||||
System.out.println("\nProgram will be installed portable under: " + conf.getPortableDir());
|
System.out.println("\n" + Tr.get("installation_portable_start", conf.getPortableDir()));
|
||||||
|
|
||||||
File portableDir = new File(conf.getPortableDir());
|
File portableDir = new File(conf.getPortableDir());
|
||||||
if (!portableDir.exists()) {
|
if (!portableDir.exists()) {
|
||||||
System.out.print("Directory does not exist. Creating directory: ");
|
System.out.print(Tr.get("installation_portable_createDirectory") + ": ");
|
||||||
if (!portableDir.mkdirs()) {
|
if (!portableDir.mkdirs()) {
|
||||||
System.out.print("No authorization!");
|
System.err.print(Tr.get("noAuthorization") + "!");
|
||||||
error = -12; return;
|
error = 12; return;
|
||||||
} else System.out.print("created");
|
} else System.out.print(Tr.get("created"));
|
||||||
}
|
}
|
||||||
|
conf.setPortable(portableDir.getAbsolutePath().replace("\\", "/") + "/");
|
||||||
conf.setPortable(portableDir.getAbsolutePath().replace("\\", "/") + "/");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.print("\nCopy jar file: ");
|
System.out.print("\n" + Tr.get("installation_copyJar") + ": ");
|
||||||
try {
|
try {
|
||||||
FileUtils.copyInputStreamToFile(new FileInputStream(new File(jarFile)), new File(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar"));
|
File source = new File(jarFile);
|
||||||
|
File destination = new File(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar");
|
||||||
|
|
||||||
|
Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("failed.\n\nError message: ");
|
System.out.println(Tr.get("failed") + ".");
|
||||||
ex.printStackTrace();
|
System.err.println("\n" + Tr.get("errorMessage") + ": ");
|
||||||
error = -13; return;
|
logger.log("e", ex, "");
|
||||||
|
|
||||||
|
error = 13; return;
|
||||||
}
|
}
|
||||||
System.out.println("successful\n");
|
System.out.println(Tr.get("successful") + "\n");
|
||||||
|
|
||||||
// sets the path for the jar file for the shortcuts
|
// set the path for the jar file for the shortcuts
|
||||||
conf.setLocationOfJarFile(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar");
|
conf.setLocationOfJarFile(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar");
|
||||||
|
|
||||||
// Icon für die Systemsteuerung für die Deinstallation setzen -> wird immer gesetzt
|
// icon for the control panel for the uninstallation -> set always
|
||||||
if (conf.createIconForDeletion) {
|
if (conf.createIconForDeletion) {
|
||||||
conf.createProgramDirs(new ArrayList<String>() {{ add("pics/"); }});
|
conf.createProgramDirs((List<String>) Arrays.asList(new String[] {"pics/"}));
|
||||||
conf.getResource(conf.iconForDeletionPath, conf.getApplicationDir() + "pics/uninstall.ico");
|
conf.getResource(conf.iconForDeletionPath, conf.getApplicationDir() + "pics/uninstall.ico");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf.getIsPortable()) {
|
if (conf.getIsPortable()) {
|
||||||
|
|
||||||
System.out.print("Creating required files: ");
|
System.out.print(Tr.get("installation_createFiles") + ": ");
|
||||||
try {
|
try {
|
||||||
// creates a file "portable" in the application directory //
|
// creates a file "portable" in the application directory //
|
||||||
FileWriter fw = new FileWriter(conf.getApplicationDir() + "portable");
|
FileWriter fw = new FileWriter(conf.getApplicationDir() + "portable");
|
||||||
|
@ -177,23 +185,26 @@ public class Installer {
|
||||||
|
|
||||||
if (InstallConfig.getOsType() == OSType.LINUX) {
|
if (InstallConfig.getOsType() == OSType.LINUX) {
|
||||||
// create a launch script
|
// create a launch script
|
||||||
this.createLauncher("Programm/" + conf.getApplicationNameShort() + ".jar", conf.getPortableDir() + conf.getApplicationNameShort(), false);
|
this.createLauncher("", conf.getPortableDir() + conf.getApplicationNameShort(), false);
|
||||||
|
|
||||||
//Datei ausführbar machen
|
// make the file executable
|
||||||
Process p = new ProcessBuilder("bash", "-c", "chmod +x " + conf.getPortableDir() + conf.getApplicationNameShort()).start();
|
Process p = new ProcessBuilder("bash", "-c", "chmod +x " + conf.getPortableDir() + conf.getApplicationNameShort()).start();
|
||||||
p.waitFor(5000, TimeUnit.SECONDS);
|
p.waitFor(5000, TimeUnit.SECONDS);
|
||||||
|
|
||||||
this.createDesktopShortcut(conf.getPortableDir() + conf.getApplicationNameShort() + ".desktop", "");
|
this.createDesktopShortcut(conf.getPortableDir() + conf.getApplicationNameShort() + ".desktop", "");
|
||||||
} else if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
} else if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
||||||
|
// Create launch script
|
||||||
|
this.createLauncher("", conf.getPortableDir() + conf.getApplicationNameShort() + ".bat", false);
|
||||||
|
|
||||||
this.createDesktopShortcut(conf.getPortableDir() + conf.getApplicationNameShort() + ".lnk", "");
|
this.createDesktopShortcut(conf.getPortableDir() + conf.getApplicationNameShort() + ".lnk", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("erfolgreich");
|
System.out.println(Tr.get("successful"));
|
||||||
|
|
||||||
} catch (Exception ex) { System.out.println("fehlgeschlagen"); error = -14; return; }
|
} catch (Exception ex) { System.out.println(Tr.get("failed")); error = 14; return; }
|
||||||
|
|
||||||
} else if (conf.getIsUser()) {
|
} else if (conf.getIsUser()) {
|
||||||
// erstelle eine Textdatei User im Programmverzeichnis, damit erkenbar ist, dass das Programm nur für den aktuellen Benutze instsalliert worden ist. //
|
// creates a file "userInstallation" in the application directory //
|
||||||
try {
|
try {
|
||||||
FileWriter fw = new FileWriter(conf.getApplicationDir() + "userInstallation");
|
FileWriter fw = new FileWriter(conf.getApplicationDir() + "userInstallation");
|
||||||
PrintWriter pw = new PrintWriter(fw);
|
PrintWriter pw = new PrintWriter(fw);
|
||||||
|
@ -201,27 +212,27 @@ public class Installer {
|
||||||
pw.println("Therefore please do not delete this inconspicuous file!");
|
pw.println("Therefore please do not delete this inconspicuous file!");
|
||||||
pw.flush();
|
pw.flush();
|
||||||
pw.close();
|
pw.close();
|
||||||
System.out.println("Execute other commands...");
|
System.out.println(Tr.get("installation_executeOtherCommands") + "...");
|
||||||
this.registerApplication(conf.getIsUser());
|
this.registerApplication(conf.getIsUser());
|
||||||
} catch (Exception ex) { System.out.println("Creation of the files failed..."); error = -15; return; }
|
} catch (Exception ex) { System.out.println(Tr.get("installation_createFilesFailed") + "..."); error = 15; return; }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Execute other commands...");
|
System.out.println(Tr.get("installation_executeOtherCommands") + "...");
|
||||||
|
|
||||||
// the program will be created
|
// the program will be created
|
||||||
this.registerApplication(conf.getIsUser());
|
this.registerApplication(conf.getIsUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.installFonts();
|
this.installFonts();
|
||||||
|
this.finishInstallation();
|
||||||
|
|
||||||
if (error < 0) return;
|
if (error != 0) return;
|
||||||
|
|
||||||
System.out.println("\nInstallation was completed successfully\n");
|
|
||||||
|
|
||||||
|
System.out.println("\n" + Tr.get("installation_executionSuccessful") + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beendet alle noch möglicherweise laufenden Instanzen des Programms (z.B. bei einem Update)
|
* Kills all running instances (for a update)
|
||||||
*/
|
*/
|
||||||
private void killRunningInstances() {
|
private void killRunningInstances() {
|
||||||
|
|
||||||
|
@ -232,18 +243,25 @@ public class Installer {
|
||||||
p.waitFor(5, TimeUnit.SECONDS);
|
p.waitFor(5, TimeUnit.SECONDS);
|
||||||
|
|
||||||
} else if (InstallConfig.getOsType() == OSType.LINUX) {
|
} else if (InstallConfig.getOsType() == OSType.LINUX) {
|
||||||
|
// If a service was installed previously try to stop it first. This will fail internal when no service was created
|
||||||
|
if (!conf.getIsPortable()) {
|
||||||
|
Process p = new ProcessBuilder("bash", "-c", "systemctl stop \"" + conf.getApplicationNameShort() + ".service" + "\"").start();
|
||||||
|
p.waitFor(5, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
Process p = new ProcessBuilder("bash", "-c", "pkill -9 -f '" + conf.getApplicationNameShort() + ".jar'").start();
|
Process p = new ProcessBuilder("bash", "-c", "pkill -9 -f '" + conf.getApplicationNameShort() + ".jar'").start();
|
||||||
p.waitFor(5, TimeUnit.SECONDS);
|
p.waitFor(5, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) { /* nicht nötig */ }
|
} catch (Exception ex) { /* not required */ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt eine Verknüpfung zur Jar-Datei
|
* Creates a shortcut to the jar file
|
||||||
* @param target Wo die Verknüpfung erstellt werden soll, sowie dessen Dateinamen (z.B. /home/user/Desktop/BeMa.desktop oder C:/User/de03710/Desktop/hi.moin)
|
*
|
||||||
* @param args zusätzliche Parameter wie -u hi -p secret -w
|
* @param target Where to create the shortcut and the filename (z.B. /home/user/Desktop/MyApp.desktop oder C:/User/de03710/Desktop/hi.moin)
|
||||||
|
* @param args Additional parameters how "--minimized"
|
||||||
*/
|
*/
|
||||||
private void createDesktopShortcut(String target, String args) {
|
private void createDesktopShortcut(String target, String args) {
|
||||||
|
|
||||||
|
@ -286,7 +304,7 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("e", ex, "createDesktopShortcut");
|
logger.log("e", ex, "createDesktopShortcut");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,13 +313,28 @@ public class Installer {
|
||||||
|
|
||||||
if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
||||||
|
|
||||||
// Erstellung eines Links, damit das Proramm von überall aufgerufen werden kann //
|
// Creates a Link that the program can be launched from everywhere //
|
||||||
this.createLauncher("", "", true);
|
this.createLauncher("", "", true);
|
||||||
// create also an link for the %PATH% variable
|
|
||||||
if (conf.createPathVariable) this.createLauncher("", conf.getApplicationDir() + "path/" + conf.getApplicationNameShort() + ".bat", true);
|
// Create also an link for the %PATH% variable
|
||||||
|
if (conf.createPathVariable) {
|
||||||
|
this.createLauncher("", conf.getApplicationDir() + "path/" + conf.getApplicationNameShort() + ".bat", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a GUI auto start file //
|
||||||
|
if (conf.createGuiAutostart) {
|
||||||
|
String pathMenu = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\" + conf.getApplicationNameShort() + ".lnk";
|
||||||
|
|
||||||
|
// Create an autostart file only for the current user
|
||||||
|
if (conf.getIsUser()) {
|
||||||
|
pathMenu = System.getenv("APPDATA") + "\\Microsoft\\Windows\\Start Menu\\Programs\\Autostart\\" + conf.getApplicationNameShort() + ".lnk";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createDesktopShortcut(pathMenu, conf.guiAutostartFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// zuerst wird eine Dekstopverknüpfung erstellt //
|
// in the first step a desktop shortcut will be created //
|
||||||
if (conf.getCreateDesktopEntry()) {
|
if (conf.getCreateDesktopEntry()) {
|
||||||
|
|
||||||
if (userInstallation) {
|
if (userInstallation) {
|
||||||
|
@ -309,21 +342,21 @@ public class Installer {
|
||||||
destination += conf.getApplicationNameShort() + ".lnk";
|
destination += conf.getApplicationNameShort() + ".lnk";
|
||||||
createDesktopShortcut(destination, "");
|
createDesktopShortcut(destination, "");
|
||||||
} else {
|
} else {
|
||||||
// es wird eine Verknknüpfung im Öffentlichen Desktop erstellt
|
// shortcut in the public desktop
|
||||||
String destination = System.getenv("public").replace("\\", "/") + "/Desktop/";
|
String destination = System.getenv("public").replace("\\", "/") + "/Desktop/";
|
||||||
destination += conf.getApplicationNameShort() + ".lnk";
|
destination += conf.getApplicationNameShort() + ".lnk";
|
||||||
createDesktopShortcut(destination, "");
|
createDesktopShortcut(destination, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// im nächsten Schritt wird eine Verknüpfung in das Startmenü aufgenommenn //
|
// In the next step a shortcut in the start menu will be created //
|
||||||
String locationStartMenu = "";
|
String locationStartMenu = "";
|
||||||
if (userInstallation) {
|
if (userInstallation) {
|
||||||
locationStartMenu = System.getenv("APPDATA").replace("\\", "/") + "/Microsoft/Windows/Start Menu/Programs/";
|
locationStartMenu = System.getenv("APPlogger").replace("\\", "/") + "/Microsoft/Windows/Start Menu/Programs/";
|
||||||
} else {
|
} else {
|
||||||
locationStartMenu = System.getenv("ALLUSERSPROFILE").replace("\\", "/") + "/Microsoft/Windows/Start Menu/Programs/";
|
locationStartMenu = System.getenv("ALLUSERSPROFILE").replace("\\", "/") + "/Microsoft/Windows/Start Menu/Programs/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new File(locationStartMenu).exists()) data.log("w", "Start Menu folder \"" + locationStartMenu + "\" does not exist!", "registerApplication");
|
if (!new File(locationStartMenu).exists()) logger.log("w", "Start Menu folder \"" + locationStartMenu + "\" does not exist!", "registerApplication");
|
||||||
else {
|
else {
|
||||||
locationStartMenu += conf.getCompany() + "/";
|
locationStartMenu += conf.getCompany() + "/";
|
||||||
new File(locationStartMenu).mkdirs();
|
new File(locationStartMenu).mkdirs();
|
||||||
|
@ -334,7 +367,7 @@ public class Installer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// es muss noch ein uninstall Schlüssel in die Registry geschrieben werden, um über die Systemsteuerung alles deinstallieren zu können //
|
// an uninstall keys has to be written to the registry, for uninstallation purposes in the system control //
|
||||||
String iconPath = conf.getApplicationDir() + "pics/uninstall.ico";
|
String iconPath = conf.getApplicationDir() + "pics/uninstall.ico";
|
||||||
String locationRegistry = "";
|
String locationRegistry = "";
|
||||||
|
|
||||||
|
@ -356,7 +389,7 @@ public class Installer {
|
||||||
String locationRegistryPath = "";
|
String locationRegistryPath = "";
|
||||||
if (conf.createPathVariable) {
|
if (conf.createPathVariable) {
|
||||||
|
|
||||||
// adding support for "start RPdb"
|
// adding support for "start MyProgram"
|
||||||
locationRegistryPath += "$REGISTRYPATH$" + conf.getApplicationNameShort() + ".exe";
|
locationRegistryPath += "$REGISTRYPATH$" + conf.getApplicationNameShort() + ".exe";
|
||||||
String batchFilePath =
|
String batchFilePath =
|
||||||
"reg add \"" + locationRegistryPath + "\" /f \n"
|
"reg add \"" + locationRegistryPath + "\" /f \n"
|
||||||
|
@ -367,25 +400,40 @@ public class Installer {
|
||||||
if (userInstallation) batchFile += batchFilePath.replace("$REGISTRYPATH$", "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
if (userInstallation) batchFile += batchFilePath.replace("$REGISTRYPATH$", "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
||||||
if (!userInstallation) batchFile += batchFilePath.replace("$REGISTRYPATH$", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
if (!userInstallation) batchFile += batchFilePath.replace("$REGISTRYPATH$", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
||||||
|
|
||||||
// expanding the path variable
|
// expanding the path variable (add to path and registry)
|
||||||
// @TODO maybe we should edit the path variable in the registry directly HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment to overcome the 1024 max lenght limit
|
|
||||||
batchFile +=
|
batchFile +=
|
||||||
"setlocal EnableDelayedExpansion\n"
|
"setlocal EnableDelayedExpansion\n"
|
||||||
+ "set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
+ "set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
||||||
+ "set \"REPLACETEXT=;\"\n";
|
+ "set \"REPLACETEXT=;\"\n";
|
||||||
|
|
||||||
|
// Windows has a limit of 1024 character for setting the path with "setx". To overcome this limit, we try to modify the path variable via the registry instead of writing
|
||||||
|
// it directly.
|
||||||
|
|
||||||
|
/*
|
||||||
if (userInstallation) batchFile +=
|
if (userInstallation) batchFile +=
|
||||||
"for /F \"skip=2 tokens=1,2*\" %%N in ('%SystemRoot%\\System32\\reg.exe query \"HKCU\\Environment\" /v \"Path\" 2^>nul') do if /I \"%%N\" == \"Path\" call set \"UserPath=%%P\"\n"
|
"for /F \"skip=2 tokens=1,2*\" %%N in ('%SystemRoot%\\System32\\reg.exe query \"HKCU\\Environment\" /v \"Path\" 2^>nul') do if /I \"%%N\" == \"Path\" call set \"UserPath=%%P\"\n"
|
||||||
+ "set \"newText=!UserPath:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
+ "set \"newText=!UserPath:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
||||||
+ "if \"!UserPath!\" == \"%newText%\" ( setx PATH \"%UserPath%;" + conf.getApplicationDir().replace("/", "\\") + "path;\")\n";
|
+ "if \"!UserPath!\" == \"%newText%\" ( setx PATH \"%UserPath%;" + conf.getApplicationDir().replace("/", "\\") + "path;\")\n";
|
||||||
if (!userInstallation) batchFile +=
|
if (!userInstallation) batchFile +=
|
||||||
"set \"newText=!PATH:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
"set \"newText=!PATH:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
||||||
+ "if \"%PATH%\" == \"%newText%\" ( setx /M PATH \"%PATH%;" + conf.getApplicationDir().replace("/", "\\") + "path;\")\n";
|
+ "if \"%PATH%\" == \"%newText%\" ( setx /M PATH \"%PATH%;" + conf.getApplicationDir().replace("/", "\\") + "path;\")\n";
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!userInstallation) locationRegistry = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
|
||||||
|
else locationRegistry = "HKCU\\Environment";
|
||||||
|
batchFile +=
|
||||||
|
"set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
||||||
|
+ "set \"REPLACETEXT=;\"\n"
|
||||||
|
+ "for /F \"skip=2 tokens=1,2*\" %%N in ('%SystemRoot%\\System32\\reg.exe query \"" + locationRegistry + "\" /v \"Path\" 2^>nul') do if /I \"%%N\" == \"Path\" call set \"RegPath=%%P\"\n"
|
||||||
|
+ "set \"newText=!RegPath:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
||||||
|
+ "if \"%RegPath%\" == \"%newText%\" ( reg add \"" + locationRegistry + "\" /v Path /t REG_SZ /f /d \"%RegPath%;" + conf.getApplicationDir().replace("/", "\\") + "path;\")\n";
|
||||||
|
|
||||||
batchFile += "endlocal\n";
|
batchFile += "endlocal\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// es wird die Batch-Datei erstellt, und anschließend ausgeführt
|
// creating a batch file and execute the commands
|
||||||
File batchMakeRegeditEntry = File.createTempFile("installApplication", ".bat");
|
File batchMakeRegeditEntry = File.createTempFile("installApplication-register", ".bat");
|
||||||
|
|
||||||
FileWriter fwFile = new FileWriter(batchMakeRegeditEntry);
|
FileWriter fwFile = new FileWriter(batchMakeRegeditEntry);
|
||||||
PrintWriter pwFile = new PrintWriter(fwFile);
|
PrintWriter pwFile = new PrintWriter(fwFile);
|
||||||
|
@ -395,17 +443,17 @@ public class Installer {
|
||||||
pwFile.close();
|
pwFile.close();
|
||||||
|
|
||||||
Process p = new ProcessBuilder("cmd.exe", "/C", batchMakeRegeditEntry.getAbsolutePath()).start();
|
Process p = new ProcessBuilder("cmd.exe", "/C", batchMakeRegeditEntry.getAbsolutePath()).start();
|
||||||
if (!p.waitFor(10, TimeUnit.SECONDS)) data.log("w", "Batch File which adds some Registry Keys timed out", "registerApplication");
|
if (!p.waitFor(10, TimeUnit.SECONDS)) logger.log("w", "Batch File which adds some Registry Keys timed out", "registerApplication");
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("e", ex, "registerApplication (make regedit Entry)");
|
logger.log("e", ex, "registerApplication (make regedit Entry)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// nun muss noch ein uninstall Skript zur Verfügung gestellt werden //
|
// create a uninstall script //
|
||||||
String batchFileUninstall = "@echo off \n"
|
String batchFileUninstall = "@echo off \n"
|
||||||
+ "wmic PROCESS Where \"name Like '%%java%%' AND CommandLine like '%%" + conf.getApplicationNameShort() + "%%'\" Call Terminate \n";
|
+ "wmic PROCESS Where \"name Like '%%java%%' AND CommandLine like '%%" + conf.getApplicationNameShort() + "%%'\" Call Terminate \n";
|
||||||
if (userInstallation) batchFileUninstall += "del \"%LOCALAPPDATA%";
|
if (userInstallation) batchFileUninstall += "del \"%LOCALAPPlogger%";
|
||||||
else batchFileUninstall += "del \"%ProgramData%";
|
else batchFileUninstall += "del \"%Programlogger%";
|
||||||
batchFileUninstall +=
|
batchFileUninstall +=
|
||||||
"\\Microsoft\\Windows\\Start Menu\\Programs\\" + conf.getCompany() + "\\" + conf.getApplicationNameShort() + "*\" /q \n"
|
"\\Microsoft\\Windows\\Start Menu\\Programs\\" + conf.getCompany() + "\\" + conf.getApplicationNameShort() + "*\" /q \n"
|
||||||
+ "rd \"" + conf.getConfigDir().replace("/", "\\") + "\" /q /s \n"
|
+ "rd \"" + conf.getConfigDir().replace("/", "\\") + "\" /q /s \n"
|
||||||
|
@ -414,22 +462,26 @@ public class Installer {
|
||||||
+ "del \"" + conf.getDesktopDir().replace("/", "\\") + conf.getApplicationNameShort() + " - *.lnk\" /q \n"
|
+ "del \"" + conf.getDesktopDir().replace("/", "\\") + conf.getApplicationNameShort() + " - *.lnk\" /q \n"
|
||||||
+ "del \"%public%\\Desktop\\" + conf.getApplicationNameShort() + ".lnk\" /q \n";
|
+ "del \"%public%\\Desktop\\" + conf.getApplicationNameShort() + ".lnk\" /q \n";
|
||||||
|
|
||||||
|
// Remove path entry
|
||||||
if (conf.createPathVariable) {
|
if (conf.createPathVariable) {
|
||||||
|
locationRegistryPath += "$REGISTRYPATH$" + conf.getApplicationNameShort() + ".exe";
|
||||||
if (userInstallation) batchFileUninstall += "reg delete \"" + locationRegistryPath.replace("$REGISTRYPATH$", "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\") + "\" /f \n";
|
if (userInstallation) batchFileUninstall += "reg delete \"" + locationRegistryPath.replace("$REGISTRYPATH$", "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\") + "\" /f \n";
|
||||||
if (!userInstallation) batchFileUninstall += "reg delete \"" + locationRegistryPath.replace("$REGISTRYPATH$", "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\") + "\" /f \n";
|
if (!userInstallation) batchFileUninstall += "reg delete \"" + locationRegistryPath.replace("$REGISTRYPATH$", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\") + "\" /f \n";
|
||||||
|
|
||||||
// removing path entry
|
if (!userInstallation) locationRegistry = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
|
||||||
|
else locationRegistry = "HKCU\\Environment";
|
||||||
|
batchFileUninstall +=
|
||||||
|
"setlocal EnableDelayedExpansion\n"
|
||||||
|
+ "set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
||||||
|
+ "set \"REPLACETEXT=;\"\n"
|
||||||
|
+ "for /F \"skip=2 tokens=1,2*\" %%N in ('%SystemRoot%\\System32\\reg.exe query \"" + locationRegistry + "\" /v \"Path\" 2^>nul') do if /I \"%%N\" == \"Path\" call set \"RegPath=%%P\"\n"
|
||||||
|
+ "set \"newText=!RegPath:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
||||||
|
+ "reg add \"" + locationRegistry + "\" /v Path /t REG_SZ /f /d \"%newText%\"\n";
|
||||||
batchFileUninstall +=
|
batchFileUninstall +=
|
||||||
"setlocal EnableDelayedExpansion\n"
|
"setlocal EnableDelayedExpansion\n"
|
||||||
+ "set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
+ "set \"SEARCHTEXT=;" + conf.getApplicationDir().replace("/", "\\") + "path;\"\n"
|
||||||
+ "set \"REPLACETEXT=;\"\n";
|
+ "set \"REPLACETEXT=;\"\n";
|
||||||
if (userInstallation) batchFileUninstall +=
|
|
||||||
"for /F \"skip=2 tokens=1,2*\" %%N in ('%SystemRoot%\\System32\\reg.exe query \"HKCU\\Environment\" /v \"Path\" 2^>nul') do if /I \"%%N\" == \"Path\" call set \"UserPath=%%P\"\n"
|
|
||||||
+ "set \"newText=!UserPath:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
|
||||||
+ "setx PATH \"%newText%\"\n";
|
|
||||||
if (!userInstallation) batchFileUninstall +=
|
|
||||||
"set \"newText=!PATH:%SEARCHTEXT%=%REPLACETEXT%!\"\n"
|
|
||||||
+ "setx /M PATH \"%newText%\"\n";
|
|
||||||
batchFileUninstall += "endlocal \n";
|
batchFileUninstall += "endlocal \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +490,7 @@ public class Installer {
|
||||||
+ "pause\n";
|
+ "pause\n";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// es wird die Batch-Datei erstellt
|
// creating the batch file
|
||||||
File uninstallFile = new File(conf.getApplicationDir() + "uninstall.bat");
|
File uninstallFile = new File(conf.getApplicationDir() + "uninstall.bat");
|
||||||
|
|
||||||
FileWriter fwFile = new FileWriter(uninstallFile);
|
FileWriter fwFile = new FileWriter(uninstallFile);
|
||||||
|
@ -449,30 +501,37 @@ public class Installer {
|
||||||
pwFile.close();
|
pwFile.close();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("e", ex, "registerApplication (make uninstall Skript)");
|
logger.log("e", ex, "registerApplication (make uninstall Skript)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InstallConfig.getOsType() == OSType.LINUX) {
|
if (InstallConfig.getOsType() == OSType.LINUX) {
|
||||||
|
|
||||||
// keine Erstellung einer Verknüpfung, da Installer als root ausgeführt wird //
|
// create a shortcut because the installer is always run as root //
|
||||||
|
|
||||||
if (!checkRoot()) { data.log("i", "Installer has to be run as a root user", "registerApplication" ); return; }
|
if (!checkRoot()) { logger.log("i", "Installer has to be run as a root user", "registerApplication" ); return; }
|
||||||
|
|
||||||
// Erstellung einer Verknüpfung für das StartMenü //
|
// create a shortcut in the start menu //
|
||||||
if (conf.getCreateDesktopEntry()) {
|
if (conf.getCreateDesktopEntry()) {
|
||||||
String pathMenu = "/usr/share/applications/" + conf.getApplicationNameShort() + ".desktop";
|
String pathMenu = "/usr/share/applications/" + conf.getApplicationNameShort() + ".desktop";
|
||||||
this.createDesktopShortcut(pathMenu, "");
|
this.createDesktopShortcut(pathMenu, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Erstellung eines Links, damit das Proramm von überall aufgerufen werden kann //
|
// create a link that the program can be executed from everywhere //
|
||||||
this.createLauncher("", "", true);
|
this.createLauncher("", "", true);
|
||||||
|
|
||||||
// Create a systemd unit file //
|
// create a systemd unit file //
|
||||||
if (conf.createUnitFile) this.createUnitFile();
|
if (conf.createUnitFile) this.createUnitFile();
|
||||||
|
|
||||||
// Create a uninstaller //
|
// create a GUI auto start file //
|
||||||
|
if (conf.createGuiAutostart) {
|
||||||
|
// Currently only Gnome is supported
|
||||||
|
String pathMenu = "/home/" + conf.guiAutostartUser + "/.config/autostart/" + conf.getApplicationNameShort() + ".desktop";
|
||||||
|
this.createDesktopShortcut(pathMenu, conf.guiAutostartFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a uninstaller //
|
||||||
try {
|
try {
|
||||||
String batchFileUninstall = "#!/bin/bash" + "\n"
|
String batchFileUninstall = "#!/bin/bash" + "\n"
|
||||||
+ "keepUserSettings=false" + "\n"
|
+ "keepUserSettings=false" + "\n"
|
||||||
|
@ -520,6 +579,11 @@ public class Installer {
|
||||||
+ "systemctl daemon-reload" + "\n"
|
+ "systemctl daemon-reload" + "\n"
|
||||||
+ "\n";
|
+ "\n";
|
||||||
}
|
}
|
||||||
|
// remove autostart entry
|
||||||
|
if (conf.createGuiAutostart) {
|
||||||
|
batchFileUninstall
|
||||||
|
+= "rm -f \"" + "/home/" + conf.guiAutostartUser + "/.config/autostart/" + conf.getApplicationNameShort() + ".desktop\"" + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
batchFileUninstall += "\necho \"\"";
|
batchFileUninstall += "\necho \"\"";
|
||||||
|
|
||||||
|
@ -537,17 +601,18 @@ public class Installer {
|
||||||
p.waitFor(5000, TimeUnit.SECONDS);
|
p.waitFor(5000, TimeUnit.SECONDS);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("e", ex, "registerApplication (create Uninstall-Skript");
|
logger.log("e", ex, "registerApplication (create Uninstall-Skript");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt einen ausführbaren Link zum launcher unter Linux und Windows (unter Windows wird dieses auch in path folder gelegt.
|
* Creates an executable link to the launcher under Linux and Windows (in Windows the path will also be created)
|
||||||
* @param pathToLink Der Pfad zur .jar Datei. Ohne eine angabe wird der Aktuelle Pfad der Jar-Datei genommen
|
*
|
||||||
* @param pathToCreate Wo die Datei abgelegt werden soll. Standardmäßig wird /usr/bin/nameOfProgram genommen
|
* @param pathToLink the path to the .jar file. Is this parameter empty, the actual set path will be considered
|
||||||
* @param uninstaller Ob auch eine Uninstall-Option implementiert werden soll
|
* @param pathToCreate where the file should been placed. Defaulting to the path "/usr/bin/nameOfProgram"
|
||||||
|
* @param uninstaller if also an uninstall option should be implemented
|
||||||
*/
|
*/
|
||||||
private void createLauncher(String pathToLink, String destination, boolean uninstaller) {
|
private void createLauncher(String pathToLink, String destination, boolean uninstaller) {
|
||||||
|
|
||||||
|
@ -609,8 +674,12 @@ public class Installer {
|
||||||
+ "elif [ \"$uninstall\" = \"true\" ]; then" + "\n"
|
+ "elif [ \"$uninstall\" = \"true\" ]; then" + "\n"
|
||||||
+ " " + conf.getApplicationDir() + "uninstall.sh" + "\n"
|
+ " " + conf.getApplicationDir() + "uninstall.sh" + "\n"
|
||||||
+ "else" + "\n"
|
+ "else" + "\n"
|
||||||
+ " if [ \"$foreground\" = \"true\" ] || [ \"$foreground\" = \"trueDefault\" ]; then eval \"java" + (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + " -jar \"\"" + pathToLink + "\"\" \"\"$programOptions\"\"\"" + "\n"
|
+ " if [ \"$foreground\" = \"true\" ] || [ \"$foreground\" = \"trueDefault\" ]; then eval \"java"
|
||||||
+ " else ( eval \"java" + (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + " -jar \"\"" + pathToLink + "\"\" \"\"$programOptions\"\" > /dev/null 2> /dev/null\") &" + "\n"
|
+ (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + (conf.getInitialHeapSize() != 0 ? (" -Xms" + conf.getInitialHeapSize()) + "M" : "")
|
||||||
|
+ " -jar \"\"" + pathToLink + "\"\" \"\"$programOptions\"\"\"" + "\n"
|
||||||
|
+ " else ( eval \"java"
|
||||||
|
+ (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + (conf.getInitialHeapSize() != 0 ? (" -Xms" + conf.getInitialHeapSize()) + "M" : "")
|
||||||
|
+ " -jar \"\"" + pathToLink + "\"\" \"\"$programOptions\"\" > /dev/null 2> /dev/null\") &" + "\n"
|
||||||
+ " fi" + "\n"
|
+ " fi" + "\n"
|
||||||
+ "fi" + "\n";
|
+ "fi" + "\n";
|
||||||
|
|
||||||
|
@ -631,7 +700,7 @@ public class Installer {
|
||||||
p.waitFor(5000, TimeUnit.SECONDS);
|
p.waitFor(5000, TimeUnit.SECONDS);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("w", "Could not create Link to Programm", "registerApplication (create Link)");
|
logger.log("w", "Could not create Link to Programm", "registerApplication (create Link)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
else if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
||||||
|
@ -649,6 +718,7 @@ public class Installer {
|
||||||
+ "SET stop=\"false\"\n"
|
+ "SET stop=\"false\"\n"
|
||||||
+ "SET uninstall=\"false\"\n"
|
+ "SET uninstall=\"false\"\n"
|
||||||
+ "SET programOption=\n"
|
+ "SET programOption=\n"
|
||||||
|
+ "SET background=\"false\"\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ ":: determine the number of given arguments and fill the array\n"
|
+ ":: determine the number of given arguments and fill the array\n"
|
||||||
+ "SET argCount=0\n"
|
+ "SET argCount=0\n"
|
||||||
|
@ -708,8 +778,9 @@ public class Installer {
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ ":: main programm logic\n"
|
+ ":: main programm logic\n"
|
||||||
+ "SET exitScript=0\n"
|
+ "SET exitScript=0\n"
|
||||||
+ "IF defined programOption if %foreground% == \"falseDefault\" SET foreground=\"true\"\n"
|
+ "IF defined programOption IF %foreground% == \"falseDefault\" SET foreground=\"true\"\n"
|
||||||
+ "IF %foreground% == \"trueDefault\" SET foreground=\"true\"\n"
|
+ "IF %foreground% == \"trueDefault\" SET foreground=\"true\"\n"
|
||||||
|
+ "IF %background% == \"true\" SET foreground=\"false\"\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "IF %stop% == \"true\" (\n"
|
+ "IF %stop% == \"true\" (\n"
|
||||||
+ " wmic PROCESS Where \"name Like '%%java%%' AND CommandLine like '%%" + conf.getApplicationNameShort() + "%%'\" Call Terminate\n"
|
+ " wmic PROCESS Where \"name Like '%%java%%' AND CommandLine like '%%" + conf.getApplicationNameShort() + "%%'\" Call Terminate\n"
|
||||||
|
@ -724,9 +795,13 @@ public class Installer {
|
||||||
+ "IF %exitScript% == 1 exit /b 0\n"
|
+ "IF %exitScript% == 1 exit /b 0\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "IF %foreground% == \"true\" (\n"
|
+ "IF %foreground% == \"true\" (\n"
|
||||||
+ " CALL java" + (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + " -jar \"" + pathToLink + "\" %programOption% \n"
|
+ " CALL java"
|
||||||
|
+ (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + (conf.getInitialHeapSize() != 0 ? (" -Xms" + conf.getInitialHeapSize()) + "M" : "")
|
||||||
|
+ " -jar \"" + pathToLink + "\" %programOption% \n"
|
||||||
+ ") ELSE ( \n"
|
+ ") ELSE ( \n"
|
||||||
+ " CALL START /MIN CMD /C CALL java" + (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + " -jar \"" + pathToLink + "\" %programOption% > NUL \n"
|
+ " CALL START /MIN CMD /C START javaw"
|
||||||
|
+ (conf.getMaxHeapSize() != 0 ? (" -Xmx" + conf.getMaxHeapSize()) + "M" : "") + (conf.getInitialHeapSize() != 0 ? (" -Xms" + conf.getInitialHeapSize()) + "M" : "")
|
||||||
|
+ " -jar \"" + pathToLink + "\" %programOption% > NUL \n"
|
||||||
+ ") \n"
|
+ ") \n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ ":: don't execute printHelp\n"
|
+ ":: don't execute printHelp\n"
|
||||||
|
@ -756,7 +831,7 @@ public class Installer {
|
||||||
pwFile.close();
|
pwFile.close();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("w", "Could not create Link to Programm", "registerApplication (create Link)");
|
logger.log("w", "Could not create Link to Programm", "registerApplication (create Link)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -766,18 +841,22 @@ public class Installer {
|
||||||
*/
|
*/
|
||||||
public void createUnitFile() {
|
public void createUnitFile() {
|
||||||
|
|
||||||
// nothing to do (maybe create a windows service file when needed)
|
// Nothing to do (maybe create a windows service file when needed)
|
||||||
if (InstallConfig.getOsType() != OSType.LINUX) return;
|
if (InstallConfig.getOsType() != OSType.LINUX) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// check if systemd is present on the machine
|
// Check if systemd is present on the machine
|
||||||
String testCommand = "if [ -d /run/systemd/system/ ]; then echo yes; else echo no; fi";
|
String testCommand = "if [ -d /run/systemd/system/ ]; then echo yes; else echo no; fi";
|
||||||
Process p = new ProcessBuilder("bash", "-c", testCommand).start();
|
Process p = new ProcessBuilder("bash", "-c", testCommand).start();
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
String output = buf.readLine();
|
String output = buf.readLine();
|
||||||
if (!output.equals("yes")) { data.log("d", "systemd was nout found on the machine -> don't create a service unit", "registerApplication (create Unit File)"); return; }
|
if (!output.equals("yes")) { logger.log("d", "systemd was nout found on the machine -> don't create a service unit", "registerApplication (create Unit File)"); return; }
|
||||||
|
|
||||||
|
// Try to stop an unit that is already running (it will be updated with the newest version of the unit file -> don't leave)
|
||||||
|
p = new ProcessBuilder("bash", "-c", "systemctl stop \"" + conf.getApplicationNameShort() + ".service" + "\"").start();
|
||||||
|
p.waitFor(5000, TimeUnit.SECONDS);
|
||||||
|
|
||||||
// create the unit file
|
// create the unit file
|
||||||
String s = "[Unit]\n";
|
String s = "[Unit]\n";
|
||||||
|
@ -804,8 +883,8 @@ public class Installer {
|
||||||
if (conf.serviceRestart != null) s += "Restart=" + conf.serviceRestart + "\n";
|
if (conf.serviceRestart != null) s += "Restart=" + conf.serviceRestart + "\n";
|
||||||
if (conf.serviceRestartSec != null) s += "RestartSec=" + conf.serviceRestartSec + "\n";
|
if (conf.serviceRestartSec != null) s += "RestartSec=" + conf.serviceRestartSec + "\n";
|
||||||
|
|
||||||
// get all users for systemd configs: getent passwd | grep -v '/usr/sbin/nologin' | grep -v '/bin/false' | awk -F: '($6 != "" && ($3 > 10 || $3 == 0)) {print $6}'
|
// Get all users for systemd configs: getent passwd | grep -v '/usr/sbin/nologin' | grep -v '/bin/false' | awk -F: '($6 != "" && ($3 > 10 || $3 == 0)) {print $6}'.
|
||||||
// for Linux only a installation as root is supported -> no user systemd entry
|
// For Linux only a installation as root is supported -> no user systemd entry
|
||||||
String destination = "/etc/systemd/system/" + conf.getApplicationNameShort() + ".service";
|
String destination = "/etc/systemd/system/" + conf.getApplicationNameShort() + ".service";
|
||||||
File createLink = new File(destination);
|
File createLink = new File(destination);
|
||||||
|
|
||||||
|
@ -826,7 +905,7 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("w", "Could not create a systemd unit file", "registerApplication (create Unit File)");
|
logger.log("w", "Could not create a systemd unit file", "registerApplication (create Unit File)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,15 +923,16 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Überprüft, ob ein Nutzer unter Linux oder Windows root Rechte hat
|
* Checks if the user has administrative privileges in Linux and Windows
|
||||||
* @return Ob de Nutzer Root Rechte hat
|
*
|
||||||
|
* @return if the user has root privileges
|
||||||
*/
|
*/
|
||||||
private boolean checkRoot() {
|
private boolean checkRoot() {
|
||||||
|
|
||||||
if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
if (InstallConfig.getOsType() == OSType.WINDOWS) {
|
||||||
|
|
||||||
// als erstes wird überprüft, ob der Nutzer sich überhaupt in einer Admin-Grupper befindet (zweiter Abschnitt wirft eine unvermeidbare Warnung)
|
// in the first step it will be check if the user is in the admin group (will print an unavoidable warning ...)
|
||||||
// kann nur vermiden werden, wenn der Schlüssel HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs in der Registry eingetragen wurde
|
// only when setting the key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs in the registry no warning would be printed
|
||||||
boolean isAdminGroup = false;
|
boolean isAdminGroup = false;
|
||||||
String groups[] = (new com.sun.security.auth.module.NTSystem()).getGroupIDs();
|
String groups[] = (new com.sun.security.auth.module.NTSystem()).getGroupIDs();
|
||||||
for (String group : groups) {
|
for (String group : groups) {
|
||||||
|
@ -861,8 +941,8 @@ public class Installer {
|
||||||
|
|
||||||
if (!isAdminGroup) return false;
|
if (!isAdminGroup) return false;
|
||||||
|
|
||||||
// Um herauszufinden, ob ein Benutzer das Programm mit Administratorprivelegien gestartet hat, wird versucht, System-Preferences zu schreiben.
|
// to check if the user has started the installer with administrative privileges, a system property will be tried to write
|
||||||
// Falls hierbei ein Fehler auftritt, kann davon ausgegeangen werden, dass der entsprechende Nutzer keine Administratorprivelegien hat / das Programm nicht mit diesen gestartet hat
|
// when an error occurs, the user has no administrative privileges / has the installer not started with these rights
|
||||||
Preferences preferences = systemRoot();
|
Preferences preferences = systemRoot();
|
||||||
synchronized (System.err) {
|
synchronized (System.err) {
|
||||||
setErr(new PrintStream(new OutputStream() {
|
setErr(new PrintStream(new OutputStream() {
|
||||||
|
@ -898,19 +978,22 @@ public class Installer {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
data.log("w", ex, "checkRoot");
|
logger.log("w", ex, "checkRoot");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lädt eine Datei von einem Webserver herunter (mit Basic-Auth support -> config)
|
* Downloads a file from an Webserver (with basic auth support -> set in config)
|
||||||
* @param url die URL
|
*
|
||||||
* @param addVersion ob das Betriebsystem und die Architektur der URL angehängt werden soll -> windows_x64
|
* @param url URL
|
||||||
* @param end das Dateiende (die URL wird in diesem Fall ohne Dateiendung angegeben)
|
* @param addVersion if the architecture and BS should be added to the given URL -> windows_x64 | linux_arm32
|
||||||
* @return Der Pfad der heruntergeladenen Datei (bei Fehler: null + data.error)
|
* @param end the file ending (the URL will be set without an file ending)
|
||||||
|
* @param ascForBasicAuth when no basic auth credentials are given and the request gets a 401 response ask the user for credentials at the command line
|
||||||
|
*
|
||||||
|
* @return the path of the downloaded file (when an error occurred: null + logger.error)
|
||||||
*/
|
*/
|
||||||
private String downloadFile (String url2, boolean addVersion, String end) {
|
private String downloadFile (String url2, boolean addVersion, String end, boolean askForAuth) {
|
||||||
|
|
||||||
String serverURL = conf.downloadURL;
|
String serverURL = conf.downloadURL;
|
||||||
|
|
||||||
|
@ -919,34 +1002,64 @@ public class Installer {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(serverURL);
|
URL url = new URL(serverURL);
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
if (conf.authUsername != null && conf.authPassword != null) {
|
|
||||||
|
// check if basic auth is required
|
||||||
|
if (con.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) {
|
||||||
|
if (conf.authUsername == null || conf.authPassword == null) {
|
||||||
|
if (!askForAuth) { logger.log("e", "Baisc authentication required for downloading the file \"" + serverURL + "\"", ""); error = 40; return null; }
|
||||||
|
|
||||||
|
char[] username = conf.authUsername;
|
||||||
|
char[] password = conf.authPassword;
|
||||||
|
|
||||||
|
System.out.println("\n" + Tr.get("basicAuthRequired"));
|
||||||
|
|
||||||
|
if (System.console() == null) { System.err.println(Tr.get("noConsole")); error = 7; return ""; }
|
||||||
|
if (username == null) {
|
||||||
|
System.out.print(Tr.get("username") + ": ");
|
||||||
|
username = System.console().readLine().strip().toCharArray();
|
||||||
|
}
|
||||||
|
if (password == null) {
|
||||||
|
System.out.print(Tr.get("password") + ": ");
|
||||||
|
password = System.console().readPassword();
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
conf.authUsername = username;
|
||||||
|
conf.authPassword = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add Basic-Auth
|
||||||
String auth = new String(conf.authUsername) + ":" + new String(conf.authPassword);
|
String auth = new String(conf.authUsername) + ":" + new String(conf.authPassword);
|
||||||
byte[] authEncBytes = Base64.getEncoder().encode(auth.getBytes());
|
byte[] authEncBytes = Base64.getEncoder().encode(auth.getBytes());
|
||||||
String authHeaderValue = "Basic " + new String(authEncBytes);
|
String authHeaderValue = "Basic " + new String(authEncBytes);
|
||||||
|
con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestProperty("Authorization", authHeaderValue);
|
con.setRequestProperty("Authorization", authHeaderValue);
|
||||||
con.setRequestProperty("X-Requested-With", "XMLHttpRequest");
|
con.setRequestProperty("X-Requested-With", "XMLHttpRequest");
|
||||||
}
|
}
|
||||||
|
if (con.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) {
|
||||||
|
logger.log("e", "Authentication failed for url \"" + serverURL + "\"", "");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File download = File.createTempFile("Download-Installation", ".jar");
|
File download = File.createTempFile("Download-Installation", ".jar");
|
||||||
|
|
||||||
// für eine Statusanzeige wird zunächst die Dateigröße der Datei ermittelt (wird in Bytes ausgegeben)
|
// for a download status the size of the downloadable file is determined (in Bytes)
|
||||||
double lenght = con.getContentLength();
|
double lenght = con.getContentLength();
|
||||||
if (lenght < 100 * 1024) { throw new Exception ("Probably not a file (lenght to short)"); }
|
if (lenght < 100 * 1024) { throw new Exception ("Probably not a file (lenght to short)"); }
|
||||||
// diese wird nun in Megabyte angegeben, sowie auf 2 Stellen nach dem Komma (Es wird die bereits heruntergeladene Dateigröße im "Binärformat" angegeben
|
// round to megabytes and two decimal points
|
||||||
lenght = Math.round(lenght / 1048576 * 100) / 100.0;
|
lenght = Math.round(lenght / 1048576 * 100) / 100.0;
|
||||||
|
|
||||||
// es muss nun parallel die bereits heruntergeladene Dateigröße ermittelt werden
|
// in parallel the already downloaded file size has to be determined
|
||||||
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
double lenghtTmp = lenght;
|
double lenghtTmp = lenght;
|
||||||
Future future = scheduler.scheduleWithFixedDelay(() -> {
|
Future<?> future = scheduler.scheduleWithFixedDelay(() -> {
|
||||||
double actualLenghtOfFile = download.length();
|
double actualLenghtOfFile = download.length();
|
||||||
actualLenghtOfFile = Math.round(actualLenghtOfFile / 1048576 * 100) / 100.0;
|
actualLenghtOfFile = Math.round(actualLenghtOfFile / 1048576 * 100) / 100.0;
|
||||||
|
|
||||||
double percent = Math.round(actualLenghtOfFile / lenghtTmp * 10000) / 100.0;
|
double percent = Math.round(actualLenghtOfFile / lenghtTmp * 10000) / 100.0;
|
||||||
// add leading zeros
|
// add leading zeros
|
||||||
DecimalFormat f = new DecimalFormat("0.00");
|
DecimalFormat f = new DecimalFormat("0.00");
|
||||||
System.out.print("\rDownloading file: " + f.format(percent) + "% (" + f.format(actualLenghtOfFile) + " MB / " + lenghtTmp + " MB)");
|
System.out.print("\r" + Tr.get("installation_download") + ": " + f.format(percent) + "% (" + f.format(actualLenghtOfFile) + " MB / " + lenghtTmp + " MB)");
|
||||||
;
|
;
|
||||||
}, 200, 450, TimeUnit.MILLISECONDS);
|
}, 200, 450, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
|
@ -960,14 +1073,14 @@ public class Installer {
|
||||||
return download.getAbsolutePath();
|
return download.getAbsolutePath();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("fehler");
|
System.out.println(Tr.get("failed"));
|
||||||
System.out.println("\nA error occured while downloading the file.\nPlease check your internet connection and try again later (URL: " + serverURL + ")");
|
System.err.println("\n" + Tr.get("installation_download_failed", serverURL));
|
||||||
error = -20;
|
error = 20;
|
||||||
data.log("e", ex, "downloadFile");
|
logger.log("e", ex, "downloadFile");
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("The determined URL was not found" + "(URL: " + serverURL + ")");
|
System.err.println(Tr.get("installation_download_urlNotFound", serverURL));
|
||||||
error = -21;
|
error = 21;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -975,35 +1088,38 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt die zu herunterladende Version des Programms aus
|
* Return the version of the program to download
|
||||||
* @return den entsprechenden Dateinamen (z.B. windows_x64, linux_arm64)
|
*
|
||||||
|
* @return filename how "windows_x64" or "linux_arm32"
|
||||||
*/
|
*/
|
||||||
protected String getVersionOfProgramm() {
|
protected String getVersionOfProgramm() {
|
||||||
|
|
||||||
String rtc = "";
|
String rtc = "";
|
||||||
|
|
||||||
// Verwendetes Betriebssystem ermitteln //
|
// operating system //
|
||||||
if (InstallConfig.getOsType() == OSType.WINDOWS) rtc += "windows";
|
if (InstallConfig.getOsType() == OSType.WINDOWS) rtc += "windows";
|
||||||
else if (InstallConfig.getOsType() == OSType.LINUX) rtc += "linux";
|
else if (InstallConfig.getOsType() == OSType.LINUX) rtc += "linux";
|
||||||
else if (InstallConfig.getOsType() == OSType.MACOS) rtc += "mac";
|
else if (InstallConfig.getOsType() == OSType.MACOS) rtc += "mac";
|
||||||
else {
|
else {
|
||||||
System.out.println("Bettriebssystem konnte nicht ermittelt werden: " + System.getProperty("os.name"));
|
error = 6;
|
||||||
System.exit(-1);
|
System.err.println(Tr.get("installation_os_not_supported", System.getProperty("os.name")));
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc += "_";
|
rtc += "_";
|
||||||
|
|
||||||
// Architektur der CPU ermitteln //
|
// architecture of the CPU //
|
||||||
String aarch = System.getProperty("os.arch").toLowerCase();
|
String aarch = System.getProperty("os.arch").toLowerCase();
|
||||||
if (aarch.contains("amd64")) rtc += "x64";
|
if (aarch.contains("amd64")) rtc += "x64";
|
||||||
else if (aarch.equals("x86")) rtc += "x86";
|
else if (aarch.equals("x86")) rtc += "x86";
|
||||||
else if (aarch.equals("arm64") || aarch.equals("aarch64")) rtc += "arm64";
|
else if (aarch.equals("arm64") || aarch.equals("aarch64")) rtc += "arm64";
|
||||||
else if (aarch.equals("arm")) rtc += "arm32";
|
else if (aarch.equals("arm")) rtc += "arm32";
|
||||||
//fals nichts zutrifft, aber Prozessor mit 64 endet, wird amd64 erwartet
|
// if no architecture matched, but ending with "64", expect amd64
|
||||||
else if (aarch.endsWith("64")) rtc += "x64";
|
else if (aarch.endsWith("64")) rtc += "x64";
|
||||||
else {
|
else {
|
||||||
System.out.println("CPU architecture could not been determined: " + aarch);
|
error = 6;
|
||||||
System.exit(-2);
|
System.err.println(Tr.get("installation_arch_not_supported", aarch));
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return rtc;
|
return rtc;
|
||||||
|
@ -1024,7 +1140,7 @@ public class Installer {
|
||||||
batchFile += "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\" /v \"" + entry.getKey() + " (TrueType)\" /t REG_SZ /d \"" + path + entry.getKey() + ".ttf\" /f \n";
|
batchFile += "reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\" /v \"" + entry.getKey() + " (TrueType)\" /t REG_SZ /d \"" + path + entry.getKey() + ".ttf\" /f \n";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// es wird die Batch-Datei erstellt, und anschließend ausgeführt
|
// create the batch file and make it executable
|
||||||
File batchMakeRegeditEntry = File.createTempFile("installApplication", ".bat");
|
File batchMakeRegeditEntry = File.createTempFile("installApplication", ".bat");
|
||||||
|
|
||||||
FileWriter fwFile = new FileWriter(batchMakeRegeditEntry);
|
FileWriter fwFile = new FileWriter(batchMakeRegeditEntry);
|
||||||
|
@ -1035,11 +1151,11 @@ public class Installer {
|
||||||
pwFile.close();
|
pwFile.close();
|
||||||
|
|
||||||
Process p = new ProcessBuilder("cmd.exe", "/C", batchMakeRegeditEntry.getAbsolutePath()).start();
|
Process p = new ProcessBuilder("cmd.exe", "/C", batchMakeRegeditEntry.getAbsolutePath()).start();
|
||||||
if (!p.waitFor(10, TimeUnit.SECONDS)) data.log("w", "Batch File which adds Registry Keys for uninstallation not fully executed (timeout)", "registerApplication");
|
if (!p.waitFor(10, TimeUnit.SECONDS)) logger.log("w", "Batch File which adds Registry Keys for uninstallation not fully executed (timeout)", "registerApplication");
|
||||||
} catch (Exception ex) { data.log("e", ex, "installFonts"); }
|
} catch (Exception ex) { logger.log("e", ex, "installFonts"); }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
data.log("w", "Can't install fonts without admin privilegies in Windows -> skipping. You should mind a reinstall with Admin-Privelegis", "installFonts");
|
logger.log("w", "Can't install fonts without admin privilegies in Windows -> skipping. You should mind a reinstall with Admin-Privelegis", "installFonts");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (InstallConfig.getOsType() == OSType.LINUX) {
|
} else if (InstallConfig.getOsType() == OSType.LINUX) {
|
||||||
|
@ -1048,7 +1164,7 @@ public class Installer {
|
||||||
if (this.checkRoot()) path = "/usr/share/fonts/truetype/";
|
if (this.checkRoot()) path = "/usr/share/fonts/truetype/";
|
||||||
else path = System.getProperty("user.home") + "/.local/share/fonts/";
|
else path = System.getProperty("user.home") + "/.local/share/fonts/";
|
||||||
|
|
||||||
// Verzeichnis erstellen, falls noch nicht vorhanden
|
// create directories when not present
|
||||||
new File(path).mkdirs();
|
new File(path).mkdirs();
|
||||||
|
|
||||||
final String path_ = path;
|
final String path_ = path;
|
||||||
|
@ -1057,7 +1173,7 @@ public class Installer {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Berechtigungen korrekt setzen -> Ordner: 0755 | Dateien: 0644
|
// Set permissions -> Folders: 0755 | Files: 0644
|
||||||
Process p;
|
Process p;
|
||||||
|
|
||||||
p = new ProcessBuilder("bash", "-c", "chmod -R 0644" + path + "*").start();
|
p = new ProcessBuilder("bash", "-c", "chmod -R 0644" + path + "*").start();
|
||||||
|
@ -1074,7 +1190,21 @@ public class Installer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the installation was successful (0 = successful, {@literal <}0 = error)
|
* This function will finish the installation by executing commands
|
||||||
|
* that are only needed in edge cases.
|
||||||
|
*/
|
||||||
|
private void finishInstallation() {
|
||||||
|
if (InstallConfig.getOsType() == OSType.LINUX && !conf.getIsPortable()) {
|
||||||
|
try {
|
||||||
|
// Try to start a previously installed service again that was stopped during installation
|
||||||
|
Process p = new ProcessBuilder("bash", "-c", "systemctl start \"" + conf.getApplicationNameShort() + ".service" + "\"").start();
|
||||||
|
p.waitFor(5, TimeUnit.SECONDS);
|
||||||
|
} catch (Exception ex) { /* Not required */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the installation was successful (0 = successful, {@literal >}0 = error)
|
||||||
*
|
*
|
||||||
* @return the error code
|
* @return the error code
|
||||||
*/
|
*/
|
|
@ -1,14 +1,13 @@
|
||||||
package tk.rpjosh.installer;
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
class Data {
|
public class Logger {
|
||||||
|
|
||||||
private InstallConfig conf;
|
private boolean debug = true;
|
||||||
|
|
||||||
Data(InstallConfig conf) {
|
public Logger() {
|
||||||
this.conf = conf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,29 +23,17 @@ class Data {
|
||||||
|
|
||||||
String commandLine = "";
|
String commandLine = "";
|
||||||
// if the debug mode isn't enabled print only the first line of the message (without the location)
|
// if the debug mode isn't enabled print only the first line of the message (without the location)
|
||||||
if (true) commandLine = anz + " - " + location;
|
if (debug) commandLine = anz + " - " + location;
|
||||||
else commandLine = anzSimple;
|
else commandLine = anzSimple;
|
||||||
|
|
||||||
|
|
||||||
if (v.equals("d")) {
|
if (v.equals("d")) System.out.println("[D] " + commandLine);
|
||||||
//logger.debug(anz); loggerSimple.debug(anzSimple);
|
|
||||||
System.out.println("[D] " + commandLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.equals("i")) {
|
if (v.equals("i")) System.out.println("[I] " + commandLine);
|
||||||
//logger.info(anz); loggerSimple.info(anzSimple);
|
|
||||||
System.out.println("[I] " + commandLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.equals("w")) {
|
if (v.equals("w")) System.out.println("[W] " + commandLine);
|
||||||
//logger.warn(anz); loggerSimple.warn(anzSimple);
|
|
||||||
System.out.println("[W] " + commandLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v.equals("e")) {
|
if (v.equals("e")) System.err.println("[E] " + commandLine);
|
||||||
//logger.error(anz); loggerSimple.error(anzSimple);
|
|
||||||
System.out.println("[E] " + commandLine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,4 +50,5 @@ class Data {
|
||||||
ex.printStackTrace(pw);
|
ex.printStackTrace(pw);
|
||||||
log("e", sw.toString(), location);
|
log("e", sw.toString(), location);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,225 @@
|
||||||
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.CodeSource;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
|
||||||
|
public class RunInConsole {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the program inside a console if not already run inside a console window
|
||||||
|
*
|
||||||
|
* @param keepOpen the console will stay opened after the program was closed
|
||||||
|
*/
|
||||||
|
public static void start(boolean keepOpen) {
|
||||||
|
start (keepOpen, null, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the program inside a console if not already run inside a console window
|
||||||
|
*
|
||||||
|
* @param args the command line options for the main method when calling the program inside the console again
|
||||||
|
* @param keepOpen the console will stay opened after the program finishes
|
||||||
|
*/
|
||||||
|
public static void start(String[] args, boolean keepOpen) {
|
||||||
|
start(keepOpen, args, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the program inside a console if not already run inside a console window
|
||||||
|
*
|
||||||
|
* @param args the command line options for the main method when calling the program inside the console again
|
||||||
|
* @param keepOpen the console will stay opened after the program finishes
|
||||||
|
* @param forceRestart even restart the program when already running inside a console
|
||||||
|
* @param asAdmin start the console with administrator privileges (on Windows Powershell is required)
|
||||||
|
*/
|
||||||
|
public static void start(String[] args, boolean keepOpen, boolean forceRestart, boolean asAdmin) {
|
||||||
|
start(keepOpen, args, forceRestart, asAdmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void start(boolean keepOpen, final String[] args, boolean forceRestart, boolean asAdmin) {
|
||||||
|
|
||||||
|
String executableName = getExecutableName();
|
||||||
|
|
||||||
|
// Probably executed inside an IDE
|
||||||
|
if (executableName == null) return;
|
||||||
|
// Application is already executed within a console
|
||||||
|
if (System.console() != null && !forceRestart) return;
|
||||||
|
|
||||||
|
startExecutableInConsole(executableName, keepOpen, asAdmin, args);
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a console window and starts the provided jar file.
|
||||||
|
* The executable name is NOT escaped because it shouldn't be critical. Make sure to provide a valid name.
|
||||||
|
*
|
||||||
|
* @param executableName the name of the jar file (without the path -> relative)
|
||||||
|
* @param stayOpenAfterEnd keep the console windows opened after the run of the jar file
|
||||||
|
* @param asAdmin start the console with administrator privileges (for Windows a Poowershell is required)
|
||||||
|
*/
|
||||||
|
private static void startExecutableInConsole(String executableName, final boolean keepOpen, final boolean asAdmin, String[] args) {
|
||||||
|
|
||||||
|
String command = null;
|
||||||
|
|
||||||
|
// determine the parameters
|
||||||
|
String strArgs = "";
|
||||||
|
for (String currentArg: args) {
|
||||||
|
strArgs += "\"" + currentArg + "\" ";
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (InstallConfig.getOsType()) {
|
||||||
|
case UNDETERMINED: break;
|
||||||
|
case WINDOWS:
|
||||||
|
if (!asAdmin) {
|
||||||
|
if (keepOpen) command = "cmd /c start cmd /k java -jar \"" + executableName + "\" " + strArgs;
|
||||||
|
else command = "cmd /c start java -jar \"" + executableName +"\" " + strArgs;
|
||||||
|
} else {
|
||||||
|
// Because the administrative terminal is opened in 'C:/Windows/System32',
|
||||||
|
// we need to query the absolute path of the JAR file before starting it
|
||||||
|
executableName = new File(executableName).getAbsolutePath();
|
||||||
|
|
||||||
|
if (keepOpen) command = "powershell \"Start-Process cmd -Verb RunAs -ArgumentList '/C', 'start cmd /k java -jar \" " + executableName + "\" " + strArgs + "'";
|
||||||
|
else command = "powershell \"Start-Process cmd -Verb RunAs -ArgumentList '/C', 'java -jar \"" + executableName + "\" " + strArgs + "'";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LINUX:
|
||||||
|
|
||||||
|
executableName = new File(executableName).getAbsolutePath();
|
||||||
|
String terminal = null;
|
||||||
|
String terminalCommand = null;
|
||||||
|
|
||||||
|
// Find a installed terminal that we can use to opened up a new terminal
|
||||||
|
try {
|
||||||
|
String[][] terminals = {
|
||||||
|
{ "gnome-terminal", "--"}, {"xterm", "-e"}, {"xfce4-terminal", "-e"}, {"tilix", "-e"}, {"konsole", "-e"}, {"terminal", "-e"},
|
||||||
|
{ "wezterm", "start -e" }, { "alacritty", "-e" }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Find the first available terminal
|
||||||
|
for (String currentTerminal[]: terminals) {
|
||||||
|
if (isCommandAvailable(currentTerminal[0])) {
|
||||||
|
terminal = currentTerminal[0]; terminalCommand = currentTerminal[1]; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (terminal == null) break;
|
||||||
|
|
||||||
|
if (!asAdmin) {
|
||||||
|
if (keepOpen) new ProcessBuilder("sh", "-c", terminal + " " + terminalCommand + " /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "; exec sh'").start();
|
||||||
|
else new ProcessBuilder("sh", "-c", terminal + " " + terminalCommand + " /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "'").start();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (isCommandAvailable("pkexec")) {
|
||||||
|
// A polkit daemon is available on the system. We use it to authenticate the installer as root
|
||||||
|
Process proc = new ProcessBuilder(
|
||||||
|
"pkexec", "--user", "root",
|
||||||
|
// By default, the command started by pkexec will run in a minimal and safe environment. This does NOT include the $DISPLAY variable by default.
|
||||||
|
// Because the most terminal needs this (and the XAUTHORITY), we use the env command
|
||||||
|
"env", "DISPLAY=" + System.getenv("DISPLAY"), "XAUTHORITY=" + System.getenv("XAUTHORITY"), "HOME=" + System.getenv("HOME"),
|
||||||
|
"/bin/sh", "-c",
|
||||||
|
terminal + " " + terminalCommand + " /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs
|
||||||
|
+ (keepOpen ? "; exec sh'" : ";")
|
||||||
|
).inheritIO().start();
|
||||||
|
|
||||||
|
// The polkit process runs in foreground. So we need to wait until the installation process finished
|
||||||
|
synchronized(proc) {
|
||||||
|
proc.wait();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (keepOpen) new ProcessBuilder("sh", "-c", terminal + " " + terminalCommand + " sudo /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "; exec sh'").start();
|
||||||
|
else new ProcessBuilder("sh", "-c", terminal + " " + terminalCommand + " sudo /bin/sh -c 'java -jar \"" + executableName + "\" " + strArgs + "'").start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} catch (Exception ex) { ex.printStackTrace(); }
|
||||||
|
break;
|
||||||
|
case MACOS: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (command != null) Runtime.getRuntime().exec(command);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queries if the provided command or application is available on this system.
|
||||||
|
*
|
||||||
|
* @param command Command to check
|
||||||
|
*
|
||||||
|
* @return Weather the command is available or not
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
private static boolean isCommandAvailable(String command) throws IOException, InterruptedException {
|
||||||
|
Process p = new ProcessBuilder("sh", "-c", "which " + command).start();
|
||||||
|
p.waitFor(2000, TimeUnit.SECONDS);
|
||||||
|
String output = "";
|
||||||
|
BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
|
output = buf.readLine();
|
||||||
|
|
||||||
|
return output != null && !output.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the jar file <i> (MyInstaller.jar) </i>
|
||||||
|
*/
|
||||||
|
public static String getExecutableName() {
|
||||||
|
|
||||||
|
String executableNameFromClass = null;
|
||||||
|
|
||||||
|
final CodeSource codeSource = RunInConsole.class.getProtectionDomain().getCodeSource();
|
||||||
|
if (codeSource == null) {
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
|
String path = codeSource.getLocation().getPath();
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
|
executableNameFromClass = new File(path).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String nameFromJavaClassPath = System.getProperty("java.class.path");
|
||||||
|
String nameFromSunProperty = System.getProperty("sun.java.command");
|
||||||
|
|
||||||
|
if (isJarFile(executableNameFromClass)) return executableNameFromClass;
|
||||||
|
|
||||||
|
if (isJarFile(nameFromJavaClassPath)) return nameFromJavaClassPath;
|
||||||
|
|
||||||
|
if (isJarFile(nameFromSunProperty)) return nameFromSunProperty;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given file path is valid and if its a jar file
|
||||||
|
*
|
||||||
|
* @param the name of the jar file
|
||||||
|
* @return the file path is valid and a jar file
|
||||||
|
*/
|
||||||
|
private static boolean isJarFile(final String name) {
|
||||||
|
|
||||||
|
if (name == null || !name.toLowerCase().endsWith(".jar")) return false;
|
||||||
|
|
||||||
|
// checks if file exists
|
||||||
|
final File file = new File(name);
|
||||||
|
return file.exists() && file.isFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A static class for the main translations
|
||||||
|
*/
|
||||||
|
public class Tr {
|
||||||
|
|
||||||
|
public final static TranslationService translationService = new TranslationService("translation.de-rpjosh-installer");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link de.rpjosh.installer.TranslationService#get(String, String...)}
|
||||||
|
*/
|
||||||
|
public static String get(String property, String... replaceStrings) {
|
||||||
|
return translationService.get(property, replaceStrings);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
package de.rpjosh.installer;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class providing translation support of properties
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TranslationService {
|
||||||
|
|
||||||
|
private String resourceFile;
|
||||||
|
|
||||||
|
public enum Language {
|
||||||
|
|
||||||
|
GERMAN (new Locale("de", "DE")),
|
||||||
|
ENGLISH(new Locale("en", "US"));
|
||||||
|
|
||||||
|
public final Locale locale;
|
||||||
|
|
||||||
|
Language(Locale locale) {
|
||||||
|
this.locale = locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Logger logger = new Logger();
|
||||||
|
private ResourceBundle bundle;
|
||||||
|
private ResourceBundle defaultBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance for translating support
|
||||||
|
*
|
||||||
|
* @param resourceFile the property file to use for the translations. For example translation.de.rpjosh.installer
|
||||||
|
*/
|
||||||
|
public TranslationService(String resourceFile) {
|
||||||
|
this.resourceFile = resourceFile;
|
||||||
|
|
||||||
|
this.defaultBundle = ResourceBundle.getBundle(resourceFile, Locale.ENGLISH);
|
||||||
|
|
||||||
|
Locale osLocale = Locale.getDefault();
|
||||||
|
List<Locale> supportedLanguages = (List<Locale>) Arrays.asList(
|
||||||
|
new Locale[] { Language.GERMAN.locale, Language.ENGLISH.locale }
|
||||||
|
);
|
||||||
|
if (supportedLanguages.contains(osLocale)) this.bundle = ResourceBundle.getBundle(resourceFile, osLocale);
|
||||||
|
else this.bundle = defaultBundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance for translating and forces the use of a specific language for the translations
|
||||||
|
* (defaulting to the language the operation system provides)
|
||||||
|
*
|
||||||
|
* @param resourceFile property file to use for the translations. For example translation.de.rpjosh.installer
|
||||||
|
* @param language language to force
|
||||||
|
*/
|
||||||
|
public TranslationService(String resourceFile, Language language) {
|
||||||
|
this.resourceFile = resourceFile;
|
||||||
|
|
||||||
|
this.defaultBundle = ResourceBundle.getBundle(resourceFile, Locale.ENGLISH);
|
||||||
|
this.bundle = ResourceBundle.getBundle(resourceFile, language.locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force the use of a specific language for the translations (defaulting to
|
||||||
|
* the language the operation system provides)
|
||||||
|
*
|
||||||
|
* @param language language to force
|
||||||
|
*/
|
||||||
|
public void setLanguage(Language language) {
|
||||||
|
this.bundle = ResourceBundle.getBundle(resourceFile, language.locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the translated value of the property
|
||||||
|
*
|
||||||
|
* @param property property to translate
|
||||||
|
* @param replaceStrings strings for replacing {0}, {1}, ... inside the property values starting by zero counting one by one
|
||||||
|
*
|
||||||
|
* @return translated string for the property
|
||||||
|
*/
|
||||||
|
public String get(String property, String... replaceStrings) {
|
||||||
|
try {
|
||||||
|
return replaceValues(property, bundle.getString(property), replaceStrings);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.log("d", "Cannot find property: \"" + property + "\" for language \"" + bundle.getLocale().getLanguage() + "\" in property file \"" + resourceFile + "\"", "Translations#get");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return replaceValues(property, defaultBundle.getString(property), replaceStrings);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.log("e", "Cannot find property: \"" + property + "\" in default translation list from property file \"" + resourceFile + "\"", "Translations#get");
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String replaceValues(String property, String value, String... replaceStrings) {
|
||||||
|
if (replaceStrings.length == 0) return value;
|
||||||
|
|
||||||
|
for (int i = 0; i < replaceStrings.length; i++) {
|
||||||
|
if (value.contains("{" + i + "}")) {
|
||||||
|
value = value.replace("{" + i + "}", replaceStrings[i]);
|
||||||
|
} else {
|
||||||
|
logger.log("d", "No value matches for " + "{" + i + "}" + "in the property \"" + property + "\n: " + value, "Translations#replaceValue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
root_rights_required=\
|
||||||
|
F<EFBFBD>r die Installation dieses Programmes werden Administrator / Root Rechte ben<65>tigt.\n\n\
|
||||||
|
Falls du diese Rechte nicht hast, kann das Programm auch portable oder nur f<>r den aktuell angemeldeten Benutzer installiert werden.\n\
|
||||||
|
F<EFBFBD>r eine weitere Hilfe f<>hre dieses Programm mit dem Parameter "--help" aus.
|
||||||
|
root_askForRestart=M<EFBFBD>chtest du den Installationsprozess mit Administratorrechten neustarten (Y/N)?
|
||||||
|
|
||||||
|
userInstallation_notAvailable=Eine Benutzerinstallation ist nur unter Windows verf<72>gbar
|
||||||
|
|
||||||
|
installation_start=Die Installation von {0} wird gestartet (Version {1})
|
||||||
|
installation_architekture=Ermittle Architektur und Betriebssystem
|
||||||
|
|
||||||
|
installation_download=Lade Datei herunter
|
||||||
|
installation_download_success=Lade Datei herunter: erfolgreich heruntergeladen
|
||||||
|
installation_download_invalid=Die angegebene Datei ist ung<6E>ltig!
|
||||||
|
installation_download_failed=Ein Fehler trat beim herunterladen der Datei auf.\nBitte <20>berpr<70>fe deine Internetverbindung und versuche es sp<73>ter erneut(URL: {0})
|
||||||
|
installation_download_urlNotFound=Die ermittelte URL konnte nicht gefunden werden (URL: {0});
|
||||||
|
|
||||||
|
installation_portable_start=Das Programm wird portable installiert in: "{0}"
|
||||||
|
installation_portable_createDirectory=Verzeichnis existiert nicht. Erstelle Verzeichnis
|
||||||
|
|
||||||
|
installation_copyJar=Kopiere jar Datei
|
||||||
|
installation_createFiles=Erstelle ben<65>tigte Dateien
|
||||||
|
installation_createFilesFailed=Erstellung der Dateien ist fehlgeschlagen
|
||||||
|
installation_executeOtherCommands=F<EFBFBD>hre weitere Befehle aus
|
||||||
|
installation_executionSuccessful=Die Installation wurde erfolgreich abgeschlossen
|
||||||
|
|
||||||
|
installation_os_not_supported=Nicht unterst<73>tztes Betriebssystem: "{0}"
|
||||||
|
installation_arch_not_supported=Nicht unterst<73>tzte Architektur des Prozessors: "{0}"
|
||||||
|
|
||||||
|
notAuthorized=Keine Berechtigung
|
||||||
|
created=erstellt
|
||||||
|
failed=fehlgeschlagen
|
||||||
|
errorMessage=Fehlermeldung
|
||||||
|
successful=erfolgreich
|
||||||
|
|
||||||
|
basicAuthRequired=Zum herunterladen des Programms ist eine Authentifizierung erforderlich (HTTP-Code 401)
|
||||||
|
username=Benutzername
|
||||||
|
password=Passwort
|
|
@ -0,0 +1,38 @@
|
||||||
|
root_rights_required=\
|
||||||
|
Administrator / root rights are required to install this program.\n\n\
|
||||||
|
If you don't have these you can try to install the program portable or only for the currently logged-in user [Windows].\n\
|
||||||
|
For further help, run the Installer via the command line with the parameter "--help".
|
||||||
|
root_askForRestart=Would you like to try a restart of the program with root privileges (Y/N)?
|
||||||
|
|
||||||
|
userInstallation_notAvailable=A user installation is only available for windows
|
||||||
|
|
||||||
|
installation_start=Starting the installation of {0} (version {1})
|
||||||
|
installation_architekture=Determine architecture and operating system
|
||||||
|
|
||||||
|
installation_download=Downloading file
|
||||||
|
installation_download_success=Downloading file: successfully downloaded
|
||||||
|
installation_download_invalid=The provided file is invalid!
|
||||||
|
installation_download_failed=An error occurred while downloading the file.\nPlease check your Internet connection and try again later (URL: {0})
|
||||||
|
installation_download_urlNotFound=The determined URL was not found (URL: {0});
|
||||||
|
|
||||||
|
installation_portable_start=Program will be installed in the directory: "{0}"
|
||||||
|
installation_portable_createDirectory=Directory does not exist. Creating directory
|
||||||
|
|
||||||
|
installation_copyJar=Copy jar file
|
||||||
|
installation_createFiles=Creating required files
|
||||||
|
installation_createFilesFailed=Creation of the files failed
|
||||||
|
installation_executeOtherCommands=Execute other commands
|
||||||
|
installation_executionSuccessful=Installation was completed successfully
|
||||||
|
|
||||||
|
installation_os_not_supported=Operating system is not supported: "{0}"
|
||||||
|
installation_arch_not_supported=Architecture of CPU is not supported: "{0}"
|
||||||
|
|
||||||
|
notAuthorized=No authorization
|
||||||
|
created=created
|
||||||
|
failed=failed
|
||||||
|
errorMessage=Error Message
|
||||||
|
successful=successful
|
||||||
|
|
||||||
|
basicAuthRequired=Authentication is required to download the program (HTTP code 401)
|
||||||
|
username=Username
|
||||||
|
password=Password
|
Loading…
Reference in New Issue