From 22ee295fe804573711f7684bc5347a20f698b014 Mon Sep 17 00:00:00 2001 From: Martinez Date: Wed, 30 Dec 2015 13:10:35 +0100 Subject: [PATCH] add dotfiles installer --- dotfiles/deploy-dotfiles.zsh | 17 +++++++++++++++++ dotfiles/{ => system}/etc/screeenrc.over | 0 dotfiles/{ => system}/etc/zsh/zprofile | 0 dotfiles/{ => system}/etc/zsh/zshrc | 0 dotfiles/{personal => user}/.ssh/config | 0 ebuild/over-prompt-9999.ebuild | 16 ++++++++++++++++ 6 files changed, 33 insertions(+) create mode 100755 dotfiles/deploy-dotfiles.zsh rename dotfiles/{ => system}/etc/screeenrc.over (100%) rename dotfiles/{ => system}/etc/zsh/zprofile (100%) rename dotfiles/{ => system}/etc/zsh/zshrc (100%) rename dotfiles/{personal => user}/.ssh/config (100%) diff --git a/dotfiles/deploy-dotfiles.zsh b/dotfiles/deploy-dotfiles.zsh new file mode 100755 index 0000000..1906105 --- /dev/null +++ b/dotfiles/deploy-dotfiles.zsh @@ -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 diff --git a/dotfiles/etc/screeenrc.over b/dotfiles/system/etc/screeenrc.over similarity index 100% rename from dotfiles/etc/screeenrc.over rename to dotfiles/system/etc/screeenrc.over diff --git a/dotfiles/etc/zsh/zprofile b/dotfiles/system/etc/zsh/zprofile similarity index 100% rename from dotfiles/etc/zsh/zprofile rename to dotfiles/system/etc/zsh/zprofile diff --git a/dotfiles/etc/zsh/zshrc b/dotfiles/system/etc/zsh/zshrc similarity index 100% rename from dotfiles/etc/zsh/zshrc rename to dotfiles/system/etc/zsh/zshrc diff --git a/dotfiles/personal/.ssh/config b/dotfiles/user/.ssh/config similarity index 100% rename from dotfiles/personal/.ssh/config rename to dotfiles/user/.ssh/config diff --git a/ebuild/over-prompt-9999.ebuild b/ebuild/over-prompt-9999.ebuild index 610bde2..2ba2aff 100644 --- a/ebuild/over-prompt-9999.ebuild +++ b/ebuild/over-prompt-9999.ebuild @@ -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 ~" }