You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
#
|
|
# $Header: browser-home-profile/functions/bhp Exp $
|
|
# $Aythor: (c) 2012-2015 -tclover <tokiclover@gmail.com> 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:
|
|
#
|