diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-06-03 19:24:30 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-06-03 19:24:42 +0100 |
commit | f91ed532227d3fa8148958aec0fb0629da62112c (patch) | |
tree | dc6faf01b8370637fe726ae1d298fb02494e848d /bin | |
parent | 551b539147808f2ac0a6ab8ae9927b87f461e53a (diff) | |
download | dotfiles-f91ed532227d3fa8148958aec0fb0629da62112c.tar.gz |
insinuate-dotfiles: pass -o to remote tar when root on remote
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/insinuate-dotfiles | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/insinuate-dotfiles b/bin/insinuate-dotfiles index defc30fc..08873455 100755 --- a/bin/insinuate-dotfiles +++ b/bin/insinuate-dotfiles @@ -71,8 +71,10 @@ 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 -rf .git/refs/remotes/local ) +remote_uid="$(ssh "$host" id -u)" +main_opts="$([ "$remote_uid" = 0 ] && echo ozxf || echo zxf)" tar -C"$temp/.." -zcf - "$(basename $temp)" \ - | ssh "$host" 'tar --strip-components=1 -Csrc/dotfiles -zxf -' + | ssh "$host" 'tar --strip-components=1 -Csrc/dotfiles -'$main_opts' -' rm -rf "$temp" # stow dotfiles into $HOME |