diff --git a/reposync/runreposync.sh b/reposync/runreposync.sh index 90539a84ce8b29c14309d6836dbd6ce40227580e..a7161656628460b9d157080107ba5153898a67c4 100755 --- a/reposync/runreposync.sh +++ b/reposync/runreposync.sh @@ -24,8 +24,8 @@ echo "Inputs: REPOID=\"$REPOID\" REPOFILE=\"$REPOFILE\" REPOPATH=\"$REPOPATH\" C REPOPATH="/repo/${REPOPATH}" # Record what's already there first /usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -printf '%f %s\n' > /tmp/prelist -PRECOUNT=`wc -l /tmp/prelist | cut -d' ' -f1` -PRESIZE=`awk '{print $2}' /tmp/prelist | paste -sd+ | bc` +PRECOUNT=$(wc -l /tmp/prelist | cut -d' ' -f1) +PRESIZE=$(awk '{print $2}' /tmp/prelist | paste -sd+ | bc) echo "[${REPOID}]" > /etc/yum.repos.d/sync.repo echo $REPOFILE | base64 -d >> /etc/yum.repos.d/sync.repo @@ -112,12 +112,12 @@ if [ $? -eq 0 ]; then fi # Now let's look at the new stuff /usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -printf '%f %s\n' > /tmp/postlist -POSTCOUNT=`wc -l /tmp/postlist | cut -d' ' -f1` +POSTCOUNT=$(wc -l /tmp/postlist | cut -d' ' -f1) # cdn.redhat.com delivers us some rpms with junk attached at the end ... ? # these are 'useable' but since the size changes, metadata must be regenerated to # take it into account. -POSTSIZE=`awk '{print $2}' /tmp/postlist | paste -sd+ | bc` +POSTSIZE=$(awk '{print $2}' /tmp/postlist | paste -sd+ | bc) if [[ ($PRECOUNT -eq $POSTCOUNT) && ($PRESIZE -ne $POSTSIZE) ]]; then cat << EOF | error | tee $OUTPUT @@ -126,11 +126,11 @@ EOF fi if [[ ($PRECOUNT -ne $POSTCOUNT) || ($PRESIZE -ne $POSTSIZE) ]]; then - CHANGELIST=`/usr/bin/diff --changed-group-format='%>' --unchanged-group-format='' <(awk '{print $1}' /tmp/prelist) <(awk '{print $1}' /tmp/postlist)` + CHANGELIST=$(/usr/bin/diff --changed-group-format='%>' --unchanged-group-format='' <(awk '{print $1}' /tmp/prelist) <(awk '{print $1}' /tmp/postlist)) # Run createrepo if [[ $RUN_CREATEREPO -eq 1 ]]; then - COMPXMLFILE=`/bin/ls -1tr ${REPOPATH}/*-comps*xml.gz 2>&1 | /usr/bin/tail -1` + COMPXMLFILE=$(/bin/ls -1tr ${REPOPATH}/*-comps*xml.gz 2>&1 | /usr/bin/tail -1) if [ -f "$COMPXMLFILE" ]; then /bin/cp -f $COMPXMLFILE $REPOPATH/comps.xml.gz @@ -180,11 +180,11 @@ fi for rpm in ${CHANGELIST}; do - path=`/usr/bin/find ${REPOPATH} -type f -name "${rpm}"` - info=`/usr/bin/rpm --queryformat "%{NAME} %{VERSION}-%{RELEASE} %{ARCH}" -qp ${path} 2>/dev/null` - name=`echo $info | cut -d' ' -f1` - version=`echo $info | cut -d' ' -f2` - arch=`echo $info | cut -d' ' -f3` + path=$(/usr/bin/find ${REPOPATH} -type f -name "${rpm}") + info=$(/usr/bin/rpm --queryformat "%{NAME} %{VERSION}-%{RELEASE} %{ARCH}" -qp ${path} 2>/dev/null) + name=$(echo $info | cut -d' ' -f1) + version=$(echo $info | cut -d' ' -f2) + arch=$(echo $info | cut -d' ' -f3) cat << EOF | log "message_type": "change", @@ -206,7 +206,7 @@ cat << EOF | log EOF # Turn the new-line separated list of changes into a comma-separated list of quoted strings -LIST=`sed 's/^/"/;s/$/"/;s/^""$//' <(echo "${CHANGELIST}") | /usr/bin/tr '\n' ',' | sed 's/,$//'` +LIST=$(sed 's/^/"/;s/$/"/;s/^""$//' <(echo "${CHANGELIST}") | /usr/bin/tr '\n' ',' | sed 's/,$//') cat << EOF | log > $OUTPUT "message_type": "result",