From a3e0b61d4d14f01442b98deaa18f66ceb3c4b3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 8 Jan 2012 15:27:34 -0300 Subject: Use standar naming --- get-repos | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 get-repos (limited to 'get-repos') diff --git a/get-repos b/get-repos new file mode 100755 index 0000000..824ab15 --- /dev/null +++ b/get-repos @@ -0,0 +1,33 @@ +#!/bin/bash +# TODO needs refactoring + +PDIR="/srv/http/web" +DIR="/srv/http/web/repos" + +for arch in i686 x86_64 mips64el; do + for repo in community extra core testing libre libre-testing social; do + [[ ! -d $DIR/$arch ]] && mkdir -p $DIR/$arch + + cd $DIR/$arch + + rm -f *.db.tar.gz + + wget http://repo.parabolagnulinux.org/$repo/os/$arch/$repo.db.tar.gz && \ + $PDIR/manage.py reporead $arch $DIR/$arch/$repo.db.tar.gz + done +done + +for repo in connos connos-extra; do + arch=i586 + [[ ! -d $DIR/$arch ]] && mkdir -p $DIR/$arch + + cd $DIR/$arch + + rm -f *.db.tar.gz + + wget http://www.connochaetos.org/os/$arch/$repo/$repo.db.tar.gz && \ + $PDIR/manage.py reporead $arch $DIR/$arch/$repo.db.tar.gz +done + + +exit 0 -- cgit v1.2.3-2-g168b From 47b0e5207b933e5563324c92c8a1841322cde6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 9 Jan 2012 15:34:13 -0300 Subject: Use config ARCHES and REPOS to get-repos --- get-repos | 71 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 19 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 824ab15..9ff701c 100755 --- a/get-repos +++ b/get-repos @@ -1,33 +1,66 @@ #!/bin/bash -# TODO needs refactoring +# Gets repo databases and updates parabolaweb +# Note: It works remotely because our parabolaweb server and repo server are +# two different hosts -PDIR="/srv/http/web" -DIR="/srv/http/web/repos" +trap_exit() { + echo + error "$@" + exit 1 +} -for arch in i686 x86_64 mips64el; do - for repo in community extra core testing libre libre-testing social; do - [[ ! -d $DIR/$arch ]] && mkdir -p $DIR/$arch +source $(dirname $0)/config +source $(dirname $0)/local_config +source $(dirname $0)/libremessages - cd $DIR/$arch +# From makepkg +set -E - rm -f *.db.tar.gz +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 - wget http://repo.parabolagnulinux.org/$repo/os/$arch/$repo.db.tar.gz && \ - $PDIR/manage.py reporead $arch $DIR/$arch/$repo.db.tar.gz +TMPDIR="$(mktemp -d /tmp/$0.XXXX)" +DBLIST=() + +# Repos +for _repo in ${PKGREPOS[@]}; do + for _arch in ${ARCHES[@]}; do + DBLIST+=("http://repo.parabolagnulinux.org/${_repo}/os/${_arch}/${_repo}${DBEXT}") done done -for repo in connos connos-extra; do - arch=i586 - [[ ! -d $DIR/$arch ]] && mkdir -p $DIR/$arch +# Remote repos +# TODO don't hardcode the remote architecture +# TODO don't hardcode the remote url +# MAYBE run scripts on get-repos.d/ which should return db urls +for _repo in ${RMTREPOS}; do + _arch=i586 + DBLIST+=("http://www.connochaetos.org/os/${_arch}/${_repo}/${_repo}${DBEXT}") +done - cd $DIR/$arch +# Get them all +msg "Retrieving ${#DBLIST[@]} databases" +wget --directory-prefix=${TMPDIR} \ + --no-verbose \ + --force-directories \ + --no-host-directories \ + ${DBLIST[@]} || true +# Always return true, some databases are expect to be missing - rm -f *.db.tar.gz +# Create the arches regexp arch1|arch2 +arch_re="$(echo "(${ARCHES[@]} i586)" | tr ' ' '|')" - wget http://www.connochaetos.org/os/$arch/$repo/$repo.db.tar.gz && \ - $PDIR/manage.py reporead $arch $DIR/$arch/$repo.db.tar.gz -done +msg "Adding to parabolaweb" +find "${TMPDIR}" -iname "*${DBEXT}" | while read _db; do + _arch=$(echo "${_db}" | egrep -o "${arch_re}") + if [ -z "${_arch}" ]; then + error "Can't find database architecture: ${_db}" + continue + fi + + "${WEB_DIR}"/manage.py reporead "${_arch}" "${_db}" +done -exit 0 +exit $? -- cgit v1.2.3-2-g168b From c90a9245b331f43f369b4ef59e67cb2b16c72988 Mon Sep 17 00:00:00 2001 From: Parabola Date: Wed, 15 Feb 2012 20:30:26 +0000 Subject: Use basename --- get-repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 9ff701c..8a96125 100755 --- a/get-repos +++ b/get-repos @@ -20,7 +20,7 @@ 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 -TMPDIR="$(mktemp -d /tmp/$0.XXXX)" +TMPDIR="$(mktemp -d /tmp/$(basename $0).XXXX)" DBLIST=() # Repos -- cgit v1.2.3-2-g168b From 4d3cf060c4a7d2b671d9cdf0ab0f6c1d89a8204b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 28 May 2012 14:03:30 -0300 Subject: Remove TMPDIR --- get-repos | 2 ++ 1 file changed, 2 insertions(+) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 8a96125..86b371c 100755 --- a/get-repos +++ b/get-repos @@ -63,4 +63,6 @@ find "${TMPDIR}" -iname "*${DBEXT}" | while read _db; do "${WEB_DIR}"/manage.py reporead "${_arch}" "${_db}" done +rm -r ${TMPDIR} + exit $? -- cgit v1.2.3-2-g168b From 0d409373d58f1e2ab8a6df6f2123b986aed562a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Tue, 13 Nov 2012 22:35:07 +0100 Subject: get-repos: Don't stop after reporead fails. Issue #220 prevents it from working for some repos. --- get-repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 86b371c..4397d54 100755 --- a/get-repos +++ b/get-repos @@ -60,7 +60,7 @@ find "${TMPDIR}" -iname "*${DBEXT}" | while read _db; do continue fi - "${WEB_DIR}"/manage.py reporead "${_arch}" "${_db}" + "${WEB_DIR}"/manage.py reporead "${_arch}" "${_db}" || true done rm -r ${TMPDIR} -- cgit v1.2.3-2-g168b From 21a1c0b1c74e877209a0a467d2b9fade996cac92 Mon Sep 17 00:00:00 2001 From: Parabola Date: Mon, 19 Aug 2013 16:04:18 -0700 Subject: get-repos: parabolaweb wants *.files.tar.gz files, not *.db.tar.gz --- get-repos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 4397d54..98a39bc 100755 --- a/get-repos +++ b/get-repos @@ -26,7 +26,7 @@ DBLIST=() # Repos for _repo in ${PKGREPOS[@]}; do for _arch in ${ARCHES[@]}; do - DBLIST+=("http://repo.parabolagnulinux.org/${_repo}/os/${_arch}/${_repo}${DBEXT}") + DBLIST+=("http://repo.parabolagnulinux.org/${_repo}/os/${_arch}/${_repo}${FILESEXT}") done done @@ -36,7 +36,7 @@ done # MAYBE run scripts on get-repos.d/ which should return db urls for _repo in ${RMTREPOS}; do _arch=i586 - DBLIST+=("http://www.connochaetos.org/os/${_arch}/${_repo}/${_repo}${DBEXT}") + DBLIST+=("http://www.connochaetos.org/os/${_arch}/${_repo}/${_repo}${FILESEXT}") done # Get them all @@ -52,7 +52,7 @@ wget --directory-prefix=${TMPDIR} \ arch_re="$(echo "(${ARCHES[@]} i586)" | tr ' ' '|')" msg "Adding to parabolaweb" -find "${TMPDIR}" -iname "*${DBEXT}" | while read _db; do +find "${TMPDIR}" -iname "*${FILESEXT}" | while read _db; do _arch=$(echo "${_db}" | egrep -o "${arch_re}") if [ -z "${_arch}" ]; then -- cgit v1.2.3-2-g168b From 8a693d7f3a9324de445b5a151c1f46194405f0eb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 30 Nov 2013 03:17:57 +0000 Subject: Drop remote (connos) repo support --- get-repos | 9 --------- 1 file changed, 9 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 98a39bc..bfc08ff 100755 --- a/get-repos +++ b/get-repos @@ -30,15 +30,6 @@ for _repo in ${PKGREPOS[@]}; do done done -# Remote repos -# TODO don't hardcode the remote architecture -# TODO don't hardcode the remote url -# MAYBE run scripts on get-repos.d/ which should return db urls -for _repo in ${RMTREPOS}; do - _arch=i586 - DBLIST+=("http://www.connochaetos.org/os/${_arch}/${_repo}/${_repo}${FILESEXT}") -done - # Get them all msg "Retrieving ${#DBLIST[@]} databases" wget --directory-prefix=${TMPDIR} \ -- cgit v1.2.3-2-g168b From 6a093f1dc6bd5398115544dd229b520f9432e122 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 15:49:06 -0500 Subject: use `readlink -e` on $0 --- get-repos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index bfc08ff..40d7205 100755 --- a/get-repos +++ b/get-repos @@ -9,9 +9,9 @@ trap_exit() { exit 1 } -source $(dirname $0)/config -source $(dirname $0)/local_config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg set -E -- cgit v1.2.3-2-g168b From 877eaef7357c5ca171e15de16ffce055da68af2f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 16:06:19 -0500 Subject: remove unnecessary loadings of local_config --- get-repos | 1 - 1 file changed, 1 deletion(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 40d7205..2921dd0 100755 --- a/get-repos +++ b/get-repos @@ -10,7 +10,6 @@ trap_exit() { } source "$(dirname "$(readlink -e "$0")")/config" -source "$(dirname "$(readlink -e "$0")")/local_config" source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg -- cgit v1.2.3-2-g168b From baf990333197d42fc25e3220b2bbc97ea03d88a4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 17:09:29 -0500 Subject: get-repos: clean up temp directory handling - rename $TMPDIR to $WORKDIR - respect environmental $TMPDIR - use a trap to clean up,instead of a command at the end --- get-repos | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 2921dd0..5096433 100755 --- a/get-repos +++ b/get-repos @@ -19,7 +19,9 @@ 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 -TMPDIR="$(mktemp -d /tmp/$(basename $0).XXXX)" +WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX") +trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT + DBLIST=() # Repos @@ -31,7 +33,7 @@ done # Get them all msg "Retrieving ${#DBLIST[@]} databases" -wget --directory-prefix=${TMPDIR} \ +wget --directory-prefix=${WORKDIR} \ --no-verbose \ --force-directories \ --no-host-directories \ @@ -42,7 +44,7 @@ wget --directory-prefix=${TMPDIR} \ arch_re="$(echo "(${ARCHES[@]} i586)" | tr ' ' '|')" msg "Adding to parabolaweb" -find "${TMPDIR}" -iname "*${FILESEXT}" | while read _db; do +find "${WORKDIR}" -iname "*${FILESEXT}" | while read _db; do _arch=$(echo "${_db}" | egrep -o "${arch_re}") if [ -z "${_arch}" ]; then @@ -52,7 +54,3 @@ find "${TMPDIR}" -iname "*${FILESEXT}" | while read _db; do "${WEB_DIR}"/manage.py reporead "${_arch}" "${_db}" || true done - -rm -r ${TMPDIR} - -exit $? -- cgit v1.2.3-2-g168b From 39fbf0d8d3cdc666912c597d41d5b6a70fc0c725 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 20:53:38 -0500 Subject: Fix some array quoting. --- get-repos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'get-repos') diff --git a/get-repos b/get-repos index 5096433..b8d2ccb 100755 --- a/get-repos +++ b/get-repos @@ -25,8 +25,8 @@ trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT DBLIST=() # Repos -for _repo in ${PKGREPOS[@]}; do - for _arch in ${ARCHES[@]}; do +for _repo in "${PKGREPOS[@]}"; do + for _arch in "${ARCHES[@]}"; do DBLIST+=("http://repo.parabolagnulinux.org/${_repo}/os/${_arch}/${_repo}${FILESEXT}") done done @@ -37,7 +37,7 @@ wget --directory-prefix=${WORKDIR} \ --no-verbose \ --force-directories \ --no-host-directories \ - ${DBLIST[@]} || true + "${DBLIST[@]}" || true # Always return true, some databases are expect to be missing # Create the arches regexp arch1|arch2 -- cgit v1.2.3-2-g168b