[jetty/f18: 3/3] Create work directory if not exists

Mikolaj Izdebski mizdebsk at fedoraproject.org
Mon Aug 27 16:01:12 UTC 2012


commit aaf8790c0c56c56fb1d6c9f9121ce6d7a3ce27c7
Author: Mikolaj Izdebski <mizdebsk at redhat.com>
Date:   Mon Aug 27 17:09:32 2012 +0200

    Create work directory if not exists

 djetty.script               |    6 ++++++
 jetty-create-work-dir.patch |   20 ++++++++++++++++++++
 jetty.spec                  |    7 ++++++-
 3 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/djetty.script b/djetty.script
index 7861b31..0a2a999 100644
--- a/djetty.script
+++ b/djetty.script
@@ -19,6 +19,12 @@ then
 fi
 
 cd $JETTY_HOME
+
+# Try to create work directory if not exists
+if [ ! -d work ]; then
+    (umask 022 && mkdir -p "$(readlink -f work)")
+fi
+
 exec /usr/bin/java -Djetty.class.path=/usr/share/java/commons-logging.jar -Djetty.port=$JETTY_PORT  -jar start.jar etc/jetty-logging.xml etc/jetty.xml 2>/dev/null &
 echo $! >$JETTY_PID
 
diff --git a/jetty-create-work-dir.patch b/jetty-create-work-dir.patch
new file mode 100644
index 0000000..3848bb3
--- /dev/null
+++ b/jetty-create-work-dir.patch
@@ -0,0 +1,20 @@
+--- ./jetty-8.1.5.v20120716/jetty-distribution/src/main/resources/bin/jetty.sh~	2012-08-27 17:04:50.351965899 +0200
++++ ./jetty-8.1.5.v20120716/jetty-distribution/src/main/resources/bin/jetty.sh	2012-08-27 17:05:01.687019587 +0200
+@@ -316,10 +316,17 @@
+ if [ -z "$JETTY_PID" ] 
+ then
+   JETTY_PID="$JETTY_RUN/jetty.pid"
+ fi
+ 
++#####################################################
++# Try to create work directory if not exists
++#####################################################
++if [ ! -d work ]; then
++    (umask 022 && mkdir -p "$(readlink -f work)")
++fi
++
+ ##################################################
+ # Setup JAVA if unset
+ ##################################################
+ if [ -z "$JAVA" ]
+ then
diff --git a/jetty.spec b/jetty.spec
index 7282ce5..ae3f0e1 100644
--- a/jetty.spec
+++ b/jetty.spec
@@ -44,7 +44,7 @@
 
 Name:           jetty
 Version:        8.1.5
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Java Webserver and Servlet Container
 
 Group:          Applications/Internet
@@ -56,6 +56,7 @@ Source1:        djetty.script
 Source3:        jetty.logrotate
 Source4:        %{name}-depmap.xml
 Source5:        %{name}.service
+Patch0:         %{name}-create-work-dir.patch
 Patch4:         0004-Modify-dependencies.patch
 
 BuildRequires:  geronimo-annotation
@@ -565,6 +566,7 @@ Requires:       jpackage-utils
 for f in $(find . -name "*.?ar"); do rm $f; done
 find . -name "*.class" -exec rm {} \;
 
+%patch0 -p2 -b .sav
 %patch4 -p1 -b .sav
 
 # Remove javadoc execution
@@ -1038,6 +1040,9 @@ groupdel %username &>/dev/null || :
 %doc %{_javadocdir}/%{name}
 
 %changelog
+* Mon Aug 27 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 8.1.5-5
+- Create work directory if not exists
+
 * Tue Aug 21 2012 Mikolaj Izdebski <mizdebsk at redhat.com> - 8.1.5-4
 - Convert systemd scriplets to macros, resolves #850176
 


More information about the scm-commits mailing list