Translate copy-repo script to fish

This commit is contained in:
Manuel Thalmann 2024-07-07 22:33:01 +02:00
parent 6c1b259560
commit f23fa342ae
4 changed files with 14 additions and 16 deletions

View file

@ -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"

View file

@ -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;

12
scripts/copy-repo.fish Executable file
View file

@ -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

View file

@ -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 "$@";