Skip to content

Commit

Permalink
Add support for wildcard filespecs in katello-certs-gen-rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSD committed Jun 13, 2018
1 parent 38c2e0e commit 77c3634
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions katello-certs-gen-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -240,38 +240,27 @@ TARBALL=$NAME-$VERSION.tar.gz
echo "Building $NAME-$VERSION-$RELEASE.$ARCH.rpm"

rm -rf $RPM_BUILD_DIR
install --verbose -d $RPM_BUILD_DIR/$DIRNAME
install --verbose -d $RPM_BUILD_DIR/$DIRNAME/root

# Prepare the tar file
i=0
while [ $i -lt ${#PARAMS[*]} ]; do
echo ${PARAMS[$i]} | (
IFS== read dstmod src
echo ${dstmod} | (IFS=: read dst mod
echo "${src} -> ${RPM_BUILD_DIR}/${DIRNAME}/${dst}"
echo "${src} -> ${RPM_BUILD_DIR}/${DIRNAME}/root/${dst}"
if [ -d "$src" ] ; then
mkdir --parents --verbose ${RPM_BUILD_DIR}/${DIRNAME}/${dst}
mkdir --parents --verbose ${RPM_BUILD_DIR}/${DIRNAME}/root/${dst}
else
mkdir --parents --verbose ${RPM_BUILD_DIR}/${DIRNAME}/`dirname "${dst}"`
cp ${src} ${RPM_BUILD_DIR}/${DIRNAME}/${dst}
dstdir=`dirname "${dst}"`
mkdir --parents --verbose ${RPM_BUILD_DIR}/${DIRNAME}/root/${dstdir}
cp ${src} ${RPM_BUILD_DIR}/${DIRNAME}/root/${dstdir}
fi
)
)
i=$[$i+1]
done

# Build the install section
installsect=`i=0
while [ $i -lt ${#PARAMS[*]} ]; do
echo ${PARAMS[$i]} | (
IFS== read dstmod src
echo ${dstmod} | (IFS=: read dst mod
echo "install --verbose -d \\\$RPM_BUILD_ROOT\`dirname ${dst}\`"
echo "install --verbose .${dst} \\\$RPM_BUILD_ROOT${dst}")
)
i=$[$i+1]
done | sort | uniq | while read line; do echo -n "$line\n"; done`
# Build the file section
filesect=`i=0
while [ $i -lt ${#PARAMS[*]} ]; do
Expand Down Expand Up @@ -323,8 +312,8 @@ Vendor: $VENDOR
%install
rm -rf \$RPM_BUILD_ROOT
install -d \$RPM_BUILD_ROOT
`echo -e $installsect`
install -d \`dirname \$RPM_BUILD_ROOT\`
cp --verbose -R root \$RPM_BUILD_ROOT
%clean
rm -rf \$RPM_BUILD_ROOT
Expand Down

0 comments on commit 77c3634

Please sign in to comment.