Skip to content

Commit

Permalink
devonfw#919: improve license agreement and prevent license agreement …
Browse files Browse the repository at this point in the history
…being asked when opening a new shell
  • Loading branch information
hohwille committed Jan 17, 2025
1 parent c0d4281 commit 3dafcc7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
public abstract class AbstractIdeContext implements IdeContext {

private static final GitUrl IDE_URLS_GIT = new GitUrl("https://github.com/devonfw/ide-urls.git", null);

private static final String LICENSE_URL = "https://github.com/devonfw/IDEasy/blob/main/documentation/LICENSE.adoc";

private final IdeStartContextImpl startContext;
Expand Down Expand Up @@ -894,14 +894,11 @@ private ValidationResult applyAndRun(CliArguments arguments, Commandlet cmd) {

private void ensureLicenseAgreement() {

if ((this.ideRoot == null) || isTest()) {
return; // error: IDE_ROOT undefined
}
Path ideBase = this.ideRoot.resolve(FOLDER_IDE);
if (!Files.isDirectory(ideBase)) {
return; // error: $IDE_ROOT/_ide does not exist, broken installation
if (isTest()) {
return; // ignore for tests
}
Path licenseAgreement = ideBase.resolve(FILE_LICENSE_AGREEMENT);
getFileAccess().mkdirs(this.userHomeIde);
Path licenseAgreement = this.userHomeIde.resolve(FILE_LICENSE_AGREEMENT);
if (Files.isRegularFile(licenseAgreement)) {
return; // success, license already accepted
}
Expand All @@ -915,18 +912,20 @@ private void ensureLicenseAgreement() {
}
StringBuilder sb = new StringBuilder(1180);
sb.append(LOGO).append("""
Welcome to IDEasy!
This product (with its included 3rd party components) is open-source software and can be used free (also commercially).
It supports automatic download and installation of arbitrary 3rd party tools.
By default only open-source 3rd party tools are used (downloaded, installed, executed).
But if explicitly configured, also commercial software that requires an additional license may be used.
This happens e.g. if you configure "ultimate" edition of IntelliJ or "docker" edition of Docker (Docker Desktop).
You are solely responsible for all risk implied by using this software.
Before using IDEasy you need to read and accept the license agreement with all involved licenses.
You will be able to find it online under the following URL:
""").append(LICENSE_URL)
.append("\n\nAlso it is included in the documentation that you can find here:\n").
append(ideBase.resolve("IDEasy.pdf").toString()).append("\n");
Welcome to IDEasy!
This product (with its included 3rd party components) is open-source software and can be used free (also commercially).
It supports automatic download and installation of arbitrary 3rd party tools.
By default only open-source 3rd party tools are used (downloaded, installed, executed).
But if explicitly configured, also commercial software that requires an additional license may be used.
This happens e.g. if you configure "ultimate" edition of IntelliJ or "docker" edition of Docker (Docker Desktop).
You are solely responsible for all risk implied by using this software.
Before using IDEasy you need to read and accept the license agreement with all involved licenses.
You will be able to find it online under the following URL:
""").append(LICENSE_URL);
if (this.ideRoot != null) {
sb.append("\n\nAlso it is included in the documentation that you can find here:\n").
append(this.ideRoot.resolve(FOLDER_IDE).resolve("IDEasy.pdf").toString()).append("\n");
}
info(sb.toString());
askToContinue("Do you accept these terms of use and all license agreements?");

Expand Down
21 changes: 11 additions & 10 deletions cli/src/main/package/setup
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#!/bin/bash

function createFile() {
local fileName=$1
touch "$fileName"
echo "Created ${fileName}"
}

function createFileIfNotExists() {
local fileName=$1
if [ ! -f "${fileName}" ]; then
createFile "$fileName"
local file=$1
if [ ! -f "${file}" ]; then
touch "$file"
echo "Created ${file}"
fi
}

Expand All @@ -35,8 +30,14 @@ if [ "${PWD/*\//}" != "_ide" ]; then
fi
echo "Setting up IDEasy in ${PWD}"
cd ..
if [ "${PWD/*\//}" != "projects" ]; then
echo -e "\033[93mYour IDE_ROOT folder is $PWD - you need to rename ${PWD/*\//} to 'projects'.\033[39m" >&2
exit 1
fi
export IDE_ROOT=${PWD}
source "$IDE_ROOT/_ide/functions"
source "$IDE_ROOT/_ide/functions" || exit 255
# enforce license agreement
ide -v || exit 255

doSetupInConfigFile ~/.bashrc
doSetupInConfigFile ~/.zshrc
Expand Down

0 comments on commit 3dafcc7

Please sign in to comment.