Create a script for copying the repo

This commit is contained in:
Manuel Thalmann 2024-07-07 20:12:46 +02:00
parent 5bca2c6855
commit f97e81c606
3 changed files with 17 additions and 11 deletions

View file

@ -10,13 +10,7 @@ profileDir="/mnt/archiso-valhalla";
projectDir="$rootHome/PortValhalla";
nixDir="$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs";
mkdir -p "$rootHome";
git clone .. "$projectDir";
git -C .. diff HEAD | git -C "$projectDir" apply --allow-empty;
git -C .. ls-files --exclude-standard --others | \
while read file; do
cp "../$file" "$projectDir/$file";
done;
"${BASH_SOURCE%/*}/../../scripts/copy-repo.sh" "$projectDir";
if [ ! -d "$nixCache" ]; then
mkdir -p "$nixCache"

View file

@ -18,7 +18,7 @@ USER_GROUPS="${USER_GROUPS}";
projectRoot="$(realpath ../../..)";
projectName="$(basename "$projectRoot")";
relativeDir="$(realpath --relative-to "$projectRoot" "$(pwd)")";
tempRoot="/root/$(basename "$projectName")";
tempRoot="/opt/$(basename "$projectName")";
tempDir="$tempRoot/$relativeDir";
loadkeys "$ARCH_KEYMAP";
@ -39,7 +39,7 @@ pacstrap -K "$ARCH_MOUNT_ROOT" \
texinfo \
;
cp -r "$projectRoot" "${ARCH_MOUNT_ROOT}$tempRoot";
../../copy-repo.sh "${ARCH_MOUNT_ROOT}$tempRoot";
genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab";
arch-chroot "$ARCH_MOUNT_ROOT" systemctl enable NetworkManager;
@ -78,6 +78,4 @@ systemd-nspawn -bD "$ARCH_MOUNT_ROOT" -E "ARCH_X11_KEYMAP=${ARCH_X11_KEYMAP}";
systemd-nspawn -D "$ARCH_MOUNT_ROOT" systemctl disable set-keymap;
rm "$ARCH_MOUNT_ROOT/etc/systemd/system/set-keymap.service";
arch-chroot "$ARCH_MOUNT_ROOT" rm -rf "$tempRoot";
popd > /dev/null;

14
scripts/copy-repo.sh Executable file
View file

@ -0,0 +1,14 @@
#!/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 "$@";