1
0
Fork 0

firefox-home-profile/fhp: Added cache-directory support

pull/890/head
tokiclover 10 years ago
parent f3081c8a40
commit f0cfb685ff

@ -2,10 +2,10 @@
# firefox home profile (fhp) module to maintain the profile
# in a tmpfs or zram backed filesystem
#
# $Header: firefox-profile/functions/fhp Exp $
# $Aythor: (c) 2011-2014 -tclover <tokiclover@gmail.com> Exp $
# $Header: firefox-home-profile/functions/fhp Exp $
# $Aythor: (c) 2012-2015 -tclover <tokiclover@gmail.com> Exp $
# $License: MIT (or 2-clause/new/simplified BSD) Exp $
# $Version: 3.0 2014/09/30 Exp $
# $Version: 4.0 2015/05/05 Exp $
#
function die {
@ -15,45 +15,36 @@ function die {
return $ret
}
local compressor profile
zstyle -s ':prezto:module:firefox-profile' profile 'profile'
zstyle -s ':prezto:module:firefox-profile' compressor 'compressor'
local dir compressor profile tarball
zstyle -s ':prezto:module:FHP' profile 'profile'
zstyle -s ':prezto:module:FHP' compressor 'compressor'
local ext=.tar.$compressor[(w)1]
pushd -q "$HOME"/.mozilla/firefox || return
for dir ("$HOME"/.{,cache/}mozilla/firefox) {
pushd -q "$dir" || continue
if [[ -f $profile/.unpacked ]] {
if [[ -f $profile$ext ]] {
mv -f $profile{,.old}$ext
if (( $? )) {
die "failed to override the old tarball"
return
}
mv -f $profile{,.old}$ext ||
{ die "Failed to override the old tarball"; continue; }
}
tar -X $profile/.unpacked -Ocp $profile | $=compressor $profile$ext
(( $? )) && die "failed to repack a new tarball"
tar -X $profile/.unpacked -Ocp $profile | $=compressor $profile$ext ||
die "Failed to repack a new tarball"
popd -q
return
}
} else {
compressor=$compressor[(w)1]
if [[ -f $profile$ext ]] {
local tarball=$profile$ext
tarball=$profile$ext
} elif [[ -f $profile.old$ext ]] {
local tarball=$profile.old$ext
tarball=$profile.old$ext
} else {
die "no tarball found"
return
die "No tarball found"
continue
}
$compressor -cd $tarball | tar -xp && touch $profile/.unpacked
(( $? )) && die "failed to unpack the profile"
$compressor -cd $tarball | tar -xp && touch $profile/.unpacked ||
die "Failed to unpack profile tarball"
popd -q
}
}
#
# vim:fenc=utf-8:ft=zsh:ci:pi:sts=2:sw=2:ts=2:

Loading…
Cancel
Save