Skip to content

Commit

Permalink
add epicbox-java/11 image, rename epicbox-java9 -> epicbox-java/9
Browse files Browse the repository at this point in the history
  • Loading branch information
andrvb committed Oct 23, 2018
1 parent 6a4f92c commit 145de36
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
7 changes: 7 additions & 0 deletions epicbox-java/11/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM openjdk:11.0.1-slim
MAINTAINER Stepik Team <[email protected]>

COPY java_lookup_main.sh /usr/local/bin/java_lookup_main.sh
RUN chmod +x /usr/local/bin/java_lookup_main.sh

RUN useradd -M -d /sandbox sandbox
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions epicbox-java/9/java_lookup_main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Grep *.class files in the given directory to find one with psvm method defined
# Usage: java_lookup_main.sh DIRECTORY_PATH

PSVM_REGEX="public static( final)? void main\(java\.lang\.String(\[\]|\.\.\.)\)"

shopt -s nullglob
for f in "$1"/*.class; do
if javap -p "$f" 2> /dev/null | grep -Pq "$PSVM_REGEX"; then
filename=$(basename "$f")
echo -n "${filename%.*}"
exit 0
fi
done
exit 1

0 comments on commit 145de36

Please sign in to comment.