# # $Header: browser-home-profile/functions/bhp Exp $ # $Aythor: (c) 2012-2015 -tclover Exp $ # $License: MIT (or 2-clause/new/simplified BSD) Exp $ # $Version: 1.0 2015/05/14 Exp $ # function bhp { local PROFILE ext name=bhp profile tarball zstyle -s ':prezto:module:BHP' PROFILE 'PROFILE' zstyle -s ':prezto:module:BHP' compressor 'compressor' ext=.tar.${compressor[(w)1]} profile=${PROFILE:t} for dir (${HOME}/.${PROFILE} ${HOME}/.cache/${PROFILE#config/}) { [[ -d ${dir} ]] || continue pr-begin "Setting up tarball..." pushd -q ${dir:h} || continue if [[ -f ${profile}/.unpacked ]]; then if [[ -f ${profile}${ext} ]] { mv -f ${profile}${ext} ${profile}.old${ext} || { pr-end 1 Moving; continue; } } tar -X ${profile}/.unpacked -Ocp ${profile} | \ ${=compressor} ${profile}${ext} || { pr-end 1 Packing; continue; } else if [[ -f ${profile}${ext} ]]; then tarball=${profile}${ext} elif [[ -f ${profile}.old${ext} ]]; then tarball=${profile}.old${ext} else pr-warn "No tarball found."; continue fi ${compressor[(w)1]} -cd ${tarball} | tar -xp && touch ${profile}/.unpacked || { pr-end 1 Unpacking; continue; } fi popd -q pr-end ${?} } } # # vim:fenc=utf-8:ft=zsh:ci:pi:sts=2:sw=2:ts=2: #