Override postinst scriptlet to not start service and register it - sbt

I'm using SBT native packager 1.2.0-M3 for packaging a Play Framework 2.5.3 application as an RPM (targeted for RHEL 7 with systemd). I would like to change the behavior of the generated RPM such that it does NOT automatically start after install but is being enabled (systemctl enable <name>.service).
I've been following the instructions outlined at http://www.scala-sbt.org/sbt-native-packager/archetypes/java_server/customize.html. Specifically, I created a file src/rpm/scriptlets/post-rpm containing a single line systemctl enable <name>.service. As far as I understand the documentation, that's all that is required. However, on installation of the RPM the service gets still automatically started. Is there any additional configuration required?

This is currently the default behaviour. There is a historical explanation here.
What you actually need to do are the maintainerScripts in Rpm.
There is a helper trait which lightens the build definition. Something like
import RpmConstants._
maintainerScripts in Rpm := {
(maintainerScripts in Rpm).value += (
Post -> "systemctl enable <name>.service"
)
}
And there is a feature request to implement this in native-packager directly.

Related

java.lang.module.FindException: Module test not foundIntellidea

I am have this Exception please help me!
"Error occurred during initialization of boot layer
java.lang.module.Find Exception: Module test not found"
But i write VM option "--module-path "D:\UT java\javafx-sdk-17.0.1\lib" --add-modules javafx.controls,javafx.fxml"
and i have module-info.java "
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
requires java.sql;
requires java.desktop;
requires jdk.jfr;"
i add my sdk. And if i create javafx demo project and execute him it work. and if i start change fxml file and change controller i have this exception.
I have IntellIJIdea 2021, javafx-sdk-17.0.1, jdbc jr 8,11,16
Steps to fix:
Delete the JavaFX sdk (you don’t need it).
Delete old Java versions (they are obsolete).
Update your IntelliJ IDE and IDE plugins to the most recent release, 2021.3.2+.
Create a new JavaFX project using JDK and JavaFX 17.0.2+.
Select Maven for the build system unless you know and prefer Gradle.
Do not set VM arguments, you don’t need them.
Adding modules via the --add-modules VM arguments is unnecessary when you have a valid module-info.java file.
The --module-path is still required so that the modules can be found, but Idea will provide the correct path for your modules automatically when it recognizes the modules through your Maven dependencies.
So you don't need to explicitly define the --module-path VM argument yourself for a Maven based build (that would be difficult to do anyway because the modules are all downloaded to different directories in your local maven repository).
Test it works following the Idea create new JavaFX project execution instructions.
Add additional modules one at a time by adding their maven dependency to pom.xml and the requires clause to module-info.java.
Ensure you synchronize the Maven and Idea projects between each
addition.
See, for example, this question on correctly adding the javafx.media module.
Adding other modules such as javafx.web, javafx.fxml or javafx.swing follows a similar pattern.
Test between each addition by building and running the project, to ensure you haven’t broken anything.
Copy your original source code into the appropriate package directories under the new project source directory:
src/main/java
Place resources in:
src/main/resources
following the Eden resource location guide.
Fix any errors, ensure everything compiles and runs, then test it.

How to create new content types using Drush commands in Drupal 8

I know the export and import option is available but I have 5 environments, So each and every time after implementing new things on dev env I don't want to do export and import on other envs instead using pipeline I will execute the drush commands to implement the required changes on other envs by executing required Drush commands.
The problem is that on Drupal the config import/export is the best way to do that.
The config export doesn't not only export content type configuration, but the entire website configuration.
So thoses commands help you be iso between environments.
If your probleme is about ouverriding some config values between environments, the module Config Split can help you on it.
With no config import, I would solve it with installing a module of your own, which runs your special code.
Steps:
Create a module my_custom_contenttype
Make a hook_install() (my_custom_contenttype_install())
Run this drush command (uninstall before, if you want to install it again - do it more than one time):
drush pm:uninstall my_custom_contenttype; drush pm:enable my_custom_contenttype;
function my_custom_contenttype_install(){
// Add content type if it not exist
};
You could do this using manually-managed configuration. Either by:
Creating a custom module and including your configurations in custom_module/config/install, and using "drush en" to install the module
OR
By using an existing custom module and using a post_update hook to install the configuration.
We do this on a number of sites, and loading and installing the configurations is just complex enough that we built a helper module to do it. You can pull this module in with composer and use update hooks to activate it, or you can look at the installConfig function here and use it a as a template. (the module has a helpful readme, too).

kaa sample apps miss build files for c sdk

I have been researching kaa platform for weeks. And yesterday, I started running a sample application named gpiocontrol on kaa github. The java (android) sdk works fine. However, when trying to build the c sdk for esp8266, I find out some files are missing, which are
build.sh (Refered in readme file)
CMakelists.txt (Prompted when I tried to run cmake)
Also, I find these missing files in some previous commits of the project. So please check and re-add these files. Thank you very much kaa team.
Update
I do notice that the build files I mentioned above can be found in the /common path of the root directory (sample-apps).
Update 2
Unfortunately, the common build files does not have specific build files for esp8266 platform. Now I'm wondering which method should be used to build kaa for this platform, follow kaa documentation for esp8266 or just add the option -DKAA_PLATFORM=esp8266 to cmake command in common build.sh file? Actually, I have tried the second way but it failed :(
The common build.sh file cmake command
build() {
mkdir -p "$PROJECT_HOME/build"
cd "$PROJECT_HOME/build"
cmake -DBUILD_TESTING=OFF ..
make
}
Still wait for your response and thank you again!
The sample applications' sources you have discovered in the sample-apps repository on GitHub are first assembled by Maven build tool and then deployed into Kaa Sandbox image.
This does most of the effort necessary to build the application(s) easily using Kaa Sandbox.
Thus, the most simple way to build and run Kaa sample applications is by downloading them from Kaa Sandbox through the web interface and then building according to the guide. The guide itself is available on the Kaa Sandbox web interface and is tested for each the application delivered with the Kaa Sandbox.
More information on using Kaa Sandbox is available in the official Kaa Getting started documentation.
Please let me know if using Kaa Sandbox is not an option for you and you still need to build the applications manually.
Update: I confirm the ESP8622 platform was disabled for the Kaa Sandbox 0.10.0 release due to some issues on that platform at the release time.
We are planning to release Kaa 0.10.1 with fixes that should include ESP8622 platform fixes soon.
Update 2: You can now use master branch of the kaaproject/sample-apps repository to build GPIO Control application for ESP8266 platform according to the below without need to wait for the next release:
Create a CMakeLists.txt file within the root directory of the application with the next content:
cmake_minimum_required(VERSION 3.0.2)
include(config.cmake)
if (NOT DEFINED KAA_MAX_LOG_LEVEL)
set(KAA_MAX_LOG_LEVEL 3)
endif (NOT DEFINED KAA_MAX_LOG_LEVEL)
set(BUILD_TESTING OFF CACHE BOOL "")
if (NOT DEFINED KAA_SDK_PATH)
add_subdirectory(libs/kaa)
else (NOT DEFINED KAA_SDK_PATH)
add_subdirectory(${KAA_SDK_PATH})
endif (NOT DEFINED KAA_SDK_PATH)
install(TARGETS demo_client DESTINATION bin)
Extract the Kaa SDK into libs/kaa directory.
Then run (formatted as single command):
mkdir build && \
cd build && \
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../libs/kaa/toolchains/esp8266.cmake \
-DKAA_PLATFORM=esp8266 && \
make

Robolectric 2.x - dependent jars are downloading while running the tests

How will I download all the robolectric dependent jars, to avoid runtime downloading and make it offline? I need to use Robolectric.buildActivity(), which is part of 2.x.x versions.
any idea on this ?
Starting with Robolectric 2.4 they added two system properties to allow you to tell the Robolectric test runner to use local copies of the dependencies. See the Configuring Robolectric page.
The settings are:
robolectric.offline - Set to true to disable runtime fetching of jars
robolectric.dependency.dir - When in offline mode, specifies a folder containing runtime dependencies
One way to figure out which files you need to copy to the dependencyDir, is to run gradlew testDebug -i (or maybe with -d) and watch the output to see which jars are being downloaded at runtime. Then copy them to a known location on your build machine. (Another way to see which files you need, is to look at SdkConfig.java and get the dependency jars mentioned there along with their dependencies.)
For the current Robolectric 3.0-rc2, these are the files it needs:
accessibility-test-framework-1.0.jar
android-all-5.0.0_r2-robolectric-1.jar
icu4j-53.1.jar
json-20080701.jar
robolectric-annotations-3.0-rc2.jar
robolectric-resources-3.0-rc2.jar
robolectric-utils-3.0-rc2.jar
shadows-core-3.0-rc2.jar
sqlite4java-0.282.jar
tagsoup-1.2.jar
vtd-xml-2.11.jar
Copy these files to a known location, like say /home/jenkins/robolectric-files/, and then edit your build.gradle with something like this:
afterEvaluate {
project.tasks.withType(Test) {
systemProperties.put('robolectric.offline', 'true')
systemProperties.put('robolectric.dependency.dir', '/home/jenkins/robolectric-files/')
}
}
Here is how I solved it for org.robolectric:robolectric:3.0
https://gist.github.com/kotucz/60ae91767dc71ab7b444
I downloads the runtime dependencies into the build folder and configures the tests to use it - see setting the system properties.
I had this issue too, and found the cause to be the org.robolectric.Testrunner creating a org.robolectric.MavenCentral object, which declares a Maven repository using an Internet-url (Robolectric 2.3-release). Offline builds will not be able to access that url.
In my case I'm required to use a Maven repository proxy, so I replaced the url pointing to http://oss.sonatype.org with my local Maven repository proxy. That meant subclassing RobolectricTestRunner to org.robolectric.MyRobolectricTestRunner, and creating a custom MavenCentral object for it to use, and overriding the methods where RobolectricTestRunner references its private MAVEN_CENTRAL object.
The source code for RobolectricTestRunner and MavenCentral are available on Robolectric's Github page.
I used Robolectric version 3.0, and the dependency jars were downloaded from my repository, instead of sonatype.

TideSDK | Bundle packaging

I have developed a TideSDK application and am now ready to package it, but I'm having problems with the network type installer.
It always gives me code 404 on the Application first run:
Could not query info: Invalid HTTP Status Code (404)
I presume the installer is having difficulty with reaching the correct servers and downloading the needed runtime, but I have run through most solutions on this forum, and none have worked.
So I tried a bundle packaging, as it should include such runtime, but I must be doing something wrong, since it does not bundle within the MSI.
The code I'm executing is as follows:
C:\TideSDK\sdk\win32\1.2.0.RC6d\tibuild.py -p --type=BUNDLE --os=win32 "C:\path_to_app\app_dir"
I also tried:
C:\TideSDK\sdk\win32\1.2.0.RC6d\tibuild.py -p -t bundle --os=win32 "C:\path_to_app\app_dir"
And all the uppercase/lowercase combinations. Also tried version 1.2.0.4, without sucess. Am I doing something wrong?
the network type installer is not available anymore, since appcelerator has canceled their services for titanium desktop.
So you can only do bundle packaging. Try the following command:
python tibuild.py --dest=. --type=bundle --package=. "c:\path\to\your\app\dir"
This should build and package your app and create a installer for it.
Change "dest" and "package" to the directories where you want to have the built app and installation package.
You can omit the OS parameter, since the builder can only generate builds for the current OS.

Resources