From a112829b0ed4898bc4bcbe78e2e335f299c1bd88 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 20 Apr 2023 00:04:25 +0400 Subject: [PATCH] Add sync script --- sync | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 sync diff --git a/sync b/sync new file mode 100755 index 0000000..ec589f7 --- /dev/null +++ b/sync @@ -0,0 +1,43 @@ +#!/bin/sh + +# usage: +# +# sudo ./sync +# sudo ./sync gentoo + +set -eu + +REPO="$(dirname "$(realpath "$0")")" + +PREFIX="${1:-''}" + +sync() { + prefix="$1" + path="$2" + + if [ -f "$path" ]; then + echo cp "$path" "$REPO/$prefix$path" + cp "$path" "$REPO/$prefix$path" + else + echo "Not found: $path" + fi +} + +sync common '/etc/tmux.conf' +sync common '/etc/vim/vimrc.local' +sync common '/etc/fish/config.fish' +sync common '/etc/fish/conf.d/rvm.fish' +sync common '/etc/fish/functions/fish_prompt.fish' +sync common '/etc/fish/functions/prompt_user_host.fish' +sync common '/etc/fish/functions/rvm.fish' + +if [ "$PREFIX" = 'gentoo' ]; then +echo +sync gentoo '/var/lib/portage/world' +sync gentoo '/etc/portage/make.conf' +sync gentoo '/etc/portage/package.license' +sync gentoo '/etc/portage/package.accept_keywords/package.accept_keywords' +sync gentoo '/etc/portage/package.mask/toolchains' +sync gentoo '/etc/portage/package.use/toolchains' +sync gentoo '/etc/portage/package.use/zz-autounmask' +fi