Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=923599352f37b267f3bf67b0bbf60c96bd16820e
commit 923599352f37b267f3bf67b0bbf60c96bd16820e Author: Michel Hermier <herm...@frugalware.org> Date: Fri Nov 1 17:15:06 2013 +0100 makepkg: Add dummy chroot command to enter the a build chroot and perform commands in it. diff --git a/scripts/makepkg b/scripts/makepkg index df0d0c0..3b50d3f 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -318,9 +318,63 @@ handledeps() { declare -Ag _makepkg_commands -makepkg_lschroot_usage() { - $ECHO "makepkg" +makepkg_chroot_usage() { + $ECHO "Usage: $0 chroot [OPTION]... CHROOTNAME [COMMAND [ARG]...]" + $ECHO "Performs command on chroots." + $ECHO + $ECHO "Command can be any of the following:" + for i in "${!_makepkg_chroot_commands[@]}"; do + $ECHO " - $i" + done $ECHO + $ECHO "Options for chroot_enter command:" + $ECHO " -h, --help This help" + $ECHO + $ECHO "If no command is given, run '${SHELL} -i' (default: '/bin/sh -i')." +} + +makepkg_chroot() { + local _options_consumed + + while [ $# -gt 0 ]; do + _options_consumed=1 + case "$1" in + -h|--help) + makepkg_chroot_usage + return 0;; + # special options + --) shift; break ;; # End of options + --*|-?) error "Invalid option: $1" + makepkg_chroot_usage + return 1 ;; + -*) # Combined short options + split="$1" + shift + set -- \ + "$(echo "$split}" | cut -c -2)" \ + "-$(echo "${split}" | cut -c 3-)" \ + "$@" + continue ;; + *=*) export "$1" ;; + *) break ;; # End of options + esac + if ! shift "$_options_consumed"; then + _options_consumed=$(($_options_consumed - 1)) + error "Option $1 expects $_options_consumed argument(s)" + return 1 + fi + done + + if [ $# -eq 0 ]; then + error "Missing expected CHROOTNAME argument." + return 1 + fi + chroot "$CHROOTDIR/$1" "${@:2}" + return $? +} +_makepkg_commands[chroot]=makepkg_chroot + +makepkg_lschroot_usage() { $ECHO "Usage: $0 lschroot [OPTION]..." $ECHO "List all the available chroots." $ECHO _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git