Update archiso
scripts to use fish
This commit is contained in:
parent
f23fa342ae
commit
41316c8dec
11 changed files with 83 additions and 73 deletions
|
@ -23,7 +23,7 @@ nix develop
|
|||
To create a `.iso` file for installing Arch Linux, run the following command:
|
||||
|
||||
```sh
|
||||
./scripts/build.sh
|
||||
./scripts/build.fish
|
||||
```
|
||||
|
||||
The script accepts all additional arguments which are accepted by the `mkarchiso` command.
|
||||
|
@ -38,14 +38,14 @@ Said scripts are described briefly in the following chapters.
|
|||
Show the differences between this `archiso` configuration and Arch Linux's `releng` template by running the following command:
|
||||
|
||||
```sh
|
||||
./scripts/show-diff.sh
|
||||
./scripts/show-diff.fish
|
||||
```
|
||||
|
||||
#### Update the Patch
|
||||
To update the patch containing the differences between Arch Linux's `releng` template and this `archiso` configuration, run this command:
|
||||
|
||||
```sh
|
||||
./scripts/update-patch.sh
|
||||
./scripts/update-patch.fish
|
||||
```
|
||||
|
||||
#### Update the Project
|
||||
|
@ -53,7 +53,7 @@ In case Arch Linux did major changes to the `releng` template, it might make sen
|
|||
The following command will try to do so using the patch located at `./scripts/valhalla.patch`:
|
||||
|
||||
```sh
|
||||
./scripts/update.sh
|
||||
./scripts/update.fish
|
||||
```
|
||||
|
||||
<!--- References --->
|
||||
|
|
30
archiso/scripts/build.fish
Executable file
30
archiso/scripts/build.fish
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l nixVersion nixos-24.05
|
||||
set -l projectName archiso-valhalla
|
||||
set -l overlayDir (mktemp -d)
|
||||
set -l upperDir (mktemp -d)
|
||||
set -l workDir (mktemp -d)
|
||||
set -l cacheRoot ~/".cache/$projectName"
|
||||
set -l nixCache "$cacheRoot/nixpkgs/$nixVersion"
|
||||
set -l root airootfs
|
||||
set -l rootHome "$overlayDir/$root/root"
|
||||
set -l profileDir "/mnt/$projectName"
|
||||
set -l projectDir "$rootHome/PortValhalla"
|
||||
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"
|
||||
|
||||
if [ ! -d "$nixCache" ]
|
||||
mkdir -p "$nixCache"
|
||||
git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixVersion" "$nixCache"
|
||||
rm -rf "$nixCache/.git"
|
||||
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"
|
||||
sudo unmount "$nixDir"
|
||||
sudo unmount "$profileDir"
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
overlayDir="$(mktemp -d)";
|
||||
upperDir="$(mktemp -d)";
|
||||
workDir="$(mktemp -d)";
|
||||
cacheRoot=~/.cache/archiso-valhalla;
|
||||
nixCache="$cacheRoot/nixpkgs";
|
||||
root="airootfs";
|
||||
rootHome="$overlayDir/$root/root";
|
||||
profileDir="/mnt/archiso-valhalla";
|
||||
projectDir="$rootHome/PortValhalla";
|
||||
nixDir="$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs";
|
||||
mkdir -p "$rootHome";
|
||||
fish "${BASH_SOURCE%/*}/../../scripts/copy-repo.fish" "$projectDir";
|
||||
|
||||
if [ ! -d "$nixCache" ]; then
|
||||
mkdir -p "$nixCache"
|
||||
git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b nixos-24.05 "$nixCache";
|
||||
rm -rf "$nixCache/.git";
|
||||
fi;
|
||||
|
||||
sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir";
|
||||
sudo mount --mkdir --bind "$nixCache" "$nixDir";
|
||||
sudo mkarchiso "$@" "$profileDir";
|
||||
sudo umount "$nixDir";
|
||||
sudo umount "$profileDir";
|
24
archiso/scripts/show-diff.fish
Executable file
24
archiso/scripts/show-diff.fish
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/env fish
|
||||
# Shows the differences between Arch's original `archiso` template named `releng` and this `archiso` directory.
|
||||
begin
|
||||
set -l contextRoot (mktemp -d)
|
||||
set -l dir (status dirname)
|
||||
set -l projectDir "$dir/.."
|
||||
|
||||
begin
|
||||
. "$dir/template-path.fish"
|
||||
rm -rf "$contextRoot"
|
||||
cp -r "$(templatePath)" "$contextRoot"
|
||||
chmod -R 755 "$contextRoot"
|
||||
git init "$contextRoot"
|
||||
git -C "$contextRoot" add .
|
||||
|
||||
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
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Shows the differences between Arch's original `archiso` template named `releng` and this `archiso` directory.
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
. ./template-path.sh;
|
||||
{
|
||||
contextRoot="$(mktemp -d)";
|
||||
rm -rf "$contextRoot";
|
||||
cp -r "$(templatePath)" "$contextRoot";
|
||||
chmod -R 755 "$contextRoot";
|
||||
git init "$contextRoot";
|
||||
|
||||
pushd "$contextRoot" > /dev/null;
|
||||
git add .;
|
||||
popd > /dev/null;
|
||||
|
||||
rsync -r --exclude={.git,.gitignore,README.md,scripts,LICENSE,out,valhalla.patch,work} .. "$contextRoot"
|
||||
} 2>&1 > /dev/null;
|
||||
|
||||
pushd "$contextRoot" > /dev/null;
|
||||
git diff;
|
||||
popd > /dev/null;
|
||||
popd > /dev/null;
|
7
archiso/scripts/template-path.fish
Executable file
7
archiso/scripts/template-path.fish
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
# Prints the path to Arch's `releng` template.
|
||||
function templatePath
|
||||
echo "$(dirname (which mkarchiso))/../share/archiso/configs/releng"
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Prints the path to Arch's `releng` template.
|
||||
function templatePath() {
|
||||
echo "$(dirname "$(which mkarchiso)")/../share/archiso/configs/releng"
|
||||
}
|
6
archiso/scripts/update-patch.fish
Executable file
6
archiso/scripts/update-patch.fish
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/env fish
|
||||
# Updates the patch to be applicable to Arch's current `releng` template.
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
"$dir/show-diff.fish" > "$dir/valhalla.patch"
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Updates the patch to be applicable to Arch's current `releng` template.
|
||||
rootDir="${BASH_SOURCE%/*}";
|
||||
"$rootDir/show-diff.sh" > "$rootDir/valhalla.patch";
|
12
archiso/scripts/update.fish
Executable file
12
archiso/scripts/update.fish
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
set -l projectDir "$dir/.."
|
||||
set -l patch "$dir/valhalla.patch"
|
||||
. "$dir/template-path.fish"
|
||||
cp -r "$(templatePath)"/* "$projectDir"
|
||||
|
||||
if [ -f "$patch" ]
|
||||
git -C "$projectDir" apply --directory=archiso "$patch"
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
patchFile="$(realpath -m valhalla.patch)";
|
||||
. ./template-path.sh;
|
||||
cp -r "$(templatePath)"/* ..
|
||||
|
||||
if [ -f "$patchFile" ];
|
||||
then
|
||||
pushd .. > /dev/null;
|
||||
git apply --directory=archiso "$patchFile";
|
||||
popd > /dev/null;
|
||||
fi;
|
||||
|
||||
popd > /dev/null;
|
Loading…
Reference in a new issue