Argeo CLI packaging.
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 29 Mar 2020 08:29:38 +0000 (10:29 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 29 Mar 2020 08:29:38 +0000 (10:29 +0200)
dist/argeo-cli/.gitignore [new file with mode: 0644]
dist/argeo-cli/assembly/argeo-cli.xml [new file with mode: 0644]
dist/argeo-cli/base/bin/argeo [new file with mode: 0755]
dist/argeo-cli/base/etc/argeo-cli/log4j.properties [new file with mode: 0644]
dist/argeo-cli/base/etc/argeo-cli/settings.sh [new file with mode: 0644]
dist/argeo-cli/pom.xml [new file with mode: 0644]
dist/argeo-cli/rpm/usr/bin/argeo [new file with mode: 0755]
dist/pom.xml

diff --git a/dist/argeo-cli/.gitignore b/dist/argeo-cli/.gitignore
new file mode 100644 (file)
index 0000000..b83d222
--- /dev/null
@@ -0,0 +1 @@
+/target/
diff --git a/dist/argeo-cli/assembly/argeo-cli.xml b/dist/argeo-cli/assembly/argeo-cli.xml
new file mode 100644 (file)
index 0000000..cf5b0fe
--- /dev/null
@@ -0,0 +1,41 @@
+<assembly
+       xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+       <id>dist</id>
+       <baseDirectory></baseDirectory>
+       <formats>
+               <format>dir</format>
+       </formats>
+       <fileSets>
+               <fileSet>
+                       <directory>base/bin</directory>
+                       <outputDirectory>bin</outputDirectory>
+                       <fileMode>0755</fileMode>
+                       <includes>
+                               <include>**</include>
+                       </includes>
+               </fileSet>
+               <fileSet>
+                       <directory>base/etc</directory>
+                       <outputDirectory>etc</outputDirectory>
+                       <fileMode>0644</fileMode>
+                       <includes>
+                               <include>**</include>
+                       </includes>
+               </fileSet>
+       </fileSets>
+       <dependencySets>
+               <dependencySet>
+                       <unpack>false</unpack>
+                       <outputFileNameMapping>${artifact.groupId}/${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
+                       <outputDirectory>share/osgi</outputDirectory>
+                       <useTransitiveDependencies>true</useTransitiveDependencies>
+                       <useTransitiveFiltering>true</useTransitiveFiltering>
+                       <scope>compile</scope>
+                       <excludes>
+                               <exclude>org.argeo.tp:argeo-tp</exclude>
+                       </excludes>
+               </dependencySet>
+       </dependencySets>
+</assembly>
\ No newline at end of file
diff --git a/dist/argeo-cli/base/bin/argeo b/dist/argeo-cli/base/bin/argeo
new file mode 100755 (executable)
index 0000000..a4d37e4
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+JVM=java
+
+APP=argeo-cli
+BASE_DIR="$(cd "$(dirname "$0")/.."; pwd -P)"
+CONF_DIR=$BASE_DIR/etc/$APP
+
+# Overwrite variables
+if [ -f $CONF_DIR/settings.sh ];then
+       . $CONF_DIR/settings.sh
+fi
+
+CLASSPATH=
+for i in $BASE_DIR/share/osgi/*/; do
+       CLASSPATH=$CLASSPATH:"$i*";
+done;
+
+$JVM \
+       -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
+       $JAVA_OPTS -cp $CLASSPATH \
+       org.argeo.cms.cli.ArgeoCli $*
\ No newline at end of file
diff --git a/dist/argeo-cli/base/etc/argeo-cli/log4j.properties b/dist/argeo-cli/base/etc/argeo-cli/log4j.properties
new file mode 100644 (file)
index 0000000..d93b234
--- /dev/null
@@ -0,0 +1,15 @@
+log4j.rootLogger=WARN, console
+
+log4j.logger.org.argeo=DEBUG
+
+## Appenders
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p %m%n
+
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.File=/var/log/argeo/argeo.csv
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ISO8601};"%m";%c;%p%n
+log4j.appender.file.bufferedIO=true
+log4j.appender.file.immediateFlush=false
diff --git a/dist/argeo-cli/base/etc/argeo-cli/settings.sh b/dist/argeo-cli/base/etc/argeo-cli/settings.sh
new file mode 100644 (file)
index 0000000..b20d4d8
--- /dev/null
@@ -0,0 +1,12 @@
+export LANG=en_US.utf8
+JAVA_OPTS="-showversion -Xmx128m"
+
+# JMX
+#JAVA_OPTS="-showversion -Xmx512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7084 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
+
+# Development
+#JAVA_OPTS="-ea -agentlib:jdwp=transport=dt_socket,server=y,address=*:8000,suspend=n -showversion -Xmx512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7084 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
+
+# JMX over server tunnel
+#JAVA_OPTS="-showversion -Xmx2048m -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.rmi.port=7084 -Dcom.sun.management.jmxremote.port=7084 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
+# and then: ssh root@remote-host -L 7084:127.0.0.1:7084 -N
\ No newline at end of file
diff --git a/dist/argeo-cli/pom.xml b/dist/argeo-cli/pom.xml
new file mode 100644 (file)
index 0000000..b067131
--- /dev/null
@@ -0,0 +1,110 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <version>2.1.89-SNAPSHOT</version>
+               <artifactId>dist</artifactId>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>argeo-cli</artifactId>
+       <packaging>pom</packaging>
+       <name>Argeo Command Line</name>
+       <profiles>
+               <profile>
+                       <id>dist</id>
+                       <dependencies>
+                               <dependency>
+                                       <groupId>org.argeo.commons</groupId>
+                                       <artifactId>org.argeo.dep.cms.client</artifactId>
+                                       <version>2.1.89-SNAPSHOT</version>
+                               </dependency>
+                               <dependency>
+                                       <groupId>org.argeo.commons</groupId>
+                                       <artifactId>org.argeo.dep.cms.node</artifactId>
+                                       <version>2.1.89-SNAPSHOT</version>
+                               </dependency>
+                       </dependencies>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>org.apache.maven.plugins</groupId>
+                                               <artifactId>maven-assembly-plugin</artifactId>
+                                               <configuration>
+                                                       <finalName>argeo-cli-${project.version}</finalName>
+                                                       <appendAssemblyId>false</appendAssemblyId>
+                                                       <descriptors>
+                                                               <descriptor>assembly/argeo-cli.xml</descriptor>
+                                                       </descriptors>
+                                               </configuration>
+                                               <executions>
+                                                       <execution>
+                                                               <id>assembly-base</id>
+                                                               <phase>package</phase>
+                                                               <goals>
+                                                                       <goal>single</goal>
+                                                               </goals>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+               <profile>
+                       <id>rpmbuild</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>org.codehaus.mojo</groupId>
+                                               <artifactId>rpm-maven-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <id>rpm-node</id>
+                                                               <phase>package</phase>
+                                                               <goals>
+                                                                       <goal>rpm</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <name>argeo-cli</name>
+                                                                       <mappings>
+                                                                               <mapping>
+                                                                                       <directory>/etc/argeo-cli</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>wheel</groupname>
+                                                                                       <filemode>640</filemode>
+                                                                                       <configuration>noreplace</configuration>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>base/etc/argeo-cli</location>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                               <mapping>
+                                                                                       <directory>/usr/bin</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>755</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>rpm/usr/bin</location>
+                                                                                                       <includes>
+                                                                                                               <include>argeo</include>
+                                                                                                       </includes>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                       </mappings>
+                                                                       <requires>
+                                                                               <require>argeo-cms-client</require>
+                                                                               <!-- do not explicitely require java -->
+                                                                       </requires>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+       </profiles>
+</project>
diff --git a/dist/argeo-cli/rpm/usr/bin/argeo b/dist/argeo-cli/rpm/usr/bin/argeo
new file mode 100755 (executable)
index 0000000..bae7d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+JVM=java
+
+APP=argeo-cli
+CONF_DIR=/etc/$APP
+
+# Overwrite variables
+if [ -f $CONF_DIR/settings.sh ];then
+       . $CONF_DIR/settings.sh
+fi
+
+CLASSPATH=
+for i in /usr/local/share/osgi/*/; do
+       CLASSPATH=$CLASSPATH:"$i*";
+done;
+for i in /usr/local/lib/osgi/*/; do
+       CLASSPATH=$CLASSPATH:"$i*";
+done;
+for i in /usr/share/osgi/*/; do
+       CLASSPATH=$CLASSPATH:"$i*";
+done;
+for i in /usr/lib/osgi/*/; do
+       CLASSPATH=$CLASSPATH:"$i*";
+done;
+
+$JVM \
+       -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
+       $JAVA_OPTS -cp $CLASSPATH \
+       org.argeo.cms.cli.ArgeoCli $*
\ No newline at end of file
index 68c405b3975bb56497654eb58276fe1be77c87a8..4ec3c72fb1b8c67ae8f7cbc4a6d4cde565d52280 100644 (file)
@@ -12,6 +12,7 @@
        <packaging>pom</packaging>
        <modules>
                <module>osgi-boot</module>
+               <module>argeo-cli</module>
                <module>argeo-node</module>
                <module>containers</module>
        </modules>