From b72653f654882335026d04de5c25ea02c20e8412 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 13 Nov 2012 14:19:36 -0500 Subject: clean up some misc scripts --- src/librerepkg | 73 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 38 deletions(-) (limited to 'src/librerepkg') diff --git a/src/librerepkg b/src/librerepkg index d506003..85c58d9 100755 --- a/src/librerepkg +++ b/src/librerepkg @@ -18,55 +18,52 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf -custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -if [ -x $custom_config ]; then - source $custom_config; - unset $custom_config -fi - -[[ ! -r rePKGBUILD ]] && { - error "This build does not contains a rePKGBUILD." - exit 1 -} +. /etc/libretools.conf +. /etc/makepkg.conf +. /etc/abs.conf -source /etc/makepkg.conf -source /etc/abs.conf -source rePKGBUILD +cmd=${0##*/} usage() { - echo "cd to a dir with a rePKGBUILD and other file info and run" - echo "$0 [makepkg flags]" - echo - echo "This script will repackage an arch package without compiling" + echo "cd to a dir with a rePKGBUILD and other file info and run" + echo "$cmd [makepkg flags]" + echo "" + echo "This script will repackage an arch package without compiling" } -while getopts 'h' arg; do - case $arg in - h) usage; exit 0 ;; - esac -done - -makepkgflags=$@ +main() { + while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac + done + makepkgflags=("$@") -tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX) + if [[ ! -r rePKGBUILD ]]; then + error "This build does not contains a rePKGBUILD." + exit 1 + fi + . rePKGBUILD -msg "Copying files" -cp ./* ${tempdir}/ + tempdir="$(mktemp --tmpdir -d ${PWD##*/}.XXXXX)" -for _arch in ${arch[@]}; do + msg "Copying files" + cp ./* "${tempdir}/" - msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" + for _arch in "${arch[@]}"; do + msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" + stdnull pushd "${tempdir}" - stdnull pushd ${tempdir} + msg2 "Updating md5sums" + makepkg -gp rePKGBUILD >> rePKGBUILD - msg2 "Updating md5sums" - makepkg -gp rePKGBUILD >> rePKGBUILD + echo "export CARCH=${_arch}" >> rePKGBUILD - echo "export CARCH=${_arch}" >> rePKGBUILD + msg "Repackaging using makepkg" + makepkg -Lcdp rePKGBUILD "${makepkgflags[@]}" - msg "Repackaging using makepkg" - makepkg -Lcdp rePKGBUILD ${makepkgflags} + stdnull popd "${tempdir}" + done +} - stdnull popd ${tempdir} -done +main "$@" -- cgit v1.2.3-54-g00ecf