Skip to content

Commit

Permalink
fix dos2unix
Browse files Browse the repository at this point in the history
  • Loading branch information
mchyzer committed Aug 23, 2022
1 parent d36796b commit 853151b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ARG CORRETTO_RPM=amazon-corretto-8-x64-linux-jdk.rpm

#RUN cd /tmp \
# && chmod +x /opt/container_files/*.sh \
# && if [ $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1 | wc -l) -ne 0 ]; then dos2unix $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1) ; fi; \
# && /opt/container_files/containerDockerfileInstallDos2unix.sh /opt/container_files \
# && /opt/container_files/containerDockerfileInstallJava.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION \
# && /opt/container_files/containerDockerfileInstallGrouper.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION

Expand All @@ -44,12 +44,12 @@ COPY container_files/ /opt/container_files/

#RUN cd /tmp \
# && chmod +x /opt/container_files/*.sh \
# && if [ $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1 | wc -l) -ne 0 ]; then dos2unix $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1) ; fi; \
# && /opt/container_files/containerDockerfileInstallDos2unix.sh /opt/container_files \
# && /opt/container_files/containerDockerfileInstall.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION

RUN cd /tmp \
&& chmod +x /opt/container_files/*.sh \
&& if [ $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1 | wc -l) -ne 0 ]; then dos2unix $(find /opt/container_files -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1) ; fi; \
&& /opt/container_files/containerDockerfileInstallDos2unix.sh /opt/container_files \
&& /opt/container_files/containerDockerfileInstallJava.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION \
&& /opt/container_files/containerDockerfileInstallGrouper.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION \
&& /opt/container_files/containerDockerfileInstall.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION
Expand Down
8 changes: 8 additions & 0 deletions container_files/containerDockerfileInstallDos2unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

lines=$(find $1 -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1 | wc -l)
if [ $lines -ne 0 ]; then
dos2unix $(find $1 -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallDos2unix.sh) dos2unix \$(find $1 -type f -name \"*.sh\" -exec file \"{}\" \";\" | grep CRLF | cut -d: -f1), result: $returnCode"
fi
9 changes: 3 additions & 6 deletions container_files/containerDockerfileInstallPermissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ if [ $lines -ne 0 ]; then
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod +x \$(find /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /etc/httpd/conf.d/ -type f -name \"*.sh\" ! -perm -o+x), result: $returnCode"
fi

lines=$(find /usr/local/bin -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1 | wc -l)
if [ $lines -ne 0 ]; then
dos2unix $(find /usr/local/bin -type f -name "*.sh" -exec file "{}" ";" | grep CRLF | cut -d: -f1)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) dos2unix \$(find /usr/local/bin -type f -name \"*.sh\" -exec file \"{}\" \";\" | grep CRLF | cut -d: -f1), result: $returnCode"
fi
/opt/container_files/containerDockerfileInstallDos2unix.sh /usr/local/bin
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) /opt/container_files/containerDockerfileInstallDos2unix.sh /usr/local/bin, result: $returnCode"

find /usr/local/bin/ -type f -print0 | xargs -0 dos2unix
returnCode=$?
Expand Down

0 comments on commit 853151b

Please sign in to comment.