summaryrefslogtreecommitdiff
path: root/any-to-ours
diff options
context:
space:
mode:
Diffstat (limited to 'any-to-ours')
-rwxr-xr-xany-to-ours167
1 files changed, 86 insertions, 81 deletions
diff --git a/any-to-ours b/any-to-ours
index a84c368..92d30f9 100755
--- a/any-to-ours
+++ b/any-to-ours
@@ -7,8 +7,7 @@ trap_exit() {
exit 1
}
-platform_name="${platform/\//+}"
-source "$(dirname "$(readlink -e "$0")")/config_${platform_name,,}"
+source "$(dirname "$(readlink -e "$0")")/platforms"
source "$(dirname "$(readlink -e "$0")")/db-libremessages"
# From makepkg
@@ -18,101 +17,107 @@ trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
-# Traverse all Arch repos
-for '_repo' in "${MAIN_REPOS[@]}"; do
- msg "Processing %s..." "${_repo}"
-
- # Find 'any' packages
- # This is hardcoded but it could release other arches...
- PKGS=($(find "${REPO_DIR}/${_repo}/os/${ARCHES[0]}/" \
- -iname '*-any.pkg.tar.?z' \
- -printf "%f "))
-
- if [ ${#PKGS[@]} -eq 0 ]; then
- msg2 "No '%s' packages here" any
- continue
- fi
-
- for '_arch' in "${ARCHES[@]}"; do
- msg2 "Syncing %s..." "${_arch}"
-
- # Sync 'any' only and extract the synced packages
- SYNCED=($(
- rsync -av \
- --include='*-any.pkg.tar.?z' \
- --include='*-any.pkg.tar.?z.sig' \
- --exclude='*' \
- "${REPO_DIR}/${_repo}/os/${ARCHES[0]}/" \
- "${REPO_DIR}/${_repo}/os/${_arch}/" 2>&1 | \
- grep 'any\.pkg\.tar\..z$' | \
- cut -d ' ' -f 1 ))
-
- if [ "${#SYNCED[@]}" -eq 0 ]; then
- msg2 "Already synced (or error happened)"
- continue
- fi
-
- msg2 "Synced %d packages: %s" "${#SYNCED[@]}" "${SYNCED[*]}"
+for 'platform' in "${PLATFORMS[@]}"; do
- msg2 "Adding to db..."
+ source "$(dirname "$(readlink -e "$0")")/config_${platform}"
- pushd "${REPO_DIR}/${_repo}/os/${_arch}/" >/dev/null
+ # Traverse all Arch repos
+ for '_repo' in "${MAIN_REPOS[@]}"; do
+ msg "Processing %s..." "${_repo}"
- # Add the packages to the db
- repo-add "${_repo}${DB_EXT}" "${SYNCED[@]}"
+ # Find 'any' packages
+ # This is hardcoded but it could release other arches...
+ PKGS=($(find "${REPO_DIR}/${_repo}/os/${ARCHES[0]}/" \
+ -iname '*-any.pkg.tar.?z' \
+ -printf "%f "))
- popd >/dev/null
-
- # Avoid mixups
- unset 'SYNCED' 'PKGS'
- done
- if [ -n "${MULTILIB}" ]; then
- for '_repo_multilib' in "${MULTILIB_REPOS[@]}"; do
- msg "Processing %s..." "${_repo}" '(multilib)'
-
- # Find 'any' packages
- # This is hardcoded but it could release other arches...
- PKGS_MULTILIB=($(find "${REPO_DIR}/${_repo_multilib}/os/${MULTILIB[0]}/" \
- -iname '*-any.pkg.tar.?z' \
- -printf "%f "))
-
- if [ ${#PKGS_MULTILIB[@]} -eq 0 ]; then
- msg2 "No '%s' multilib packages here" any
- continue
- fi
+ if [ ${#PKGS[@]} -eq 0 ]; then
+ msg2 "No '%s' packages here" any
+ continue
+ fi
- for '_arch_multilib' in "${MULTILIB[@]}"; do
- msg2 "Syncing %s..." "${_arch_multilib}" '(multilib)'
-
- # Sync 'any' only and extract the synced packages
- SYNCED_MULTILIB=($(
- rsync -av \
- --include='*-any.pkg.tar.?z' \
- --include='*-any.pkg.tar.?z.sig' \
- --exclude='*' \
- "${REPO_DIR}/${_repo_multilib}/os/${MULTILIB[0]}/" \
- "${REPO_DIR}/${_repo_multilib}/os/${_arch_multilib}/" 2>&1 | \
- grep 'any\.pkg\.tar\..z$' | \
- cut -d ' ' -f 1 ))
-
- if [ "${#SYNCED_MULTILIB[@]}" -eq 0 ]; then
+ for '_arch' in "${ARCHES[@]}"; do
+ msg2 "Syncing %s..." "${_arch}"
+
+ # Sync 'any' only and extract the synced packages
+ SYNCED=($(
+ rsync -av \
+ --include='*-any.pkg.tar.?z' \
+ --include='*-any.pkg.tar.?z.sig' \
+ --exclude='*' \
+ "${REPO_DIR}/${_repo}/os/${ARCHES[0]}/" \
+ "${REPO_DIR}/${_repo}/os/${_arch}/" 2>&1 | \
+ grep 'any\.pkg\.tar\..z$' | \
+ cut -d ' ' -f 1 ))
+
+ if [ "${#SYNCED[@]}" -eq 0 ]; then
msg2 "Already synced (or error happened)"
continue
fi
- msg2 "Synced %d packages: %s" "${#SYNCED_MULTILIB[@]}" "${SYNCED_MULTILIB[*]}"
+ msg2 "Synced %d packages: %s" "${#SYNCED[@]}" "${SYNCED[*]}"
- msg2 "Adding Multilib to db..."
+ msg2 "Adding to db..."
- pushd "${REPO_DIR}/${_repo_multilib}/os/${_arch_multilib}/" >/dev/null
+ pushd "${REPO_DIR}/${_repo}/os/${_arch}/" >/dev/null
# Add the packages to the db
- repo-add "${_repo_multilib}${DB_EXT}" "${SYNCED_MULTILIB[@]}"
+ repo-add "${_repo}${DB_EXT}" "${SYNCED[@]}"
popd >/dev/null
# Avoid mixups
- unset 'SYNCED_MULTILIB' 'PKGS_MULTILIB'
+ unset 'SYNCED' 'PKGS'
done
- fi
+ if [ -n "${MULTILIB}" ]; then
+ for '_repo_multilib' in "${MULTILIB_REPOS[@]}"; do
+ msg "Processing %s..." "${_repo}" '(multilib)'
+
+ # Find 'any' packages
+ # This is hardcoded but it could release other arches...
+ PKGS_MULTILIB=($(find "${REPO_DIR}/${_repo_multilib}/os/${MULTILIB[0]}/" \
+ -iname '*-any.pkg.tar.?z' \
+ -printf "%f "))
+
+ if [ ${#PKGS_MULTILIB[@]} -eq 0 ]; then
+ msg2 "No '%s' multilib packages here" any
+ continue
+ fi
+
+ for '_arch_multilib' in "${MULTILIB[@]}"; do
+ msg2 "Syncing %s..." "${_arch_multilib}" '(multilib)'
+
+ # Sync 'any' only and extract the synced packages
+ SYNCED_MULTILIB=($(
+ rsync -av \
+ --include='*-any.pkg.tar.?z' \
+ --include='*-any.pkg.tar.?z.sig' \
+ --exclude='*' \
+ "${REPO_DIR}/${_repo_multilib}/os/${MULTILIB[0]}/" \
+ "${REPO_DIR}/${_repo_multilib}/os/${_arch_multilib}/" 2>&1 | \
+ grep 'any\.pkg\.tar\..z$' | \
+ cut -d ' ' -f 1 ))
+
+ if [ "${#SYNCED_MULTILIB[@]}" -eq 0 ]; then
+ msg2 "Already synced (or error happened)"
+ continue
+ fi
+
+ msg2 "Synced %d packages: %s" "${#SYNCED_MULTILIB[@]}" "${SYNCED_MULTILIB[*]}"
+
+ msg2 "Adding Multilib to db..."
+
+ pushd "${REPO_DIR}/${_repo_multilib}/os/${_arch_multilib}/" >/dev/null
+
+ # Add the packages to the db
+ repo-add "${_repo_multilib}${DB_EXT}" "${SYNCED_MULTILIB[@]}"
+
+ popd >/dev/null
+
+ # Avoid mixups
+ unset 'SYNCED_MULTILIB' 'PKGS_MULTILIB'
+ done
+ done
+ fi
+ done
done