diff --git a/Dockerfile b/Dockerfile index 853d8311..6497094a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV GROUPER_VERSION=2.6.15 \ GROUPER_HOME=/opt/grouper/grouperWebapp/WEB-INF RUN yum update -y \ - && yum install -y cron logrotate python3-pip rsync sudo patch supervisor wget tar unzip dos2unix \ + && yum install -y logrotate python3-pip rsync sudo patch supervisor wget tar unzip dos2unix file \ && pip3 install --upgrade setuptools \ && yum clean -y all \ && groupadd -r tomcat \ @@ -35,7 +35,7 @@ ARG CORRETTO_RPM=amazon-corretto-8-x64-linux-jdk.rpm #RUN cd /tmp \ # && chmod +x /opt/container_files/*.sh \ -# && find /opt/container_files/ -type f -name "*.sh" -print0 | xargs -0 dos2unix \ +# && 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/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 @@ -44,12 +44,12 @@ COPY container_files/ /opt/container_files/ #RUN cd /tmp \ # && chmod +x /opt/container_files/*.sh \ -# && find /opt/container_files/ -type f -name "*.sh" -print0 | xargs -0 dos2unix \ +# && 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/containerDockerfileInstall.sh $CORRETTO_URL_PERM $CORRETTO_RPM $JAVA_HOME $GROUPER_VERSION RUN cd /tmp \ && chmod +x /opt/container_files/*.sh \ - && find /opt/container_files/ -type f -name "*.sh" -print0 | xargs -0 dos2unix \ + && 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/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 diff --git a/container_files/containerDockerfileInstallPermissions.sh b/container_files/containerDockerfileInstallPermissions.sh index e704f983..07eb728f 100644 --- a/container_files/containerDockerfileInstallPermissions.sh +++ b/container_files/containerDockerfileInstallPermissions.sh @@ -64,6 +64,13 @@ 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 + find /usr/local/bin/ -type f -print0 | xargs -0 dos2unix returnCode=$? echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) find /usr/local/bin/ -type f -print0 | xargs -0 dos2unix, result: $returnCode"