summaryrefslogtreecommitdiff
path: root/bin/insinuate-dotfiles
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-04-22 13:12:18 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-04-22 13:12:18 -0700
commitcb92043b165afb121225802cb997c460ef133861 (patch)
tree8da909a820255378d4fa3db25f9bdc4c816a718d /bin/insinuate-dotfiles
parentd53056bd328179f57dbddd4e7a34f2ef824c09c2 (diff)
downloaddotfiles-cb92043b165afb121225802cb997c460ef133861.tar.gz
switch back Rexfile -> insinuate-dotfiles for the time being
Diffstat (limited to 'bin/insinuate-dotfiles')
-rwxr-xr-xbin/insinuate-dotfiles55
1 files changed, 55 insertions, 0 deletions
diff --git a/bin/insinuate-dotfiles b/bin/insinuate-dotfiles
new file mode 100755
index 00000000..e6a0947f
--- /dev/null
+++ b/bin/insinuate-dotfiles
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# insinuate-dotfiles -- try to get my dotfiles onto a host, securely
+
+# Copyright (C) 2017-2019 Sean Whitton
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+# Intended for machines on which I don't have root -- otherwise I'd
+# just use propellor. Possible additional functionality would be to
+# do an update of what's already there, but this will be much slower
+# over sshfs than the following, which should copy files in just one
+# direction
+
+set -e
+
+. $HOME/.shenv
+
+# assume connection sharing is set up in ~/.ssh/config
+ssh -fN "$1"
+
+if ssh "$1" "test -d src/dotfiles"; then
+ echo >&2 "src/dotfiles exists"
+ exit 1
+fi
+ssh "$1" "mkdir -p src/dotfiles"
+
+temp="$(mktemp -d -p $HOME/tmp insinuate.XXX)"
+git clone --no-hardlinks --depth 1 -o local -b master \
+ "file://$HOME/src/dotfiles" "$temp"
+( cd "$temp" && git remote rm local && rm -r .git/refs/remotes/local )
+tar -C"$temp/.." -zcf - "$(basename $temp)" \
+ | ssh "$1" 'tar --strip-components=1 -Csrc/dotfiles -zxf -'
+rm -rf "$temp"
+
+# copy my gpg key over there so I can use `mr up` to update dotfiles
+if ssh "$1" which gpg >/dev/null; then
+ gpg --export-options export-minimal --export spwhitton@spwhitton.name \
+ | ssh "$1" gpg --import
+fi
+# stow dotfiles into $HOME
+ssh "$1" 'sh src/dotfiles/bin/bstraph.sh'