summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Vega Ramos <ovruni@gnu.org.pe>2015-09-26 10:02:23 -0500
committerOmar Vega Ramos <ovruni@gnu.org.pe>2015-09-26 10:02:23 -0500
commit3bc03bbdce0ad13d6db6c2a35ea3a2e7333004b7 (patch)
tree71db6277bc44adcba3172a2634c1df803f209bc8
parentad836d45cc1e29b9671bad0fcfeba99514f746a8 (diff)
Fix Symlink to pool
-rwxr-xr-xdb-sync-arm54
1 files changed, 21 insertions, 33 deletions
diff --git a/db-sync-arm b/db-sync-arm
index fa2589a..853fee4 100755
--- a/db-sync-arm
+++ b/db-sync-arm
@@ -69,6 +69,7 @@ init() {
get_repos
# Traverse all repo-arch pairs
+ local pkgpool
for _arch in "${OURARCHES[@]}"; do
for _repo in "${ARMREPOS[@]}"; do
msg "Processing %s-%s" "${_repo}-${_arch}"
@@ -108,19 +109,21 @@ init() {
msg2 "%d packages in whitelist" "$(wc -l /tmp/${_repo}-${_arch}.whitelist | cut -d' ' -f1)"
+ # Set pkgpool to sync packages
+ if [ "${_repo}" = "community" ]; then
+ pkgpool="pool/community"
+ else
+ pkgpool="pool/packages"
+ fi
+
# Sync excluding everything but whitelist
- # We delete here for cleanup
rsync "${extra[@]}" --no-motd -rtlH \
- --delete-after \
- --delete-excluded \
--delay-updates \
+ --safe-links \
--include-from="/tmp/${_repo}-${_arch}.whitelist" \
--exclude="*" \
"rsync://${mirror}/${mirrorpath}/${_arch}/${_repo}/" \
- "${FTP_BASE}/${_repo}/os/${_arch}/"
-
- # Add a new whitelist
- whitelists+=(/tmp/${_repo}-${_arch}.whitelist)
+ "${FTP_BASE}/${pkgpool}/"
msg "Putting databases back in place"
rsync "${extra[@]}" --no-motd -rtlH \
@@ -129,41 +132,26 @@ init() {
"${WORKDIR}/${_arch}/${_repo}/" \
"${FTP_BASE}/${_repo}/os/${_arch}/"
- # Cleanup
- unset db
- done
- done
+ # Search packages in whitelist to create symlinks
+ sed -i 's/^/\^/' "/tmp/${_repo}-${_arch}.whitelist"
+ ls ${FTP_BASE}/${pkgpool}/ | grep -w -f "/tmp/${_repo}-${_arch}.whitelist" \
+ > "/tmp/${_repo}-${_arch}.pkgwhitelist"
- msg "Syncing package pool"
+ msg "Putting symlinks"
+ while read _pkgfile; do
+ ln -sf "../../../${pkgpool}/${_pkgfile}" "${FTP_BASE}/${_repo}/os/${_arch}"
+ done < "/tmp/${_repo}-${_arch}.pkgwhitelist"
- # Traverse all repo-arch pairs
- local pkgpool
- for _arch in "${OURARCHES[@]}"; do
- for _repo in "${ARMREPOS[@]}"; do
- if [ "${_repo}" = "community" ]; then
- pkgpool="pool/community"
- else
- pkgpool="pool/packages"
- fi
-
- # Sync
- # *Don't delete-after*, this is the job of cleanup scripts. It will remove our
- # packages too
- rsync "${extra[@]}" --no-motd -rtlH \
- --delay-updates \
- --safe-links \
- --include-from="/tmp/${_repo}-${_arch}.whitelist" \
- --exclude="*" \
- "${FTP_BASE}/${_repo}/os/${_arch}/" \
- "${FTP_BASE}/${pkgpool}/"
+ # Cleanup
+ unset db
done
done
date -u +%s > "${FTP_BASE}/lastsync"
# Cleanup
- unset blacklist whitelists _arch _repo repo_file
+ unset blacklist whitelists _arch _repo repo_file _pkgfile
}
trap_exit() {