Execute commands only when successful

This commit is contained in:
Manuel Thalmann 2024-07-08 01:03:21 +02:00
parent 3207565246
commit 9d5df120ec
4 changed files with 24 additions and 20 deletions

View file

@ -14,17 +14,19 @@ begin
set -l nixDir "$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs"
mkdir -p "$rootHome"
fish "$(status dirname)/../../scripts/copy-repo.fish" "$projectDir"
and fish "$(status dirname)/../../scripts/copy-repo.fish" "$projectDir"
if [ ! -d "$nixCache" ]
mkdir -p "$nixCache"
git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixVersion" "$nixCache"
rm -rf "$nixCache/.git"
and begin
if [ ! -d "$nixCache" ]
mkdir -p "$nixCache"
and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixVersion" "$nixCache"
and rm -rf "$nixCache/.git"
end
end
sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir"
sudo mount --mkdir --bind "$nixCache" "$nixDir"
sudo mkarchiso $argv "$profileDir"
and sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir"
and sudo mount --mkdir --bind "$nixCache" "$nixDir"
and sudo mkarchiso $argv "$profileDir"
sudo umount "$nixDir"
sudo umount "$profileDir"
and sudo umount "$profileDir"
end

View file

@ -8,17 +8,17 @@ begin
begin
. "$dir/template-path.fish"
rm -rf "$contextRoot"
cp -r "$(templatePath)" "$contextRoot"
chmod -R 755 "$contextRoot"
git init "$contextRoot"
git -C "$contextRoot" add .
and cp -r "$(templatePath)" "$contextRoot"
and chmod -R 755 "$contextRoot"
and git init "$contextRoot"
and git -C "$contextRoot" add .
begin
and begin
git -C "$projectDir" ls-files
git -C "$projectDir" ls-files --exclude-standard --others
end | \
rsync -r --include-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot"
end 2>&1 > /dev/null;
git -C "$contextRoot" diff
and git -C "$contextRoot" diff
end

View file

@ -6,7 +6,9 @@ begin
. "$dir/template-path.fish"
cp -r "$(templatePath)"/* "$projectDir"
if [ -f "$patch" ]
git -C "$projectDir" apply --directory=archiso "$patch"
and begin
if [ -f "$patch" ]
git -C "$projectDir" apply --directory=archiso "$patch"
end
end
end

View file

@ -3,10 +3,10 @@ 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
and git -C "$dir" diff HEAD | git -C "$target" apply --allow-empty
git -C "$dir" ls-files --exclude-standard --others | \
and git -C "$dir" ls-files --exclude-standard --others | \
while read file
cp "$dir/$file" "$target/$file"
and cp "$dir/$file" "$target/$file"
end
end