From f23fa342aef908db79949087e8b63351a9903734 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 7 Jul 2024 22:33:01 +0200 Subject: [PATCH] Translate `copy-repo` script to `fish` --- archiso/scripts/build.sh | 2 +- scripts/Arch/OS/setup.sh | 2 +- scripts/copy-repo.fish | 12 ++++++++++++ scripts/copy-repo.sh | 14 -------------- 4 files changed, 14 insertions(+), 16 deletions(-) create mode 100755 scripts/copy-repo.fish delete mode 100755 scripts/copy-repo.sh diff --git a/archiso/scripts/build.sh b/archiso/scripts/build.sh index a242a168..40987e4e 100755 --- a/archiso/scripts/build.sh +++ b/archiso/scripts/build.sh @@ -10,7 +10,7 @@ profileDir="/mnt/archiso-valhalla"; projectDir="$rootHome/PortValhalla"; nixDir="$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs"; mkdir -p "$rootHome"; -"${BASH_SOURCE%/*}/../../scripts/copy-repo.sh" "$projectDir"; +fish "${BASH_SOURCE%/*}/../../scripts/copy-repo.fish" "$projectDir"; if [ ! -d "$nixCache" ]; then mkdir -p "$nixCache" diff --git a/scripts/Arch/OS/setup.sh b/scripts/Arch/OS/setup.sh index 7a6375c1..9fffd4c2 100755 --- a/scripts/Arch/OS/setup.sh +++ b/scripts/Arch/OS/setup.sh @@ -39,7 +39,7 @@ pacstrap -K "$ARCH_MOUNT_ROOT" \ texinfo \ ; -../../copy-repo.sh "${ARCH_MOUNT_ROOT}$tempRoot"; +fish ../../copy-repo.fish "${ARCH_MOUNT_ROOT}$tempRoot"; genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab"; arch-chroot "$ARCH_MOUNT_ROOT" systemctl enable NetworkManager; diff --git a/scripts/copy-repo.fish b/scripts/copy-repo.fish new file mode 100755 index 00000000..2a87dd19 --- /dev/null +++ b/scripts/copy-repo.fish @@ -0,0 +1,12 @@ +#!/bin/env fish +begin + set -l target "$argv[1]" + set -l dir "$(status dirname)/.." + git clone "$dir" "$target" + git -C "$dir" diff HEAD | git -C "$target" apply --allow-empty + + git -C "$dir" ls-files --exclude-standard --others | \ + while read file + cp "$dir/$file" "$target/$file" + end +end diff --git a/scripts/copy-repo.sh b/scripts/copy-repo.sh deleted file mode 100755 index 9ebdd87c..00000000 --- a/scripts/copy-repo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -function copyRepo() { - local dir="${BASH_SOURCE%/*}/.."; - local target="$1"; - git clone "$dir" "$target"; - git -C "$dir" diff HEAD | git -C "$target" apply --allow-empty; - - git -C "$dir" ls-files --exclude-standard --others | \ - while read file; do - cp "$dir/$file" "$target/$file"; - done; -} - -copyRepo "$@";