Skip to content

Commit

Permalink
scripts/rsync-generation/update-rsync-master: shellcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Groffen <[email protected]>
  • Loading branch information
grobian committed Mar 28, 2024
1 parent 6f38e3b commit d4ce7ca
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions scripts/rsync-generation/update-rsync-master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SCRIPTSTARTTIME=$(date +%s)

# get keys for ssh and signing
eval $(env SHELL=/bin/bash keychain -q --noask --eval)
eval "$(env SHELL=/bin/bash keychain -q --noask --eval)"

BASE_PATH="$(readlink -f "${BASH_SOURCE[0]%/*}")"

Expand All @@ -20,7 +20,6 @@ PORTAGE_BASE_PATH="${BASE_PATH}/prefix/usr/lib/portage/"
PYTHONPATH="${PORTAGE_BASE_PATH}/pym"
PORTAGE_CONFIGROOT="${BASE_PATH}/misc/config_root"
PORTAGE_DEPCACHEDIR="${BASE_PATH}/depcache"
MANIFEST_CACHE="${BASE_PATH}/manifests"

# for .cvsps and gnupg cache mainly
HOME="${BASE_PATH}/misc"
Expand All @@ -34,7 +33,12 @@ echo "(init) PATH=$PATH"

#### ---- egencache settings ---- ####

EGENCACHE_OPTS="--jobs=$(nproc) --load-average=$(nproc) --tolerant --update-use-local-desc"
EGENCACHE_OPTS=(
"--jobs=$(nproc)"
"--load-average=$(nproc)"
"--tolerant"
"--update-use-local-desc"
)

export PYTHONPATH PORTDIR PORTAGE_BASE_PATH PORTAGE_CONFIGROOT \
ROOT PORTAGE_TMPFS FEATURES HOME
Expand Down Expand Up @@ -66,8 +70,8 @@ apply_git_mtimes() {
git log --pretty=%ct --name-status --reverse "${from}..${to}"
echo 999 # end marker to trigger the last block to be done
} | \
while read line ; do
case ${line} in
while read -r line ; do
case "${line}" in
[0-9][0-9][0-9]*)
if [[ ${ts} -gt 0 ]] ; then
[[ ${#files[@]} == 0 ]] || \
Expand All @@ -78,11 +82,11 @@ apply_git_mtimes() {
;;
[ACMT]*)
set -- ${line}
files+=( $2 )
files+=( "$2" )
;;
[R]*)
set -- ${line}
files+=( $3 )
files+=( "$3" )
;;
[D]*)
set -- ${line}
Expand All @@ -95,8 +99,8 @@ apply_git_mtimes() {
# if the entire package was removed, touch the
# category level metadata
[[ -f ${f%/*}/metadata.xml ]] \
&& files+=( ${f%/*}/metadata.xml ) \
|| files+=( ${f%/*/*}/metadata.xml )
&& files+=( "${f%/*}"/metadata.xml ) \
|| files+=( "${f%/*/*}"/metadata.xml )
fi
;;
esac
Expand Down Expand Up @@ -201,8 +205,8 @@ echo "($(date +"%F %R")) git image updated"
echo "($(date +"%F %R")) rsync Prefix tree to rsync-master"
for entry in scripts *-*/* ; do
# copy it over
[[ -e ${RSYNCDIR}/${entry} ]] || mkdir -p "${RSYNCDIR}"/${entry}
rsync -v --delete -aC "${PREFIXTREEDIR}"/${entry}/ "${RSYNCDIR}"/${entry}/
[[ -e ${RSYNCDIR}/${entry} ]] || mkdir -p "${RSYNCDIR}/${entry}"
rsync -v --delete -aC "${PREFIXTREEDIR}/${entry}"/ "${RSYNCDIR}/${entry}"/
done

# we excluded the eclasses above, because we "overlay" them from gx86
Expand Down Expand Up @@ -230,7 +234,7 @@ START=$(date +%s)
# generate the metadata
echo "($(date +"%F %R")) generating metadata"
dolog() {
echo $*
echo "$*"
"$@"
}
dolog "${PORTAGE_BASE_PATH}/bin/egencache" --update --rsync \
Expand All @@ -247,7 +251,7 @@ sync-type = rsync
sync-uri = rsync://dont-sync
auto-sync = no
' \
${EGENCACHE_OPTS} \
"${EGENCACHE_OPTS[@]}" \
|| exit 5

STOP=$(date +%s)
Expand Down Expand Up @@ -281,8 +285,8 @@ sed -e '/^thin-manifests/s/true/false/' \
# Signing is done with our snapshot signing key, and only on the top
# level Manifest, for it covers indirectly the entire tree
# remember, HOME is set to misc/ so .gnupg keychain lives there
cat "${BASE_PATH}"/autosigner.pwd | \
qmanifest -g -p -s "0xC6317B3C" "${RSYNCDIR}" || \
qmanifest -g -p -s "0xC6317B3C" "${RSYNCDIR}" \
< "${BASE_PATH}"/autosigner.pwd || \
echo "Manifest generation and/or signing failed!" >> /dev/stderr

echo "($(date +"%F %R")) Manifest signed"
Expand Down

0 comments on commit d4ce7ca

Please sign in to comment.