summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2025-02-08 08:16:07 +0100
committerMike Vink <mike@pionative.com>2025-02-08 08:16:07 +0100
commit7d30d2272ef59166c1b382cab324a400a42d577d (patch)
tree8f153f04818c7622b9cd2a3e1a18f9dcce1a1104 /.local
parentfd48011d2ef530b392df72e8685da4e8a2a54d1d (diff)
copy config
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/putdotfiles4
-rwxr-xr-x.local/bin/putgitrepo13
2 files changed, 17 insertions, 0 deletions
diff --git a/.local/bin/putdotfiles b/.local/bin/putdotfiles
new file mode 100755
index 0000000..d75599a
--- /dev/null
+++ b/.local/bin/putdotfiles
@@ -0,0 +1,4 @@
+#!/bin/sh
+putgitrepo \
+ git@github.com:ivi-vink/dotfiles.git \
+ /home/$USER
diff --git a/.local/bin/putgitrepo b/.local/bin/putgitrepo
new file mode 100755
index 0000000..ac91bb7
--- /dev/null
+++ b/.local/bin/putgitrepo
@@ -0,0 +1,13 @@
+#!/bin/sh
+putgitrepo() {
+ # Downloads a gitrepo $1 and places the files in $2 only overwriting conflicts
+ [ -z "$3" ] && branch="master" || branch="$repobranch"
+ dir=$(mktemp -d)
+ [ ! -d "$2" ] && mkdir -p "$2"
+ chown "$name":wheel "$dir" "$2"
+ sudo -u "$name" git -C "$repodir" clone --depth 1 \
+ --single-branch --no-tags -q --recursive -b "$branch" \
+ --recurse-submodules "$1" "$dir"
+ sudo -u "$name" cp -rfT "$dir" "$2"
+}
+putgitrepo "$@"