Skip to content

Commit

Permalink
GRP-4388: improve find command in container build script
Browse files Browse the repository at this point in the history
  • Loading branch information
mchyzer committed Sep 27, 2022
1 parent 95b221d commit b075f6a
Showing 1 changed file with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,66 @@ group=$2
# this needs to exist
mkdir -p /opt/tier

lines=$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -user $user -print | wc -l)
lines=$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -user $user -print | wc -l)
if [ $lines -ne 0 ]; then
chown $user:$group $(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -user $user -print)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chown $user:$group \$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -user $user -print), result: $returnCode"
chown $user:$group $(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -user $user -print) returnCode=$?
echo "grouperDockerfile; INFO: ($0) chown $user:$group \$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -user $user -print), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -group $group -print | wc -l)
lines=$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -group $group -print | wc -l)
if [ $lines -ne 0 ]; then
chown $user:$group $(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -group $group -print)
chown $user:$group $(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -group $group -print)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chown $user:$group \$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -group $group -print), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chown $user:$group \$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -path /opt/grouper/slashRoot -prune -o ! -group $group -print), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ -type d -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rwxs | wc -l)
lines=$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d -type d -path /opt/grouper/slashRoot -prune -o ! -perm -g+rwxs | wc -l)
if [ $lines -ne 0 ]; then
chmod g+rwxs $(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ -type d -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rwxs)
chmod g+rwxs $(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d -type d -path /opt/grouper/slashRoot -prune -o ! -perm -g+rwxs)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod g+rwxs \$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ -type d -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rwxs ), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod g+rwxs \$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d -type d -path /opt/grouper/slashRoot -prune -o ! -perm -g+rwxs ), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -type f -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rw | wc -l)
lines=$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -type f -path /opt/grouper/slashRoot -prune -o ! -perm -g+rw | wc -l)
if [ $lines -ne 0 ]; then
chmod g+rw $(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -type f -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rw)
chmod g+rw $(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -type f -path /opt/grouper/slashRoot -prune -o ! -perm -g+rw)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod g+rw \$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -type f -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+rw ), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod g+rw \$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -type f -path /opt/grouper/slashRoot -prune -o ! -perm -g+rw ), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot | wc -l)
lines=$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -path /opt/grouper/slashRoot -prune -o -print | wc -l)
if [ $lines -ne 0 ]; then
chmod o-w $(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot)
chmod o-w $(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -path /opt/grouper/slashRoot -prune -o -print)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod o-w \$(find /home/$user /opt/container_files/ /opt/grouper/ /opt/tier/ /opt/tier-support/ /opt/tomee/ /etc/httpd/conf/ /home/tomcat/ /usr/local/bin /etc/httpd/conf.d/ /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod o-w \$(find /home/$user /opt/container_files /opt/grouper /opt/tier /opt/tier-support /opt/tomee /etc/httpd/conf /home/tomcat /usr/local/bin /etc/httpd/conf.d /usr/lib/jvm/java/jre/lib/security/cacerts -perm -o+w -path /opt/grouper/slashRoot -prune -o -print ), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /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 -g+x -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot | wc -l)
lines=$(find /home/$user /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 -g+x -path /opt/grouper/slashRoot -prune -o -print | wc -l)
if [ $lines -ne 0 ]; then
chmod +x $(find /home/$user /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" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+x)
chmod +x $(find /home/$user /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" -path /opt/grouper/slashRoot -prune -o ! -perm -g+x)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod +x \$(find /home/$user /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\" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -g+x), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod +x \$(find /home/$user /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\" -path /opt/grouper/slashRoot -prune -o ! -perm -g+x), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /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" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -u+x | wc -l)
lines=$(find /home/$user /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" -path /opt/grouper/slashRoot -prune -o ! -perm -u+x | wc -l)
if [ $lines -ne 0 ]; then
chmod +x $(find /home/$user /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" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -u+x)
chmod +x $(find /home/$user /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" -path /opt/grouper/slashRoot -prune -o ! -perm -u+x)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod +x \$(find /home/$user /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\" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -u+x), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod +x \$(find /home/$user /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\" -path /opt/grouper/slashRoot -prune -o ! -perm -u+x), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

lines=$(find /home/$user /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" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -o+x | wc -l)
lines=$(find /home/$user /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" -path /opt/grouper/slashRoot -prune -o ! -perm -o+x | wc -l)
if [ $lines -ne 0 ]; then
chmod +x $(find /home/$user /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" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -o+x)
chmod +x $(find /home/$user /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" -path /opt/grouper/slashRoot -prune -o ! -perm -o+x)
returnCode=$?
echo "grouperDockerfile; INFO: (containerDockerfileInstallPermissions.sh) chmod +x \$(find /home/$user /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\" -not -path /opt/grouper/slashRoot/* -not -path /opt/grouper/slashRoot ! -perm -o+x), result: $returnCode"
echo "grouperDockerfile; INFO: ($0) chmod +x \$(find /home/$user /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\" -path /opt/grouper/slashRoot -prune -o ! -perm -o+x), result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi
fi

Expand Down

0 comments on commit b075f6a

Please sign in to comment.