Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
reposync
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
linuxsupport
cronjobs
reposync
Commits
33834e86
Commit
33834e86
authored
2 years ago
by
Marta Vila Fernandes
Browse files
Options
Downloads
Patches
Plain Diff
the backticks are the old way of doing subshells, use the new format
parent
ecfe8320
No related branches found
No related tags found
1 merge request
!223
[LOS1012] Stop unzip of the yaml and xml files
Pipeline
#4800861
passed
2 years ago
Stage: prepare
Stage: build
Stage: deploy_test
Stage: deploy
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
reposync/runreposync.sh
+12
-12
12 additions, 12 deletions
reposync/runreposync.sh
with
12 additions
and
12 deletions
reposync/runreposync.sh
+
12
−
12
View file @
33834e86
...
...
@@ -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",
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment