From b3f748e9143fafe7c89a6286c0670d37085c396e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 10 Aug 2005 22:09:19 +0000 Subject: clean up syntax and quoting and such --- ChangeLog | 3 ++- bin/quickpkg | 68 +++++++++++++++++++++++++++++++----------------------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04f6a4d..9937efb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.998 2005/08/10 22:02:34 vapier Exp $ +# $Id: ChangeLog,v 1.999 2005/08/10 22:09:19 vapier Exp $ MAJOR CHANGES in 2.0.51: 1. /var/cache/edb/virtuals is no longer used at all. It's calculated now. @@ -9,6 +9,7 @@ 10 Aug 2005; Mike Frysinger bin/quickpkg: Call gawk instead of awk so non-GNU systems work #102050 by Stephen Bennett. + Also clean up the script a bit. 29 Jul 2005; Mike Frysinger bin/prepallman: Rather than use a hardcoded list and bash expansion, let find locate man diff --git a/bin/quickpkg b/bin/quickpkg index 961128a..7431151 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/quickpkg,v 1.17 2005/08/10 22:02:34 vapier Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/quickpkg,v 1.18 2005/08/10 22:09:19 vapier Exp $ # This script tries to quickly create a Gentoo binary package using the # VDB_PATH/category/pkg/* files @@ -14,8 +14,8 @@ if [ "`whoami`" != "root" ] ; then exit 1 fi -export PORTAGE_DB="$(portageq vdb_path)" -if [ -z $1 ] || [ $1 == "-h" ] || [ $1 == "--help" ] ; then +export PORTAGE_DB=$(portageq vdb_path) +if [ -z "$1" ] || [ $1 == "-h" ] || [ $1 == "--help" ] ; then echo "QUICKPKG ver 1.2" echo "USAGE: quickpkg " echo " a pkg can be of the form:" @@ -34,8 +34,8 @@ if [ -z $1 ] || [ $1 == "-h" ] || [ $1 == "--help" ] ; then exit 1 fi -export PKGDIR="`portageq envvar PKGDIR`" -export PORTAGE_TMPDIR="`portageq envvar PORTAGE_TMPDIR`" +export PKGDIR=$(portageq envvar PKGDIR) +export PORTAGE_TMPDIR=$(portageq envvar PORTAGE_TMPDIR) source /sbin/functions.sh @@ -43,20 +43,20 @@ source /sbin/functions.sh # $1 = package-name w/version # $2 = category do_pkg() { - mkdir -p "${PORTAGE_TMPDIR}/binpkgs" || exit 1 - chmod 0750 "${PORTAGE_TMPDIR}/binpkgs" - MYDIR="${PORTAGE_TMPDIR}/binpkgs/$1" + mkdir -p "${PORTAGE_TMPDIR}/portage-pkg" || exit 1 + chmod 0750 "${PORTAGE_TMPDIR}/portage-pkg" + MYDIR="${PORTAGE_TMPDIR}/portage-pkg/$1" SRCDIR="${PORTAGE_DB}/$2/$1" - LOG="${PORTAGE_TMPDIR}/binpkgs/$1-quickpkglog" + LOG="${PORTAGE_TMPDIR}/portage-pkg/$1-quickpkglog" ebegin "Building package for $1" ( # clean up temp directory - rm -rf ${MYDIR} + rm -rf "${MYDIR}" # get pkg info files - mkdir -p ${MYDIR}/temp - cp ${SRCDIR}/* ${MYDIR}/temp/ + mkdir -p "${MYDIR}"/temp + cp "${SRCDIR}"/* "${MYDIR}"/temp/ # create filelist and a basic tbz2 gawk '{ @@ -67,26 +67,26 @@ do_pkg() { NF=NF-3 print } - }' ${SRCDIR}/CONTENTS | cut -f2- -d" " - > ${MYDIR}/filelist - tar -vjcf ${MYDIR}/bin.tar.bz2 --files-from=${MYDIR}/filelist --no-recursion + }' "${SRCDIR}"/CONTENTS | cut -f2- -d" " - > "${MYDIR}"/filelist + tar vjcf "${MYDIR}"/bin.tar.bz2 --files-from="${MYDIR}"/filelist --no-recursion # join together the basic tbz2 and the pkg info files - xpak ${MYDIR}/temp ${MYDIR}/inf.xpak - tbz2tool join ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/$1.tbz2 + xpak "${MYDIR}"/temp "${MYDIR}"/inf.xpak + tbz2tool join "${MYDIR}"/bin.tar.bz2 "${MYDIR}"/inf.xpak "${MYDIR}"/$1.tbz2 # move the final binary package to PKGDIR - [ -d ${PKGDIR}/All ] || mkdir -p ${PKGDIR}/All - [ -d ${PKGDIR}/$2 ] || mkdir -p ${PKGDIR}/$2 - mv ${MYDIR}/$1.tbz2 ${PKGDIR}/All - ( cd ${PKGDIR}/$2 && ln -s ../All/$1.tbz2 ) + [ -d "${PKGDIR}"/All ] || mkdir -p "${PKGDIR}"/All + [ -d "${PKGDIR}/$2" ] || mkdir -p "${PKGDIR}/$2" + mv "${MYDIR}"/$1.tbz2 "${PKGDIR}"/All + ( cd "${PKGDIR}/$2" && ln -s ../All/$1.tbz2 ) # cleanup again - rm -rf ${MYDIR} - ) >& ${LOG} + rm -rf "${MYDIR}" + ) >& "${LOG}" - if [ -e ${PKGDIR}/All/$1.tbz2 ] ; then - rm -f ${LOG} - PKGSTATS="${PKGSTATS}"$'\n'"$(einfo $1: `ls -alh ${PKGDIR}/All/$1.tbz2 | gawk '{print $5}'`)" + if [ -e "${PKGDIR}/All/$1.tbz2" ] ; then + rm -f "${LOG}" + PKGSTATS="${PKGSTATS}"$'\n'"$(einfo $1: $(du -h "${PKGDIR}/All/$1.tbz2" | gawk '{print $1}'))" eend 0 else cat ${LOG} @@ -101,15 +101,15 @@ export PKGSTATS="" for x in "$@" ; do # they gave us full path - if [ -e ${x}/CONTENTS ] ; then - x="`readlink -f $x`" - pkg="`echo ${x} | cut -d/ -f6`" - cat="`echo ${x} | cut -d/ -f5`" - do_pkg ${pkg} ${cat} + if [ -e "${x}"/CONTENTS ] ; then + x=$(readlink -f $x) + pkg=$(echo ${x} | cut -d/ -f6) + cat=$(echo ${x} | cut -d/ -f5) + do_pkg "${pkg}" "${cat}" # lets figure out what they want else - DIRLIST="`portageq match / ${x}`" + DIRLIST=$(portageq match / "${x}") if [ -z "${DIRLIST}" ] ; then eerror "Could not find anything to match '${x}'; skipping" export PKGERROR="${PKGERROR} ${x}" @@ -117,8 +117,8 @@ for x in "$@" ; do fi for d in ${DIRLIST} ; do - pkg="`echo ${d} | cut -d/ -f2`" - cat="`echo ${d} | cut -d/ -f1`" + pkg=$(echo ${d} | cut -d/ -f2) + cat=$(echo ${d} | cut -d/ -f1) if [ -f "${PORTAGE_DB}/${cat}/${pkg}/CONTENTS" ] ; then do_pkg ${pkg} ${cat} elif [ -d "${PORTAGE_DB}/${cat}/${pkg}" ] ; then @@ -144,3 +144,5 @@ if [ ! -z "${PKGERROR}" ] ; then ewarn "${PKGERROR}" exit 2 fi + +exit 0 -- cgit v1.2.3-65-gdbad