Commit Graph

390 Commits

Author SHA1 Message Date
Lasath Fernando
e776a910d8 Update update.sh 2024-12-05 23:00:07 +00:00
Bruno Pajdek
2be5c59c92 Improve image populating/shrinking/building process.
Alright, this is the main set of changes done in `build.sh`. After this, as far as `build.sh` is concerned, it's mostly style and documentation changes I will write MRs for. There was no way for me to split this into smaller independent changes without leaving the tree in an inconsistent state, this is really the most "atomic" I can personally do. The changes may look scary at first, but I promise you they're not that major, breaking or hard to review. The MR focuses on how the image is created, populated and shrunk from the rootfs generated by mkosi.

Firstly, the variables that are set at the start of the program were simplified and refactored so they can be used in (in my opinion) a more elegant and useful way with the rest of the now-modified build process. They now focus more on simply the paths/filenames of the outputted artifacts, so they can be changed conveniently, with the internal naming now still staying a static `kde-linux`. As a result of this, the image ID (`kde-linux`) is now in `mkosi.conf`.

`OUTPUT_IS_BTRFS_SUBVOLUME` was dropped. This is a remnant of when we could populate the images without a btrfs'd build environment, but those times are now gone and if this variable was determined to be false, the build would fail pretty quickly anyways, so really, it should always be true in a properly configured build environment. Because of it being used as a condition in if-else statements (if $OUTPUT_IS_BTRFS_SUBVOLUME is true... else...), those statements were dropped and only their main branch was kept with their "else" branch (which, again, should never even run on a working build environment) discarded. One script that was only ever called from one of those discarded else-branches was `btrfs-copy.sh`, so it was deleted as it is now fully unused.

The way everything used to work after this was fairly convoluted, which is probably the result of piling new shrinking methods and the likes onto old existing code. I will drop some details for the sake of brevity. After mkosi finished, three btrfs subvolumes were created and the files from the mkosi-generated rootfs were copied to those (`/var/lib/flatpak` was copied to a flatpak subvolume, `/live` was copied to a live subvolume, and the rest to a kde-linux subvolume). These subvolumes were then all packed into three respective files. Using `systemd-repart` and the definitions inside `mkosi.repart`, a full disk image containing both a 260M ESP populated with files from `/efi-template` and a btrfs partition of a size large enough to house all of those subvolumes was created. Using `systemd-dissect`, only the btrfs partition from the full disk image was mounted, and the script `btrfs-send-receive.sh` was called inside of the mounted partition, which unpacked all of the previously packed subvolumes onto the filesystem. It then called `btrfs-shrink.py` which would try and shrink the filesystem to the minimum possible size and write that size into a file for future usage by `part-rebuild.py` after it's done. `part-rebuild.py` got called which extracted the btrfs partition and ESP from the full disk image separately using `dd` and shrunk the btrfs part of the image to the size that the actual inner filesystem was shrunk to by `btrfs-shrink.py`. Then `systemd-repart` was called AGAIN, this time with `--size=auto` instead of a fixed size and using definitions inside `mkosi.repart-rebuild`, which would merge the two part-rebuild.py-dd-separated partition images of the ESP and shrunk btrfs filesystem back into one full disk image.

The way it now works is the ESP (of 260M) and btrfs filesystem (of a size large enough, 8G) are created inside of two files using native tools (`fallocate` and `mkfs.btrfs`/`fat`). The ESP file is mounted, files from `/efi-template` are copied to it, and then it's unmounted. Then, the btrfs file is mounted, files from the mkosi-generated rootfs are copied to it (what `btrfs-send-receive.sh` effectively did), the filesystem is shrunk to the minimum possible size (what `btrfs-shrink.py` effectively did), and then it's unmounted. Since the underlying btrfs filesystem inside of the btrfs file was shrunk but the actual file is still 8G, the file is, using `truncate`, shrunk to the size of the actual btrfs filesystem inside (what `part-rebuild.py` effectively did). The two files are now ready to be merged into one full bootable disk image, so `systemd-repart` is called a single time right away with `--size=auto` using the definitions in `mkosi.repart` to do so. Everything is done in `build.sh`.

As a result, the files no longer necessary were deleted from the tree - `btrfs-copy.sh`, `btrfs-send-receive.sh`, `btrfs-shrink.py`, `part-rebuild.py`, and the definitions inside `mkosi.repart` were simplified to conform to the new direct disk image build method.

I'm pretty sure it's faster (30min build time down to 20min) because it's less convoluted, and generates smaller images (6ish G down to 5ish G). I'm not sure what the reasoning is behind the latter, but it's also a welcome change :)

!91 will also be updated to refer to this MR instead of the now-closed !90 and can then be merged to fully get rid of Python for now.
2024-12-05 19:46:32 +00:00
Ryan Brue
cb7d2e2c4a fix: enable nvidia-specific services for suspending/resuming
Fixes: https://invent.kde.org/kde-linux/kde-linux/-/issues/103

Shouldn't affect non-nvidia hardware (I tested on an Intel-only system)

If you'd like to test on non-nvidia hardware, enable the nvidia services like so:

```
systemctl enable nvidia-suspend.service nvidia-resume.service nvidia-hibernate.service
``` 

Let me know if you see any issues!

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2024-12-05 18:13:42 +00:00
Lasath Fernando
9ccf3abe07 Fix recent update issues
This fixes the recent issues of `cannot stat /efi/EFI/Linux` we get when using `update.sh`

systemd no longer auto-mounts the ESP at `/efi`. Reason is explained in a comment inline.
2024-12-05 08:56:14 +00:00
Justin Zobel
fea048bde0 README: Update name and expand text 2024-12-04 23:47:36 +00:00
Lasath Fernando
bf1836afa4 Add systemd-git
This is needed to get access to `systemd-sysupdated`, which is used by plasma/discover!957 to update KDE Linux.
2024-12-04 21:15:08 +00:00
Ryan Brue
2d04f81f59 Add splix and dnsmasq to 60-packages-hw-enablement
Supersedes: https://invent.kde.org/kde-linux/kde-linux/-/merge_requests/78
2024-12-04 00:00:49 -06:00
Bruno Pajdek
e6f3e4c3da Rewrite permission-fix to (ba)sh
If/when !95 merges, this will be the only Python script in the build process left. Rewrite to (ba)sh like the rest for consistency, then we can port everything to some other language if desired one day.
2024-12-03 09:58:04 +00:00
Nate Graham
3774740057 Re-alphabetize development packages list
It managed to drift out of alphabetical order, so let's fix that.
2024-12-02 12:44:49 +01:00
Harald Sitter
33736be041 pull in ninja in the development config
make is crusty and old. ninja is shiny and new. since kde linux is all about
embracing the future, ninja is the build tool of choice
2024-12-02 12:12:20 +01:00
Ryan Brue
b892eeb33e fix: make KDE plymouth logo transparent
This also makes the logo bigger by comparison. I don't know how that'll look in plymouth. If it's wanted, I could keep the effective size the same by having transparent space, just let me know.

CC: @ngraham @justinzobel 

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2024-12-02 04:20:57 +00:00
Lasath Fernando
25ff87f3df Replace toolbox with distrobox
The consensus on the matrix chat is that distrobox is better than toolbox as a container and development solution.

I've used them both on Fedora Silverblue (and its derivatives) and found that to be true.
2024-12-01 03:51:50 +00:00
Ryan Brue
233baddcd3 fix: typo in build.sh prevents building
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2024-11-29 14:06:15 -06:00
Bruno Pajdek
c27c1e42e0 Move mkosi confs to flags
build.sh unnecessarily generates some temporary configs for mkosi.
Instead, pass flags to mkosi to configure it without polluting.
The distro being arch is already defined in mkosi.conf.
2024-11-29 16:52:04 +00:00
Ryan Brue
7ce950a81d Set Plymouth watermark to kde logo
The watermark I chose comes straight from the KDE press kit at
https://kde.org/stuff/clipart/

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>

Resolves #101
2024-11-29 16:25:32 +00:00
Lasath Fernando
b9b1c57d8d Prevent Calamares from being installed/visible after installing system
We install all packages in the `kde-linux` repo:
```bash
  # All the KDE we plan to include in the base image
  $(pacman --sync --list --quiet kde-linux)
```

I recently added `calamares-git` (and some other AUR packages) to that
repo so we don't have to build them as part of every image build. This
is causing it to get included in the base image.

This change makes pacman restrict to just the `kde-linux` group instead
of the whole repo.

Resolves #42
2024-11-29 16:22:00 +00:00
Bruno Pajdek
d1425664d9 Remove mkosi.build.chroot
Maybe it was made to be filled up with stuff at a later point, but I'm pretty sure it's useless for now. Mkosi runs fine without it present.
2024-11-28 21:13:23 +00:00
Bruno Pajdek
fa24dbc1eb Improve bootstrap.sh
archlinux-keyring is a part of base already. Good global mirrors are already defined in Arch Docker images, the explicit 23m mirror stuff is unnecessary.
2024-11-28 20:22:40 +00:00
Bruno Pajdek
75ba35fca3 Improve build_docker.sh
CI_PROJECT_DIR isn't explicitly accessed anywhere and doesn't affect the build at all.
2024-11-28 19:02:59 +00:00
Bruno Pajdek
11cc91a6cf remove dracut 2024-11-28 18:34:19 +01:00
Bruno Pajdek
c946aed8a6 Comment in_docker.sh 2024-11-28 17:22:38 +01:00
Ryan Brue
5a5ffd1ca8 Add power-profiles-daemon to 60-packages-hw-enablement
This commit adds power-profiles-daemon to kde-linux. Reportedly this had been added in the past but it may have just been refactored out by accident.

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2024-11-26 12:24:14 -06:00
Nate Graham
3e05b39b6f Replace VLC with Haruna
Haruna is a KDE app, it offers a better UX than VLC, and it's what
Plasma expects to be the default player anyway. Let's go with it.
2024-11-23 18:22:42 -07:00
Bruno Pajdek
0ba5da1bff Migrate pacman repo to cdn.kde.org
pipeline ran here already https://invent.kde.org/brupaj/kde-linux/-/jobs/2319849
2024-11-23 23:09:09 +00:00
Justin Zobel
014a4edaff Add Elisa flatpak as we need a music player/library manager 2024-11-20 12:57:16 +10:30
Nate Graham
5152719c7c Document the final package in 60-packages-hw-enablement.conf
Missed in 6662aee876 by accident!
2024-11-19 09:58:10 -07:00
Nate Graham
1f31bf3fee Set default browser to Firefox since it's pre-installed
This way it doesn't get overridden the first time the user installs a
new browser that isn't Firefox.

Fixes #49
2024-11-19 16:22:10 +00:00
Nate Graham
6662aee876 Document contents of 60-packages-hw-enablement.conf inline
This way it's more obvious why these things are in here!
2024-11-19 09:17:25 -07:00
Lasath Fernando
66d9ce1177 Restore pacman db
It's like 12MB (probably much smaller when compressed).

Totally worth being able to investigate why certain files or packages were pulled in.
2024-11-18 22:47:13 +00:00
Ian Monroe
bfd7045674 include file capabilities in the update tarball
for instance podman is broken if newuidmap doesn't have cap_setuid=ep
2024-11-17 19:14:11 -08:00
Justin Zobel
82b17d8e70 Add xorg-xdpyinfo for kinfocenter X11 tab
Fixed #85
2024-11-15 12:45:18 +10:30
Lasath Fernando
8b9731f118 Convert _kde-linux-find-esp to bash
Pulling in ruby into the image to save 2 lines of shell script doesn't seem worth it.
2024-11-15 01:59:56 +00:00
Justin Zobel
dc68605a8e Include libva Mesa/Intel drivers
Part of #35
2024-11-14 15:17:15 +10:30
Justin Zobel
296e4844b6 Add libva for screencasting and remote desktop
Fixes #24
2024-11-14 12:09:49 +10:30
Lasath Fernando
adee68a29e Packages refactor part 4: Remove kde-builder 2024-11-13 00:40:27 -06:00
Gerardo David Gomez Rodriguez
9fa11c282d Rename calamares branding directory to kde-linux
In f090501b44 the kdeos renaming was done, but the calamares directory was missing.
2024-11-13 03:01:47 +00:00
Nate Graham
0bda55fed2 Don't expose the X11 session
We're all-in on Wayland.

Fixes #86
2024-11-13 02:01:58 +00:00
Lasath Fernando
7c86dfb8d7 Add qt multimedia backend
To prevent the imaging script getting stuck in an infinite loop asking which backend to install
2024-11-13 02:01:35 +00:00
Justin Zobel
f849f7c8dc Hide stat output in update script 2024-11-10 11:53:11 +00:00
Justin Zobel
1a97f2162e Add less to mkosi.conf.d/99-packages-development.conf for git diff 2024-11-10 12:25:24 +10:30
Justin Zobel
4c35dcd015 Sort dependencies in mkosi.conf.d/99-packages-development.conf 2024-11-10 12:24:46 +10:30
Harald Sitter
9900c7df18 make updates work reliably
the tombstone is a bit broken in that it doesn't use the correct name.
sort the names correctly (first is preferred) and also bring back the
old names so they eventually get cleaned up
2024-11-07 23:36:46 +01:00
Harald Sitter
f090501b44 rename all files to kde-linux 2024-11-07 18:59:08 +01:00
Harald Sitter
c2c9c66609 change most everything to kde-linux
helpers are still using the old names so we don't have content and name
changes at the same time
2024-11-07 18:47:33 +01:00
Harald Sitter
bdfe363022 vacuum: fill the config object 2024-11-07 18:10:22 +01:00
Harald Sitter
1628433b2a typo-- 2024-11-07 17:27:57 +01:00
Harald Sitter
b864ad0116 start transitioning to new image name
this is a bit complicated...

in this step we make the image able to find the new name. in the next
step we need to actually do the rename
2024-11-07 17:17:51 +01:00
Harald Sitter
cf0d51a93e cleanup++ 2024-11-07 17:17:11 +01:00
Harald Sitter
842867d086 vacuum: add a config system
the remote location must now contain a vacuum.yaml file which encodes
gold images and tombstone images (to keep forever) based on their
version number
2024-11-07 17:17:10 +01:00
Harald Sitter
092bd8107c vacuum: refactor release loading into function
makes main a bit easier on the eyes
2024-11-07 17:17:08 +01:00