Author: rmannibucau
Date: Sun Jan 20 18:30:50 2019
New Revision: 1851714

URL: http://svn.apache.org/viewvc?rev=1851714&view=rev
Log:
MEECROWAVE-177 adding fake tomcat scripts

Added:
    
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/catalina.sh
    
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/shutdown.sh
    
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/startup.sh
Modified:
    
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java

Modified: 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java?rev=1851714&r1=1851713&r2=1851714&view=diff
==============================================================================
--- 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
 (original)
+++ 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
 Sun Jan 20 18:30:50 2019
@@ -41,7 +41,6 @@ import java.nio.file.attribute.BasicFile
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.stream.Stream;
 import java.util.zip.GZIPOutputStream;
@@ -107,6 +106,9 @@ public class MeecrowaveBundleMojo extend
     @Parameter(property = "meecrowave.skip", defaultValue = "false")
     private boolean skip;
 
+    @Parameter(property = "meecrowave.fakeTomcatScripts", defaultValue = 
"false")
+    private boolean fakeTomcatScripts;
+
     @Parameter(property = "meecrowave.formats", defaultValue = "zip")
     private Collection<String> formats;
 
@@ -262,6 +264,19 @@ public class MeecrowaveBundleMojo extend
                 throw new MojoExecutionException(e.getMessage(), e);
             }
         }
+        if (fakeTomcatScripts) {
+            Stream.of("catalina.sh", "shutdown.sh", 
"startup.sh").forEach(script -> {
+                try (final BufferedReader reader = new BufferedReader(new 
InputStreamReader(
+                        
Thread.currentThread().getContextClassLoader().getResourceAsStream("bin/" + 
script)))) {
+                    final File target = new File(distroFolder, "bin/" + 
script);
+                    if (!target.exists()) {
+                        write(target, reader.lines().collect(joining("\n")));
+                    }
+                } catch (final IOException e) {
+                    throw new IllegalStateException(e.getMessage(), e);
+                }
+            });
+        }
 
         final Path prefix = skipArchiveRootFolder ? distroFolder.toPath() : 
distroFolder.getParentFile().toPath();
         for (final String format : formats) {

Added: 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/catalina.sh
URL: 
http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/catalina.sh?rev=1851714&view=auto
==============================================================================
--- 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/catalina.sh
 (added)
+++ 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/catalina.sh
 Sun Jan 20 18:30:50 2019
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#     http://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.
+
+# -----------------------------------------------------------------------------
+# Plain copy of Tomcat with the script (EXECUTABLE) replacement
+# -----------------------------------------------------------------------------
+
+# Better OS/400 detection: see Bugzilla 31132
+os400=false
+case "`uname`" in
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+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
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=meecrowave.sh
+
+if $os400; then
+  eval
+else
+  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+    echo "Cannot find $PRGDIR/$EXECUTABLE"
+    echo "The file is absent or does not have execute permission"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" "$@"

Added: 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/shutdown.sh
URL: 
http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/shutdown.sh?rev=1851714&view=auto
==============================================================================
--- 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/shutdown.sh
 (added)
+++ 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/shutdown.sh
 Sun Jan 20 18:30:50 2019
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#     http://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.
+
+# -----------------------------------------------------------------------------
+# Plain copy of Tomcat with the script (EXECUTABLE) replacement
+# -----------------------------------------------------------------------------
+
+# Better OS/400 detection: see Bugzilla 31132
+os400=false
+case "`uname`" in
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+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
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=meecrowave.sh
+
+if $os400; then
+  eval
+else
+  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+    echo "Cannot find $PRGDIR/$EXECUTABLE"
+    echo "The file is absent or does not have execute permission"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" stop "$@"

Added: 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/startup.sh
URL: 
http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/startup.sh?rev=1851714&view=auto
==============================================================================
--- 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/startup.sh
 (added)
+++ 
openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/resources/bin/startup.sh
 Sun Jan 20 18:30:50 2019
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#     http://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.
+
+# -----------------------------------------------------------------------------
+# Plain copy of Tomcat, you can just replace it and customize EXECUTABLE value
+# -----------------------------------------------------------------------------
+
+os400=false
+case "`uname`" in
+OS400*) os400=true;;
+esac
+
+PRG="$0"
+
+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
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=meecrowave.sh
+
+# Check that target executable exists
+if $os400; then
+  eval
+else
+  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+    echo "Cannot find $PRGDIR/$EXECUTABLE"
+    echo "The file is absent or does not have execute permission"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" start "$@"


Reply via email to