From 29c0e5be15c2c250f6d11963ab47d9b481f15d79 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Tue, 10 Sep 2024 04:59:43 +0300 Subject: [PATCH] write script to automatically copy system configs to repo --- _sync.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 _sync.sh diff --git a/_sync.sh b/_sync.sh new file mode 100755 index 0000000..2bebca3 --- /dev/null +++ b/_sync.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Since git doesn't follow symlinks and hard links +# on ZFS aren't that easy, this script is made to +# manually copy files from system to this git repo + +mkdirs=( + "X11" + "i3wm" +) + +dirs=( + "/var/unbound:." + "$HOME/bhyve:." + "$HOME/.config/i3:i3wm" + "$HOME/.config/i3status:i3wm" +) + +files=( + "/root/kernels/GOONBSD_ASUS-LAPTOP:GOONBSD_ASUS-LAPTOP" + "/usr/local/etc/dnsmasq.conf:dnsmasq.conf" + "/etc/fstab:fstab" + "/etc/hosts:hosts" + "/boot/loader.conf:loader.conf" + "/etc/ntp.conf:ntp.conf" + "/etc/pf.conf:pf.conf" + "/etc/rc.conf:rc.conf" + "/usr/local/etc/smb4.conf:smb4.conf" + "/etc/sysctl.conf:sysctl.conf" +) + +# create directories +for newdir in "${mkdirs[@]}"; do + mkdir -p $newdir +done + +# copy directories +for entry in "${dirs[@]}"; do + src=${entry%%:*} + dst=${entry#*:} + + cp -R $src $dst +done + +# copy files +for entry in "${files[@]}"; do + src=${entry%%:*} + dst=${entry#*:} + + cp $src $dst +done