From 2b3f191572d429474f484624e3c6b83fdd7dd74b Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Tue, 6 Jan 2026 00:57:02 +0100 Subject: Initial commit --- init | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 init (limited to 'init') diff --git a/init b/init new file mode 100755 index 0000000..13fb9da --- /dev/null +++ b/init @@ -0,0 +1,29 @@ +#!/usr/bin/env fish + +set homedirs dot-config dot-local-bin + +for dir in $homedirs + set -l target_base $HOME/(string replace '-' '/' (string replace -r '^dot-' '.' $dir)) + + for file in (find -L $dir -type f) + set -l src "$(pwd)/$file" + set -l dst (string replace -r "^$dir/" "$target_base/" $file) + if [ -L $dst -a "$(readlink $dst)" = $src ] + continue + end + mkdir -p "$(dirname $dst)" + ln -vs $src $dst + end +end + +for file in (find etc -type f) + set -l src "$(pwd)/$file" + set -l dst /$file + if [ -f $dst ] + if [ "$(sha1sum < $dst)" = "$(sha1sum < $src)" ] + continue + end + end + sudo -p "[sudo] password to copy $dst: " mkdir -p "$(dirname $dst)" + sudo cp -v $src $dst +end -- cgit v1.2.3