From 3537841a9287ea1c7871545ffebb855561f7c1e0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:17:35 -0500 Subject: misc touch up - TODO: add trailing newline - config: add text editor hint - config.orig: remove - getrepos: quote, use -- - db-functions: hardcode some paths, remove needless nullglob --- TODO | 2 +- config | 2 +- config.orig | 54 ------------------------------------------------------ createrepos | 2 +- db-functions | 21 ++++++++------------- 5 files changed, 11 insertions(+), 70 deletions(-) delete mode 100644 config.orig diff --git a/TODO b/TODO index 3219b1c..9dd4b52 100644 --- a/TODO +++ b/TODO @@ -7,4 +7,4 @@ * Fix db-move - - Make it use abslibre \ No newline at end of file + - Make it use abslibre diff --git a/config b/config index 8b8117f..0152b69 100644 --- a/config +++ b/config @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # as a hint to text editors FTP_BASE="/srv/http/repo/public" ARCH_BASE="/srv/http/repo/public" SVNREPO="/var/abs" diff --git a/config.orig b/config.orig deleted file mode 100644 index a32f82f..0000000 --- a/config.orig +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -<<<<<<< HEAD -FTP_BASE="/srv/http/repo/public" -ARCH_BASE="/srv/http/repo/public" -SVNREPO="/srv/http/repo/abslibre" -======= -FTP_BASE="/srv/http/repo/public/temprepo" -ARCH_BASE="/srv/http/repo/public/temprepo" -SVNREPO="/var/abs" ->>>>>>> 801ea2c927ace5ee892209dd8e3c1044e1b3842e - -# Repos from Arch -ARCHREPOS=('core' 'testing') #'extra' 'community' 'testing' 'multilib') -# Official Parabola repos -OURREPOS=('libre' 'libre-testing') -# User repos -USERREPOS=('~fauno' '~smv' '~xihh' '~mtjm' '~brendan') -# Community project repos -PROJREPOS=('social' 'elementary' 'kernels' 'radio' 'security' 'sugar') -PKGREPOS=(${ARCHREPOS[@]} ${OURREPOS[@]} ${USERREPOS[@]} ${PROJREPOS[@]}) -PKGPOOL='pool/packages' -SRCPOOL='sources/packages' - -CLEANUP_DESTDIR="$FTP_BASE/old/packages" -CLEANUP_DRYRUN=true -# Time in days to keep moved packages -CLEANUP_KEEP=30 - -SOURCE_CLEANUP_DESTDIR="$FTP_BASE/old/sources" -SOURCE_CLEANUP_DRYRUN=true -# Time in days to keep moved sourcepackages -SOURCE_CLEANUP_KEEP=30 - -REQUIRE_SIGNATURE=true - -LOCK_DELAY=10 -LOCK_TIMEOUT=300 - -STAGING="$FTP_BASE/staging" -TMPDIR="/tmp" -ARCHARCHES=(i686 x86_64) -OURARCHES=(mips64el) -ARCHES=(${ARCHARCHES[@]} ${OURARCHES[@]}) -DBEXT=".db.tar.gz" -FILESEXT=".files.tar.gz" -PKGEXT=".pkg.tar.?z" -SRCEXT=".src.tar.gz" - -<<<<<<< HEAD -MAKEPKGCONF="~/.makepkg.conf" -======= -MAKEPKGCONF="/etc/makepkg.conf" ->>>>>>> 801ea2c927ace5ee892209dd8e3c1044e1b3842e -BLACKLIST_FILE="$HOME/blacklist/blacklist.txt" diff --git a/createrepos b/createrepos index 4ee057b..926c158 100755 --- a/createrepos +++ b/createrepos @@ -3,6 +3,6 @@ source $(dirname $0)/config -mkdir -p ${FTP_BASE}/{${PKGPOOL},${SRCPOOL}} ${ARCH_BASE} ${CLEANUP_DESTDIR} ${SOURCE_CLEANUP_DESTDIR} ${STAGING} +mkdir -p -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${ARCH_BASE}" "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" $(dirname $0)/create-repo ${PKGREPOS[@]} diff --git a/db-functions b/db-functions index 4c247a7..458a370 100644 --- a/db-functions +++ b/db-functions @@ -87,7 +87,7 @@ get_full_version() { script_lock() { local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - local _owner="$(stat -c %U $LOCKDIR)" + local _owner="$(/usr/bin/stat -c %U $LOCKDIR)" error "Script $(basename $0) is already locked by $_owner." exit 1 else @@ -178,7 +178,7 @@ repo_lock () { _count=0 while [ $_count -le $_trial ] || $_lockblock ; do if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - _owner="$(stat -c %U $LOCKDIR)" + _owner="$(/usr/bin/stat -c %U $LOCKDIR)" warning "Repo [${1}] (${2}) is already locked by $_owner. " msg2 "Retrying in $LOCK_DELAY seconds..." else @@ -211,7 +211,7 @@ repo_unlock () { #repo_unlock _grep_pkginfo() { local _ret - _ret="$(bsdtar -xOqf "$1" .PKGINFO | grep -m 1 "^${2} = ")" + _ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | grep -m 1 "^${2} = ")" echo "${_ret#${2} = }" } @@ -293,9 +293,6 @@ getpkgfile() { } getpkgfiles() { -# Ignore anything that doesn't glob to PKGEXT - shopt -s nullglob - local f if [ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]; then error 'Duplicate packages found!' @@ -313,8 +310,6 @@ getpkgfiles() { done echo ${@} - - shopt -u nullglob } check_pkgfile() { @@ -485,7 +480,7 @@ set_repo_permission() { local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}" if [ -w "${dbfile}" ]; then - local group=$(stat --printf='%G' "$(dirname "${dbfile}")") + local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") chgrp $group "${dbfile}" || error "Could not change group of ${dbfile} to $group" chgrp $group "${filesfile}" || error "Could not change group of ${filesfile} to $group" chmod g+w "${dbfile}" || error "Could not set write permission for group $group to ${dbfile}" @@ -502,9 +497,9 @@ arch_repo_add() { # package files might be relative to repo dir pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null - repo-add -q "${repo}${DBEXT}" ${pkgs[@]} >/dev/null \ + /usr/bin/repo-add -q "${repo}${DBEXT}" ${pkgs[@]} >/dev/null \ || error "repo-add ${repo}${DBEXT} ${pkgs[@]}" - repo-add -f -q "${repo}${FILESEXT}" ${pkgs[@]} \ + /usr/bin/repo-add -f -q "${repo}${FILESEXT}" ${pkgs[@]} \ || error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -521,9 +516,9 @@ arch_repo_remove() { error "No database found at '${dbfile}'" return 1 fi - repo-remove -q "${dbfile}" ${pkgs[@]} >/dev/null \ + /usr/bin/repo-remove -q "${dbfile}" ${pkgs[@]} >/dev/null \ || error "repo-remove ${dbfile} ${pkgs[@]}" - repo-remove -q "${filesfile}" ${pkgs[@]} \ + /usr/bin/repo-remove -q "${filesfile}" ${pkgs[@]} \ || error "repo-remove ${filesfile} ${pkgs[@]}" set_repo_permission "${repo}" "${arch}" } -- cgit v1.2.3