diff options
-rw-r--r-- | .zshrc | 139 |
1 files changed, 0 insertions, 139 deletions
@@ -368,145 +368,6 @@ ii() { } -# functions for building chroots -__CHROOTS="/mnt/chroots/arch" - -__genchroot() { - sudo btrfs subvolume snapshot "$chrootdir/root" "$copydir" -} - -__chrootalias() { - chroot="" - chroot_arch="" - case $1 in - 32*) - chroot_arch=32 - case $1 in - 32) chroot=extra-i686;; - 32t) chroot=testing-i686;; - 32s) chroot=staging-i686;; - esac - ;; - 64*) - chroot_arch=64; - case $1 in - 64) chroot=extra-x86_64;; - 64t) chroot=testing-x86_64;; - 64s) chroot=staging-x86_64;; - 64ml) chroot=multilib-x86_64;; - 64mlt) chroot=multilib-testing-x86_64;; - 64mls) chroot=multilib-staging-x86_64;; - esac - ;; - *) - chroot=$1 - case $1 in - *-i686) chroot_arch=32;; - *-x86_64|multilib*) chroot_arch=64;; - esac - esac - - if [[ -z $chroot || -z $chroot_arch ]]; then - echo "failed to determine chroot for \"$1\"" - return 1 - fi - - # create chroot if necessary - if [[ ! -d "$__CHROOTS/$chroot/root" ]]; then - case $chroot in - multilib*) chroot_cmd=${chroot%%-x86_64};; - *) chroot_cmd=$chroot;; - esac - ( - unfunction chpwd - cd /var/empty - sudo ${chroot_cmd}-build -r "$__CHROOTS" || true - ) - fi - -} - -chcreate() { - for i in $@; do - __chrootalias $i || return - done -} - -chkill() { - if [[ $1 = all ]]; then - for chrootdir in "$__CHROOTS/"*(/); do - chkill "$(basename "$chrootdir")" - done - return - fi - __chrootalias $1 || return - for dir in "$__CHROOTS/$chroot/"*(/); do - sudo btrfs subvolume delete $dir - done - sudo rm -rf $__CHROOTS/$chroot -} - -chshell() { - __chrootalias $1 || return - chrootdir="$__CHROOTS/$chroot" - copydir="$chrootdir/$USER" - [ -d "$copydir" ] || __genchroot - linux${chroot_arch} sudo mkarchroot -r ${2:-/bin/bash} "$copydir" -} - -chbuild() { - for i; do - __chrootalias $i || return - chrootdir="$__CHROOTS/$chroot" - linux${chroot_arch} sudo makechrootpkg -r "$chrootdir" -n -- -f - chshell $i "pacman --noconfirm -Rcs namcap" - [[ -e namcap.log ]] && cat namcap.log - done -} - -chinstall() { - __chrootalias $1 || return; shift - chrootdir="$__CHROOTS/$chroot" - linux${chroot_arch} sudo makechrootpkg -r "$chrootdir" -I "$@" -} - -chclean() { - if [[ $# = 0 ]]; then - for chrootdir in "$__CHROOTS/"*(/); do - chclean "$(basename "$chrootdir")" - done - else - __chrootalias $1 || return - chrootdir="$__CHROOTS/$chroot" - copydir="$chrootdir/$USER" - [[ -d "$copydir" ]] && sudo btrfs subvolume delete "$copydir" - fi - return 0 -} - -chrshell() { - __chrootalias $1 || return - chrootdir="$__CHROOTS/$chroot" - linux${chroot_arch} sudo mkarchroot -r ${2:-bash} "$chrootdir/root" -} - -chupdate() { - if [[ $# = 0 ]]; then - for chrootdir in "$__CHROOTS/"*(/); do - chupdate "$(basename "$chrootdir")" - done - else - for id in "$@"; do - __chrootalias $id || return - chrootdir="$__CHROOTS/$chroot" - echo ":: Updating $chroot" - linux${chroot_arch} sudo mkarchroot -u "$chrootdir/root" -- --noconfirm - echo ":: Cleaning up ..." - chclean $id - done - fi -} - hgrep() { mpgrep <$HISTFILE "$@" | less } |