diff --git a/_home/.chezmoi.toml.tmpl b/_src.posix/.chezmoi.toml.tmpl similarity index 100% rename from _home/.chezmoi.toml.tmpl rename to _src.posix/.chezmoi.toml.tmpl diff --git a/_home/.chezmoiexternal.yaml b/_src.posix/.chezmoiexternal.yaml similarity index 100% rename from _home/.chezmoiexternal.yaml rename to _src.posix/.chezmoiexternal.yaml diff --git a/_home/.chezmoiignore b/_src.posix/.chezmoiignore similarity index 100% rename from _home/.chezmoiignore rename to _src.posix/.chezmoiignore diff --git a/_home/.chezmoiscripts/run_once_init.sh.tmpl b/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl similarity index 100% rename from _home/.chezmoiscripts/run_once_init.sh.tmpl rename to _src.posix/.chezmoiscripts/run_once_init.sh.tmpl diff --git a/_home/dot_bashrc b/_src.posix/dot_bashrc similarity index 100% rename from _home/dot_bashrc rename to _src.posix/dot_bashrc diff --git a/_home/dot_gitconfig.tmpl b/_src.posix/dot_gitconfig.tmpl similarity index 100% rename from _home/dot_gitconfig.tmpl rename to _src.posix/dot_gitconfig.tmpl diff --git a/_home/dot_profile b/_src.posix/dot_profile similarity index 100% rename from _home/dot_profile rename to _src.posix/dot_profile diff --git a/_home/dot_zshrc b/_src.posix/dot_zshrc similarity index 100% rename from _home/dot_zshrc rename to _src.posix/dot_zshrc diff --git a/_home/private_dot_config/atuin/config.toml b/_src.posix/private_dot_config/atuin/config.toml similarity index 100% rename from _home/private_dot_config/atuin/config.toml rename to _src.posix/private_dot_config/atuin/config.toml diff --git a/_home/private_dot_config/starship.toml b/_src.posix/private_dot_config/starship.toml similarity index 100% rename from _home/private_dot_config/starship.toml rename to _src.posix/private_dot_config/starship.toml diff --git a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env similarity index 100% rename from _home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env rename to _src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env diff --git a/_home/private_dot_config/sz.env/ID_truenas_scale.env b/_src.posix/private_dot_config/sz.env/ID_truenas_scale.env similarity index 100% rename from _home/private_dot_config/sz.env/ID_truenas_scale.env rename to _src.posix/private_dot_config/sz.env/ID_truenas_scale.env diff --git a/_home/private_dot_config/sz.env/PATH_home_bin.env b/_src.posix/private_dot_config/sz.env/PATH_home_bin.env similarity index 100% rename from _home/private_dot_config/sz.env/PATH_home_bin.env rename to _src.posix/private_dot_config/sz.env/PATH_home_bin.env diff --git a/_home/private_dot_config/sz.env/PATH_node.env b/_src.posix/private_dot_config/sz.env/PATH_node.env similarity index 100% rename from _home/private_dot_config/sz.env/PATH_node.env rename to _src.posix/private_dot_config/sz.env/PATH_node.env diff --git a/_home/private_dot_config/sz.env/PATH_truestuff.env b/_src.posix/private_dot_config/sz.env/PATH_truestuff.env similarity index 100% rename from _home/private_dot_config/sz.env/PATH_truestuff.env rename to _src.posix/private_dot_config/sz.env/PATH_truestuff.env diff --git a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env b/_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env similarity index 100% rename from _home/private_dot_config/sz.env/PATH_zz_cleanup.env rename to _src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env diff --git a/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env similarity index 100% rename from _home/private_dot_config/sz.env/aaa_zsh_0_perp.env rename to _src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env diff --git a/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env similarity index 100% rename from _home/private_dot_config/sz.env/aaa_zsh_2_zinit.env rename to _src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env diff --git a/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env similarity index 100% rename from _home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env rename to _src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env diff --git a/_home/private_dot_config/sz.env/aab_zellij.env b/_src.posix/private_dot_config/sz.env/aab_zellij.env similarity index 100% rename from _home/private_dot_config/sz.env/aab_zellij.env rename to _src.posix/private_dot_config/sz.env/aab_zellij.env diff --git a/_home/private_dot_config/sz.env/aliases.env b/_src.posix/private_dot_config/sz.env/aliases.env similarity index 100% rename from _home/private_dot_config/sz.env/aliases.env rename to _src.posix/private_dot_config/sz.env/aliases.env diff --git a/_home/private_dot_config/sz.env/bbb_bash_preexec.env b/_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env similarity index 100% rename from _home/private_dot_config/sz.env/bbb_bash_preexec.env rename to _src.posix/private_dot_config/sz.env/bbb_bash_preexec.env diff --git a/_home/private_dot_config/sz.env/bbb_ble.sh.env b/_src.posix/private_dot_config/sz.env/bbb_ble.sh.env similarity index 100% rename from _home/private_dot_config/sz.env/bbb_ble.sh.env rename to _src.posix/private_dot_config/sz.env/bbb_ble.sh.env diff --git a/_home/private_dot_config/sz.env/broot.env b/_src.posix/private_dot_config/sz.env/broot.env similarity index 100% rename from _home/private_dot_config/sz.env/broot.env rename to _src.posix/private_dot_config/sz.env/broot.env diff --git a/_home/private_dot_config/sz.env/envman-and-webi.env b/_src.posix/private_dot_config/sz.env/envman-and-webi.env similarity index 100% rename from _home/private_dot_config/sz.env/envman-and-webi.env rename to _src.posix/private_dot_config/sz.env/envman-and-webi.env diff --git a/_home/private_dot_config/sz.env/executable__.load.sh b/_src.posix/private_dot_config/sz.env/executable__.load.sh similarity index 100% rename from _home/private_dot_config/sz.env/executable__.load.sh rename to _src.posix/private_dot_config/sz.env/executable__.load.sh diff --git a/_home/private_dot_config/sz.env/fix-kubectl.env b/_src.posix/private_dot_config/sz.env/fix-kubectl.env similarity index 100% rename from _home/private_dot_config/sz.env/fix-kubectl.env rename to _src.posix/private_dot_config/sz.env/fix-kubectl.env diff --git a/_home/private_dot_config/sz.env/fix-nvim.env b/_src.posix/private_dot_config/sz.env/fix-nvim.env similarity index 100% rename from _home/private_dot_config/sz.env/fix-nvim.env rename to _src.posix/private_dot_config/sz.env/fix-nvim.env diff --git a/_home/private_dot_config/sz.env/truenas-scale.env b/_src.posix/private_dot_config/sz.env/truenas-scale.env similarity index 100% rename from _home/private_dot_config/sz.env/truenas-scale.env rename to _src.posix/private_dot_config/sz.env/truenas-scale.env diff --git a/_home/private_dot_config/sz.env/zza_atuin.env b/_src.posix/private_dot_config/sz.env/zza_atuin.env similarity index 100% rename from _home/private_dot_config/sz.env/zza_atuin.env rename to _src.posix/private_dot_config/sz.env/zza_atuin.env diff --git a/_home/private_dot_config/sz.env/zza_starship.env b/_src.posix/private_dot_config/sz.env/zza_starship.env similarity index 100% rename from _home/private_dot_config/sz.env/zza_starship.env rename to _src.posix/private_dot_config/sz.env/zza_starship.env diff --git a/_home/private_dot_config/sz.env/zzz_bash_post.env b/_src.posix/private_dot_config/sz.env/zzz_bash_post.env similarity index 100% rename from _home/private_dot_config/sz.env/zzz_bash_post.env rename to _src.posix/private_dot_config/sz.env/zzz_bash_post.env diff --git a/_home/private_dot_config/sz.env/zzz_chezmoi.env b/_src.posix/private_dot_config/sz.env/zzz_chezmoi.env similarity index 100% rename from _home/private_dot_config/sz.env/zzz_chezmoi.env rename to _src.posix/private_dot_config/sz.env/zzz_chezmoi.env diff --git a/_home/private_dot_config/sz.env/zzz_fzf.env.off b/_src.posix/private_dot_config/sz.env/zzz_fzf.env.off similarity index 100% rename from _home/private_dot_config/sz.env/zzz_fzf.env.off rename to _src.posix/private_dot_config/sz.env/zzz_fzf.env.off diff --git a/_home/private_dot_local/bin/executable_get-github-release.sh b/_src.posix/private_dot_local/bin/executable_get-github-release.sh similarity index 100% rename from _home/private_dot_local/bin/executable_get-github-release.sh rename to _src.posix/private_dot_local/bin/executable_get-github-release.sh diff --git a/_home/private_dot_local/bin/executable_load-starship b/_src.posix/private_dot_local/bin/executable_load-starship similarity index 100% rename from _home/private_dot_local/bin/executable_load-starship rename to _src.posix/private_dot_local/bin/executable_load-starship diff --git a/_home/private_dot_local/bin/executable_load-webi b/_src.posix/private_dot_local/bin/executable_load-webi similarity index 100% rename from _home/private_dot_local/bin/executable_load-webi rename to _src.posix/private_dot_local/bin/executable_load-webi diff --git a/_home/private_dot_local/bin/executable_load-zellij b/_src.posix/private_dot_local/bin/executable_load-zellij similarity index 100% rename from _home/private_dot_local/bin/executable_load-zellij rename to _src.posix/private_dot_local/bin/executable_load-zellij diff --git a/_home/private_dot_local/bin/executable_szetup-kubectl4k3s b/_src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s similarity index 100% rename from _home/private_dot_local/bin/executable_szetup-kubectl4k3s rename to _src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s diff --git a/_home/private_dot_local/bin/executable_update-atuin b/_src.posix/private_dot_local/bin/executable_update-atuin similarity index 100% rename from _home/private_dot_local/bin/executable_update-atuin rename to _src.posix/private_dot_local/bin/executable_update-atuin diff --git a/_home/private_dot_local/bin/executable_update-nvim b/_src.posix/private_dot_local/bin/executable_update-nvim similarity index 100% rename from _home/private_dot_local/bin/executable_update-nvim rename to _src.posix/private_dot_local/bin/executable_update-nvim diff --git a/_home/private_dot_local/bin/symlink_nvim b/_src.posix/private_dot_local/bin/symlink_nvim similarity index 100% rename from _home/private_dot_local/bin/symlink_nvim rename to _src.posix/private_dot_local/bin/symlink_nvim diff --git a/_home/private_dot_local/bin/symlink_vi b/_src.posix/private_dot_local/bin/symlink_vi similarity index 100% rename from _home/private_dot_local/bin/symlink_vi rename to _src.posix/private_dot_local/bin/symlink_vi diff --git a/_home/private_dot_local/bin/symlink_vim b/_src.posix/private_dot_local/bin/symlink_vim similarity index 100% rename from _home/private_dot_local/bin/symlink_vim rename to _src.posix/private_dot_local/bin/symlink_vim diff --git a/_home/private_dot_local/bin/symlink_vim.tiny b/_src.posix/private_dot_local/bin/symlink_vim.tiny similarity index 100% rename from _home/private_dot_local/bin/symlink_vim.tiny rename to _src.posix/private_dot_local/bin/symlink_vim.tiny diff --git a/_home/private_dot_local/bin/symlink_vimdiff b/_src.posix/private_dot_local/bin/symlink_vimdiff similarity index 100% rename from _home/private_dot_local/bin/symlink_vimdiff rename to _src.posix/private_dot_local/bin/symlink_vimdiff diff --git a/symclone.sh b/symclone.sh new file mode 100755 index 0000000..e855fad --- /dev/null +++ b/symclone.sh @@ -0,0 +1,58 @@ +#! /usr/bin/env bash + +set -e + +# Source directory (existing structure with files) +SRC_DIR=_src.posix + +# Target directory (new structure with symlinks) +DEST_DIR="${1:?}" + +# Check if both arguments are provided +if [[ -z "$SRC_DIR" || -z "$DEST_DIR" ]]; then + echo "Usage: $0 " + exit 1 +fi + +# Ensure source directory exists +if [[ ! -d "$SRC_DIR" ]]; then + echo "Error: Source directory '$SRC_DIR' does not exist." + exit 1 +fi + +# Create destination directory if it does not exist +mkdir -p "$DEST_DIR" + +# Find all directories and recreate them in the destination +find "$SRC_DIR" -type d -mindepth 1 | while read -r dir; do + mkdir -p "$DEST_DIR/${dir#$SRC_DIR/}" +done + +# Function to get relative path without realpath or python +relpath() { + local target=$1 + local base=$2 + local target_abs=$(cd "$(dirname "$target")" && pwd)/$(basename "$target") + local base_abs=$(cd "$base" && pwd) + local common_part="$base_abs" + local back="" + + while [[ "${target_abs#$common_part}" == "$target_abs" ]]; do + common_part=$(dirname "$common_part") + back="../$back" + done + + echo "${back}${target_abs#$common_part/}" +} + +# Find all files and create symbolic links in the destination +find "$SRC_DIR" -type f | while read -r file; do + # Determine the relative path for the symlink + target_file="${file#$SRC_DIR/}" + src_relative_path=$(relpath "$file" "$(dirname "$DEST_DIR/$target_file")") + + # Create the symlink with relative path + ln -vs "$src_relative_path" "$DEST_DIR/$target_file" +done + +echo "Symbolic links created successfully in '$DEST_DIR'."