From fe0d876c4930180e6604b754cb8287ae042127da Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Thu, 12 May 2011 14:42:34 -0500 Subject: stdnull needs quotes --- aur | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'aur') diff --git a/aur b/aur index e300dd1..38b2e2e 100755 --- a/aur +++ b/aur @@ -14,7 +14,7 @@ for _pkg in ${@}; do continue } - stdnull pushd $_pkg + stdnull "pushd $_pkg" source PKGBUILD -- cgit v1.2.3-54-g00ecf From 92d1fe72f7ec9deea70772aa41ec1e29072599c8 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Thu, 12 May 2011 14:54:49 -0500 Subject: little fix --- aur | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'aur') diff --git a/aur b/aur index 38b2e2e..44ac650 100755 --- a/aur +++ b/aur @@ -19,13 +19,15 @@ for _pkg in ${@}; do source PKGBUILD pkgbuild-check-nonfree || { - warning "This PKGBUILD links to known unfree packages" + if [ $? -eq 15 ]; then + warning "This PKGBUILD links to known unfree packages" + fi } msg2 "Checking license..." free=0 for _license in ${license[@]}; do - if ! -d /usr/share/licenses/common/$_license; then + if [ ! -d /usr/share/licenses/common/$_license ]; then warning "License $_license is not a common license" free=1 fi -- cgit v1.2.3-54-g00ecf From 7f118f53283d7e228c40a40076815ce94ebb94a7 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Mon, 16 May 2011 00:44:39 -0500 Subject: Cleaned up some things, added option parse to some scripts. --- aur | 14 ++++++++++++++ createworkdir | 12 +----------- librechroot | 39 ++++++++++++++++++++++++++------------- libremakepkg | 40 ++++++++++++++++++++++------------------ librerelease | 56 +++++++++++++++++++++++++++++++++++++++++++------------- librerepkg | 10 +++++++++- 6 files changed, 115 insertions(+), 56 deletions(-) (limited to 'aur') diff --git a/aur b/aur index 44ac650..b7ad018 100755 --- a/aur +++ b/aur @@ -3,6 +3,20 @@ source /etc/libretools.conf source /etc/abs.conf +function usage { + echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]" + echo + echo "This script will download packages from aur to the current dir" + echo "and check their license for nonfree issues." +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + missing_deps=() for _pkg in ${@}; do msg "Downloading $_pkg..." diff --git a/createworkdir b/createworkdir index 8680215..a28d198 100755 --- a/createworkdir +++ b/createworkdir @@ -47,8 +47,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf } -# Create the staging and repo dirs -_repodir=${WORKDIR}/repos +# Create the staging dirs for _repo in ${REPOS[@]}; do [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || { @@ -56,15 +55,6 @@ for _repo in ${REPOS[@]}; do exit 1 } } - - for _arch in ${ARCHES[@]}; do - [[ ! -d ${_repodir}/${_repo}/${_arch} ]] && { - stdnull "mkdir -p ${_repodir}/${_repo}/${_arch}" || { - error "Can't create ${_repodir}/${_repo}/${_arch}" - exit 1 - } - } - done done msg "Finished, your packaging dir tree looks like this now:" diff --git a/librechroot b/librechroot index ec437de..b308b7d 100755 --- a/librechroot +++ b/librechroot @@ -23,6 +23,19 @@ source /etc/libretools.conf +function usage { + echo "Usage: $0 chrootname" + echo "Change to a chroot in $CHROOTDIR. Use it as root." + echo + echo "Default chroot name: $CHCOPY" +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac +done + [[ "$UID" != "0" ]] && { error "This script must be run as root." exit 1 @@ -32,28 +45,28 @@ custom_config=${XDG_CONFIG_HOME}/libretools/libretools.conf [[ -e ${custom_config} ]] && source ${custom_config} # Enter the chroot copy by default -root=${1:-$CHCOPY} +chrootname=${1:-$CHCOPY} CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg} -[[ ! -d ${CHROOTDIR}/${root} ]] && { - error "${CHROOTDIR}/$root is not a dir." +[[ ! -d ${CHROOTDIR}/${chrootname} ]] && { + error "${CHROOTDIR}/${chrootname} is not a dir." exit 1 } -mount -t proc proc ${CHROOTDIR}/${root}/proc/ -mount -t sysfs sys ${CHROOTDIR}/${root}/sys/ -mount -o bind /dev ${CHROOTDIR}/${root}/dev/ +mount -t proc proc ${CHROOTDIR}/${chrootname}/proc/ +mount -t sysfs sys ${CHROOTDIR}/${chrootname}/sys/ +mount -o bind /dev ${CHROOTDIR}/${chrootname}/dev/ # Share pacman cache -mount -o bind ${CACHEDIR} ${CHROOTDIR}/${root}/var/cache/pacman/pkg +mount -o bind ${CACHEDIR} ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg -cp -L /etc/resolv.conf ${CHROOTDIR}/${root}/etc/resolv.conf +cp -L /etc/resolv.conf ${CHROOTDIR}/${chrootname}/etc/resolv.conf -chroot ${CHROOTDIR}/${root} /bin/bash +chroot ${CHROOTDIR}/${chrootname} /bin/bash -umount ${CHROOTDIR}/${root}/proc/ -umount ${CHROOTDIR}/${root}/sys/ -umount ${CHROOTDIR}/${root}/dev/ -umount ${CHROOTDIR}/${root}/var/cache/pacman/pkg +umount ${CHROOTDIR}/${chrootname}/proc/ +umount ${CHROOTDIR}/${chrootname}/sys/ +umount ${CHROOTDIR}/${chrootname}/dev/ +umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg exit 0 diff --git a/libremakepkg b/libremakepkg index f2b523d..272e61d 100755 --- a/libremakepkg +++ b/libremakepkg @@ -21,47 +21,50 @@ source /etc/libretools.conf -if [ $UID -ne 0 ]; then - error "This script must be run as root" - exit 1 -fi - -usage() { +function usage { echo "cd to a dir containing a PKGBUILD and run:" echo "$0 [options] [makepkg args]" + echo "This script will build your package on a chroot." echo echo "OPTIONS:" echo - echo " -h : show this message" - echo " -c : cleans CHCOPY and cachedir" - echo " -u : updates before building" - echo " -n chrootname : use this dir instead of CHCOPY" + echo " -h : show this message." + echo " -c : cleans CHCOPY and cachedir." + echo " -u : updates before building." + echo " -n : use this dir instead of CHCOPY." + echo " -I pkgname : install this package, use it as many times needed." + echo } -CLEAN="" +_CLEAN="" CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} - -while getopts 'hcun:' arg; do +_PKGINSTALL="" +while getopts 'hcun:I:' arg; do case "${arg}" in h) usage; exit 0 ;; - c) CLEAN="-c" ;; + c) _CLEAN="-c" ;; u) update_first="y" ;; n) chrootname="$OPTARG"; echo $chrootname ;; - *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + I) _PKGINSTALL+="-I $OPTARG " ;; + *) _MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac done +if [ $UID -ne 0 ]; then + error "This script must be run as root" + exit 1 +fi + msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 - exit $? fi - } + if [ $update_first = y ]; then msg "Updating the main chroot" # -c option in mkarchroot indicates cache @@ -70,6 +73,7 @@ fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l "${chrootname}" -- $MAKEPKG_ARGS +makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL \ + -- $_MAKEPKG_ARGS exit 0 diff --git a/librerelease b/librerelease index 39d3e2d..2359de8 100755 --- a/librerelease +++ b/librerelease @@ -24,29 +24,59 @@ source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -usage () { - printf "$(gettext "Usage: %s")" "$0" +function usage { + echo "$(gettext "Usage: $0")" echo - printf "$(gettext "This script")" + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean $WORKDIR/staging.")" +} + +function list_packages { + find $WORKDIR/staging/ -type f -print0 +} + +function clean_non_packages { + find $WORKDIR/staging/ -type -f \! -iname "*.pkg.tar.*" -delete } +function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +} + +while getopts 'hl' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean_packages; exit $? ;; + esac +done + [[ -e $custom_config ]] && source $custom_config [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" +clean_non_packages msg "Uploading packages..." rsync --recursive \ - --copy-links \ - --hard-links \ - --partial \ - --prune-empty-dirs \ - --human-readable \ - --progress \ - -e "ssh " \ - ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1 + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 +} msg "Removing packages from local [staging]" -find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +clean_packages exit 0 diff --git a/librerepkg b/librerepkg index 0a38e00..79a3e1d 100755 --- a/librerepkg +++ b/librerepkg @@ -36,9 +36,17 @@ source rePKGBUILD usage() { echo "cd to a dir with a rePKGBUILD and other file info and run" - echo $0 + echo "$0 " + 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 + stdnull "tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)" msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" -- cgit v1.2.3-54-g00ecf