This project contains the sources and the documentation to ship updates of the Arch Avisto image.
For documentation about the installation as a consumer.
This project uses pre-commit tool documentation.
The goal is to run scripts or tasks (called hooks) on a commit basis (e.g. linting, small checks, documentation as code, etc.).
For this purpose, pre-commit will execute all the hooks declared in in then
.pre-commit-config.yaml configuration file.
- Install the tool.
pip install pre-commit - Install the git hook.
pre-commit install - Verify it is working by running pre-commit hooks.
pre-commit run --all-files
The bootscript is written in Golang
The aim of Arch Avisto was to deliver a container solution (docker in our case) out-of-the box for the teams without relaying on Docker Desktop, for licence reasons. Indeed, its installation on WSL was error prone and time consuming.
Arch Avisto is based on Arch Linux, and its first version was born using ArchWSL.
There are two users in this image
archis the normal user. This user will be renamed.loginis the default user on the first launch. Its job is to launch the bootscript.
They are a few important files on the Arch Avisto WSL image.
Static files:
/home/archis the home of the default user. It holds.zshrcand.config/starship.tomlas basic configuration/opt/prep.shis a script to prepare the image (clearing history and caches). It should be manually used before exporting./usr/bin/sloginis the shell of theloginuser. This shell is responsible to download and runbootscript, then start the bash script generated bybootscript
Other files:
/opt/startup/bootscriptis the binary executed bysloginon startup, it will be fetched from the Github release and is responsible to prompt the user for the packages he wants, his username, etc./opt/startup/script.shis the script generated by the binarybootscriptand executed byslogin, it contains all bash commands that will set up the images
ⓘ Note The bootscript will try to fetch and parse the file
packages.jsonlocated in the Github repository in order to prompt the user the latest packages without having to rebuild an image
Github actions are responsible of releasing the bootscript as an asset.
When the changes you want to make are on the image itself:
Before starting be sure you run the latest WSL version (see doc).
Also install 7-zip.
- Use the documentation
to import the image, then login using
wsl -u arch -d <distro-name> - Do your changes
- Change the
ARCHAVISTO_VERSIONin thesloginscript to the new version and copy the content of the script in/opt/startup/slogin - Prep the image by running
source /opt/prep.sh - Open a Powershell
- Shutdown wsl with
wsl --terminate <distro-name> - Export the distribution as a compressed archive (see the command below)
- Upload it to the SharePoint (step 1)
- Make at least 1 person test it
- Change SharePoint link on the documentation (step 2) to point to the new version
- Update the
CHANGELOG.mdwith the new version and the changes
# Export the distribution as a compressed archive
wsl --export test .\arch_avisto_v2.1.5.tar
& "C:\Program Files\7-Zip\7z.exe" a .\arch_avisto_v2.1.5.tar.gz .\arch_avisto_v2.1.5.tarFirst, follow all the Avisto guidelines for a new feature (new issue -> create PR -> review -> merge)
Next, here are the steps to test your image:
- Update the
bootscriptVersionin themain.go(usually located line 15) - Check that the pipeline pass once you committed your changes
- Use the documentation
to import the image, then login using
wsl -u root -d <distro-name> - Wait for the pipeline to pass
- Modify the
RELEASEvariable in the/opt/startup/sloginto fetch your version of the bootscript - Run
su loginand verify all your changes are working properly - Update the
CHANGELOG.mdwith the new version and the changes - If everything is to your liking you can unregister the wsl distro (using
wsl --unregister <distro-name>), then ask someone to review your PR! - Once happy, merge the PR and tag the merge commit on main, it'll automatically create a new release
When someone changes the bootscript, there is no need to either release a new Arch Avisto image nor to redownload the tar for the new bootscrip to be used.
Follow this tutorial.
Create 2 users: arch and login
useradd -m arch (to create a home) and useradd login.
Also add both users to the wheel group so they can use sudo (usermod -aG wheel arch and usermod -aG wheel login).
Now login as the arch user su arch && cd ~.
Install paru using the documentation (do it in /tmp or clean folder afterwards).
Create a /opt/startup directory and put the slogin script found on the arch avisto repo.
Note
Don't forget to give the ownership of the /opt/startup directory to the login user.
Once this is done, time to change the /etc/passwd file to modify the default
shell of the login user to /opt/startup/slogin, do it by running sudo chsh -s /opt/startup/slogin login
and modify the default user to be the login user in the /etc/wsl.conf file.
[user]
default=login
[boot]
systemd=true
Warning
From now on, don't forget to start the distribution using wsl -d <distro> -u arch to avoid going through the installation script.
To install docker, simply paru -S docker
then sudo systemctl enable docker and sudo systemctl start docker.
Note
Don't forget to add the user to the docker group sudo usermod -aG docker arch.
- Install fastfetch
paru -S fastfetch. - Create the logo using
jp2a --width=45 --colors --color-depth=8 logo\ Avisto.png --chars=' ###'command with the logo you can find here. - Create the directory
~/.config/fastfetchand paste the logo in it. - Paste the following content in
~/.config/fastfetch/config.jsonc.
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"modules": [
"title",
"separator",
"os",
"host",
"kernel",
"uptime",
"packages",
"shell",
"display",
"de",
"wm",
"terminal",
"cpu",
"gpu",
"memory",
"swap",
"disk",
"localip",
"battery",
"poweradapter",
"break",
"colors"
],
"logo": {
"type": "auto",
"source": "$HOME/.config/fastfetch/avisto-logo"
}
}We provide minimal configuration for all shells proposed in the installation script
first install all shells ( paru -S fish bash zsh).
if command -v direnv >/dev/null 2>&1; then
eval "$(direnv hook zsh)"
fi
if command -v starship >/dev/null 2>&1; then
eval "$(starship init zsh)"
fi
echo; fastfetch; echo;Paste this in the ~/.bash_profile.
if command -v direnv >/dev/null 2>&1; then
eval "$(direnv hook bash)"
fi
if command -v starship >/dev/null 2>&1; then
eval "$(starship init bash)"
fi
echo; fastfetch; echo;Paste the following in the ~/.config/fish/config.fish
if command -v starship > /dev/null 2>&1
starship init fish | source
end
if command -v direnv > /dev/null 2>&1
direnv hook fish | source
end
echo; fastfetch; echo;To generate locale, modify the /etc/locale.gen and uncomment your desired locale, then run sudo locale-gen
(for instance current image uses en_US.UTF-8 UTF-8).
Note
We advise clearing all cache and shell history before shipping, source that script to do so.
#! /usr/bin/env bash
paru --noconfirm -R $(paru -Qtdq) || true
paru --noconfirm -Sc || true
rm -rf ~/.cargo
rm -rf ~/.cache
sudo rm -rf /var/cache
sudo rm -rf /var/log
echo "" > ~/.bash_history
history -c