add dotfiles installer

This commit is contained in:
Martinez 2015-12-30 13:10:35 +01:00
parent 5704fafe4d
commit 22ee295fe8
6 changed files with 33 additions and 0 deletions

17
dotfiles/deploy-dotfiles.zsh Executable file
View file

@ -0,0 +1,17 @@
#! /bin/zsh
SRCDIR="$1"
DESTDIR="$2"
pushd "${SRCDIR}"
find . -type d | while read P
do
echo mkdir -p "${DESTDIR}/${P[3,-1]}"
done
find . -type f | while read P
do
P="${P[3,-1]}"
echo cp -bv "${P}" "${DESTDIR}/${P}"
done
popd

View file

@ -15,6 +15,7 @@ EGIT_REPO_URI="https://git.covalent.cz/overwatch/over-prompt.git"
LICENSE="AOJSL"
SLOT="0"
KEYWORDS="x86 amd64"
IUSE="+dotfiles"
src_compile() {
ewarn "This is a prototype written in Python. Expect lower performance."
@ -30,6 +31,19 @@ src_install() {
insinto /usr/share/${PN}/
doins share/zsh-init
if use dotfiles; then
pushd dotfiles
einfo "Installing dotfiles."
zsh deploy-dotfiles.zsh system "${D}"
# install user dotfiles and installer
mkdir "${D}/usr/share/${PN}/dotfiles"
cp -r deploy-dotfiles.zsh user "${D}/usr/share/${PN}/dotfiles"
popd
fi
insopts -m644
insinto /etc/${PN}/
@ -42,4 +56,6 @@ src_install() {
pkg_postinst() {
einfo "Source /usr/share/${PN}/zsh-init to enable the prompt."
einfo "The config file is in /etc/${PN}/."
einfo "User dotfiles have been copied to /usr/share/${PN}/dotfiles."
einfo "You can install them by executing: ./deploy-dotfiles.zsh user ~"
}