diff --git a/README.md b/README.md index c4017c5..35e0a64 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ ## Das OS ### _A light, friendly Void Linux–based desktop with Xfce and a Ukrainian touch_ -[![Void Linux](https://img.shields.io/badge/Void_Linux-x86__64_glibc-green)](https://voidlinux.org) [![Xfce](https://img.shields.io/badge/Xfce-4.20-orange)](https://xfce.org) [![runit](https://img.shields.io/badge/init-runit-blue)](https://docs.voidlinux.org/config/services/) [![Go](https://img.shields.io/badge/Go-1.22+-blue)](https://go.dev) [![Version](https://img.shields.io/badge/version-0.1.0-lightgrey)](#) +[![Void Linux](https://img.shields.io/badge/Void_Linux-x86__64_glibc-green)](https://voidlinux.org) [![Xfce](https://img.shields.io/badge/Xfce-4.20-orange)](https://xfce.org) [![runit](https://img.shields.io/badge/init-runit-blue)](https://docs.voidlinux.org/config/services/) [![Go](https://img.shields.io/badge/Go-1.22+-blue)](https://go.dev) [![Version](https://img.shields.io/badge/version-0.2.0-lightgrey)](#) 🇺🇦 [Українська версія](README_ua.md) ### 💡 Purpose -Void Linux is fast, simple and independent: runit instead of systemd, and its own xbps package manager. Out of the box, though, it is a bare system, and getting it ready for daily use takes hours of setup. Das OS builds a live ISO that boots straight into a configured Xfce desktop. It has its own look, a Ukrainian interface and keyboard layout, and the usual desktop apps. Everything Das OS adds comes from its own xbps packages, so the setup can be reproduced and updated like any other package. +Void Linux is fast, simple and independent: runit instead of systemd, and its own xbps package manager. Out of the box, though, it is a bare system, and getting it ready for daily use takes hours of setup. Das OS builds a live ISO that boots straight into a configured Xfce desktop and installs it with a graphical installer. It has its own look, a Ukrainian interface and keyboard layout, the usual desktop apps and Btrfs snapshots that let a broken update be undone. Everything Das OS adds comes from its own xbps packages, so the setup can be reproduced and updated like any other package. ### 📃 Features - [Live ISO](#LiveISO) that boots on UEFI and BIOS straight into the desktop +- [Graphical installer](#Installer) (Calamares) set up for Void and runit +- [Snapshots and rollback](#Snapshots): hourly Btrfs snapshots, bootable from the GRUB menu - [Das OS look](#Look): light and dark themes, generated window frames, wallpapers and logo - [Desktop defaults](#Defaults) for Xfce that don't overwrite stock files - [Own package repository](#Repository) built by xbps-src from in-tree templates @@ -17,6 +19,7 @@ Void Linux is fast, simple and independent: runit instead of systemd, and its ow ### ⭐ Advantages - **Void underneath** – a fast runit boot, the xbps package manager and fresh software, with none of the manual setup. +- **Safe updates** – the system can return to any snapshot, and personal files in `/home` are never part of a rollback. - **Light** – no systemd, plus Xfce, LightDM and PipeWire, so it runs well on older laptops too. - **Nothing hidden** – all customisations ship as ordinary xbps packages, so `xbps-query -f das-settings` shows exactly what changed. - **Users keep control** – defaults live in `/etc/xdg/das`, so a user's own settings always take precedence and upgrades never reset them. @@ -44,6 +47,16 @@ Void Linux is fast, simple and independent: runit instead of systemd, and its ow Dark wallpaper Window frames: light and dark, active and inactive + + Installer + Disk setup with Btrfs + Snapshots in the boot menu + + + Installer + Disk setup with Btrfs + Snapshots in the boot menu + ### 📌 Using @@ -56,6 +69,25 @@ Void Linux is fast, simple and independent: runit instead of systemd, and its ow - Ukrainian interface (`uk_UA.UTF-8`) and the Kyiv time zone by default. Keyboard layouts are `us,ua`, switched with Alt+Shift. - Includes NetworkManager, Bluetooth, PipeWire sound and Firefox with the Ukrainian language pack. Services run under runit: `dbus`, `elogind`, `polkitd`, `NetworkManager`, `bluetoothd`, `lightdm`. - Includes guest tools for QEMU/SPICE and VirtualBox. +- The *Install Das OS* icon on the desktop and in the menu starts the installer. + +#### Graphical installer +**_Calamares installs Das OS in a few steps: language and time zone, keyboard, disk, user._** +- The interface is in Ukrainian by default, with the Kyiv time zone and Das OS branding and slides. +- The disk can be erased automatically or partitioned by hand. Btrfs is the default, ext4 and XFS are also available. On UEFI machines it creates a 512 MiB EFI partition. +- It copies the clean live image (`/dev/mapper/live-base`), without the live user and its boot-time settings. +- After copying, it builds locales for the chosen language, removes the virtual machine guest tools on real hardware, sets up snapshots, builds the initramfs and installs GRUB. +- When it finishes, it removes itself and the packages that only it needed. +- Disk encryption is not offered yet. + +#### Snapshots and rollback +**_Btrfs snapshots keep the system recoverable after a bad update._** +- The installer creates the subvolumes `@` (root), `@home`, `@snapshots`, `@var_log` and `@var_cache_xbps`. Root snapshots don't include personal files, logs or the package cache. +- snapper makes a *Fresh install* snapshot right after installation and an hourly snapshot (cron). It keeps the last 5 hourly, 7 daily and 2 weekly ones. +- grub-btrfs adds every snapshot to the *Das OS snapshots* submenu in GRUB and updates it as snapshots appear. +- A snapshot is read-only. When it boots, the `das-snapshot-overlay` dracut module puts a writable overlay in RAM on top, so the full desktop works. Changes made there are lost at shutdown. +- `sudo snapper-rollback ` makes the snapshot the new root (the old one is kept as `@`). The change takes effect after a reboot. It works both from the running system and from a booted snapshot. +- Members of `wheel` can list snapshots without sudo: `snapper list`. #### Das OS look **_A modern minimal style with a blue and yellow eight-petal star from Ukrainian embroidery._** @@ -75,14 +107,16 @@ Void Linux is fast, simple and independent: runit instead of systemd, and its ow **_Every Das OS file is installed and updated by xbps._** - `srcpkgs/das-theme` contains the themes, xfwm4 frames, wallpapers and logo. - `srcpkgs/das-settings` contains the Xfce, LightDM and session defaults. -- `srcpkgs/adw-gtk3` and `srcpkgs/font-jetbrains-mono` package upstream releases that Void does not have. +- `srcpkgs/das-snapshots` contains the snapper configuration, `das-snapper-setup` and the dracut module for booting snapshots. +- `srcpkgs/das-installer` contains the Calamares settings, branding and installation scripts. It exists only on the live ISO. +- `srcpkgs/calamares`, `srcpkgs/adw-gtk3` and `srcpkgs/font-jetbrains-mono` package upstream releases that Void does not have. - `make packages` lays the templates over a shallow clone of void-packages and builds them with `xbps-src` into `out/hostdir/binpkgs`. The ISO build installs them from there. #### Containerised build **_The whole build runs in a Docker container, so only Docker and QEMU are needed on the host._** 1. `make packages` builds the local xbps repository. 2. `make iso` builds the packages and then the ISO with `void-mklive`, using the profile in `live/` (package list, services, root file system overlay). -3. `make qemu` boots the newest ISO with UEFI. `make qemu-bios` uses legacy BIOS, and `make qemu-disk` also attaches a 20 GB virtual disk. +3. `make qemu` boots the newest ISO with UEFI. `make qemu-bios` uses legacy BIOS, and `make qemu-disk` also attaches a 20 GB virtual disk to install on. ### 🚀 Building the application Requirements: Linux with Docker (the user must be in the `docker` group), QEMU and OVMF for testing, and Go 1.22+ for `make test`. About 10 GB of free disk space. @@ -94,6 +128,6 @@ make clean # remove build output, keep the download cache ``` The ISO appears in `out/iso/dasos--x86_64.iso`. Write it to a USB stick with `dd` or Ventoy. -**Note:** Das OS is an early version (0.1.0) and the live ISO cannot install itself yet. The Calamares installer, Btrfs snapshots with rollback, the Go utilities `das-welcome` and `das-update`, the developer profile and signed repository hosting are planned for upcoming stages. Das OS is based on Void Linux but is not affiliated with it. +**Note:** Das OS is an early version (0.2.0). The Go utilities `das-welcome` and `das-update` (an update with a snapshot taken before it), the developer profile and signed repository hosting are planned for upcoming stages. Until the repository is hosted, an installed system gets updates from Void only. Das OS is based on Void Linux but is not affiliated with it. ###### _Made by -=:dAs:=-_ diff --git a/README_ua.md b/README_ua.md index 5d9b6f4..5c4d40c 100644 --- a/README_ua.md +++ b/README_ua.md @@ -1,15 +1,17 @@ ## Das OS ### _Легкий і дружній десктоп на базі Void Linux з Xfce та українським колоритом_ -[![Void Linux](https://img.shields.io/badge/Void_Linux-x86__64_glibc-green)](https://voidlinux.org) [![Xfce](https://img.shields.io/badge/Xfce-4.20-orange)](https://xfce.org) [![runit](https://img.shields.io/badge/init-runit-blue)](https://docs.voidlinux.org/config/services/) [![Go](https://img.shields.io/badge/Go-1.22+-blue)](https://go.dev) [![Version](https://img.shields.io/badge/version-0.1.0-lightgrey)](#) +[![Void Linux](https://img.shields.io/badge/Void_Linux-x86__64_glibc-green)](https://voidlinux.org) [![Xfce](https://img.shields.io/badge/Xfce-4.20-orange)](https://xfce.org) [![runit](https://img.shields.io/badge/init-runit-blue)](https://docs.voidlinux.org/config/services/) [![Go](https://img.shields.io/badge/Go-1.22+-blue)](https://go.dev) [![Version](https://img.shields.io/badge/version-0.2.0-lightgrey)](#) 🇬🇧 [English version](README.md) ### 💡 Призначення -Void Linux швидкий, простий і незалежний: runit замість systemd і власний менеджер пакетів xbps. Проте з коробки це гола система, і щоб довести її до щоденного використання, треба кілька годин налаштовувати. Das OS збирає live-образ ISO, який одразу завантажується в налаштований десктоп Xfce. У ньому власне оформлення, український інтерфейс і розкладка та звичні програми. Усе, що додає Das OS, постачається власними xbps-пакетами, тож налаштування можна відтворити й оновлювати, як будь-який інший пакет. +Void Linux швидкий, простий і незалежний: runit замість systemd і власний менеджер пакетів xbps. Проте з коробки це гола система, і щоб довести її до щоденного використання, треба кілька годин налаштовувати. Das OS збирає live-образ ISO, який одразу завантажується в налаштований десктоп Xfce і встановлюється графічним інсталятором. У ньому власне оформлення, український інтерфейс і розкладка, звичні програми та знімки Btrfs, які дозволяють скасувати невдале оновлення. Усе, що додає Das OS, постачається власними xbps-пакетами, тож налаштування можна відтворити й оновлювати, як будь-який інший пакет. ### 📃 Можливості - [Live ISO](#LiveISO), що завантажується з UEFI і BIOS одразу в робочий стіл +- [Графічний інсталятор](#Installer) Calamares, налаштований під Void і runit +- [Знімки й відкат](#Snapshots): щогодинні знімки Btrfs, які можна завантажити з меню GRUB - [Оформлення Das OS](#Look): світла й темна теми, згенеровані рамки вікон, шпалери та логотип - [Налаштування за замовчуванням](#Defaults) для Xfce, які не перезаписують стандартні файли - [Власний репозиторій пакетів](#Repository), який xbps-src збирає з шаблонів у дереві проєкту @@ -17,6 +19,7 @@ Void Linux швидкий, простий і незалежний: runit зам ### ⭐ Переваги - **Void усередині** – швидке завантаження з runit, менеджер пакетів xbps і свіжі програми без ручного налаштування. +- **Безпечні оновлення** – систему можна повернути до будь-якого знімка, а особисті файли в `/home` відкат не зачіпає. - **Легкість** – без systemd, а з Xfce, LightDM і PipeWire система добре працює навіть на старих ноутбуках. - **Нічого прихованого** – усі зміни постачаються звичайними xbps-пакетами, і `xbps-query -f das-settings` показує, що саме змінено. - **Контроль у користувача** – налаштування за замовчуванням лежать у `/etc/xdg/das`, тож власні налаштування користувача завжди мають пріоритет і не скидаються після оновлень. @@ -44,6 +47,16 @@ Void Linux швидкий, простий і незалежний: runit зам Темні шпалери Рамки вікон: світлі й темні, активні й неактивні + + Інсталятор + Розмітка диска з Btrfs + Знімки в меню завантаження + + + Інсталятор + Розмітка диска з Btrfs + Знімки в меню завантаження + ### 📌 Використання @@ -56,6 +69,25 @@ Void Linux швидкий, простий і незалежний: runit зам - Український інтерфейс (`uk_UA.UTF-8`) і часовий пояс Києва за замовчуванням. Розкладки `us,ua`, перемикання Alt+Shift. - Є NetworkManager, Bluetooth, звук PipeWire і Firefox з українською мовою. Сервіси працюють під runit: `dbus`, `elogind`, `polkitd`, `NetworkManager`, `bluetoothd`, `lightdm`. - Є гостьові інструменти для QEMU/SPICE та VirtualBox. +- Значок *Встановити Das OS* на робочому столі та в меню запускає інсталятор. + +#### Графічний інсталятор +**_Calamares встановлює Das OS за кілька кроків: мова й часовий пояс, клавіатура, диск, користувач._** +- Інтерфейс за замовчуванням український, часовий пояс Києва, з брендингом і слайдами Das OS. +- Диск можна очистити автоматично або розмітити вручну. За замовчуванням Btrfs, також доступні ext4 і XFS. На комп'ютерах з UEFI створюється EFI-розділ на 512 МіБ. +- Копіюється чистий live-образ (`/dev/mapper/live-base`), без live-користувача і його налаштувань завантаження. +- Після копіювання інсталятор збирає локалі для вибраної мови, на реальному залізі прибирає гостьові інструменти віртуальних машин, налаштовує знімки, збирає initramfs і встановлює GRUB. +- Наприкінці інсталятор видаляє себе й пакети, потрібні лише йому. +- Шифрування диска поки не пропонується. + +#### Знімки й відкат +**_Знімки Btrfs дозволяють відновити систему після невдалого оновлення._** +- Інсталятор створює підтоми `@` (корінь), `@home`, `@snapshots`, `@var_log` і `@var_cache_xbps`. Знімки кореня не містять особистих файлів, журналів і кешу пакетів. +- snapper робить знімок *Fresh install* одразу після встановлення і щогодинні знімки (cron). Зберігаються останні 5 щогодинних, 7 щоденних і 2 щотижневих. +- grub-btrfs додає кожен знімок у підменю *Das OS snapshots* у GRUB і оновлює його, щойно з'являється новий. +- Знімок доступний лише для читання. Коли він завантажується, dracut-модуль `das-snapshot-overlay` накладає зверху записуваний шар у RAM, тож повноцінно працює весь робочий стіл. Зміни, зроблені в такій сесії, зникають після вимкнення. +- `sudo snapper-rollback <номер>` робить знімок новим коренем (старий зберігається як `@<дата>`). Зміна набуває чинності після перезавантаження. Команда працює і з робочої системи, і із завантаженого знімка. +- Учасники групи `wheel` бачать знімки без sudo: `snapper list`. #### Оформлення Das OS **_Сучасний мінімалізм із синьо-жовтою восьмипелюстковою зіркою з української вишивки._** @@ -75,14 +107,16 @@ Void Linux швидкий, простий і незалежний: runit зам **_Кожен файл Das OS встановлює й оновлює xbps._** - `srcpkgs/das-theme` містить теми, рамки xfwm4, шпалери й логотип. - `srcpkgs/das-settings` містить налаштування Xfce, LightDM і сесії. -- `srcpkgs/adw-gtk3` і `srcpkgs/font-jetbrains-mono` пакують релізи з GitHub, яких немає у Void. +- `srcpkgs/das-snapshots` містить конфігурацію snapper, `das-snapper-setup` і dracut-модуль для завантаження знімків. +- `srcpkgs/das-installer` містить налаштування Calamares, брендинг і скрипти встановлення. Він є лише на live-ISO. +- `srcpkgs/calamares`, `srcpkgs/adw-gtk3` і `srcpkgs/font-jetbrains-mono` пакують релізи, яких немає у Void. - `make packages` накладає шаблони на неглибокий клон void-packages і збирає їх через `xbps-src` в `out/hostdir/binpkgs`. Збирання ISO встановлює їх звідти. #### Збирання в контейнері **_Усе збирання відбувається в Docker-контейнері, тож на хості потрібні лише Docker і QEMU._** 1. `make packages` збирає локальний xbps-репозиторій. 2. `make iso` збирає пакети, а потім ISO через `void-mklive` за профілем у `live/` (список пакетів, сервіси, оверлей кореневої файлової системи). -3. `make qemu` завантажує найновіший ISO з UEFI. `make qemu-bios` використовує старий BIOS, а `make qemu-disk` ще й підключає віртуальний диск на 20 ГБ. +3. `make qemu` завантажує найновіший ISO з UEFI. `make qemu-bios` використовує старий BIOS, а `make qemu-disk` ще й підключає віртуальний диск на 20 ГБ для встановлення. ### 🚀 Збирання застосунку Вимоги: Linux із Docker (користувач має бути в групі `docker`), QEMU та OVMF для тестування, Go 1.22+ для `make test`. Приблизно 10 ГБ вільного місця. @@ -94,6 +128,6 @@ make clean # видалити результати збиранн ``` ISO з'являється в `out/iso/dasos-<версія>-x86_64.iso`. Записати його на флешку можна через `dd` або Ventoy. -**Примітка:** Das OS — рання версія (0.1.0), і live-ISO поки не вміє встановлюватися на диск. Інсталятор Calamares, знімки Btrfs із відкатом, Go-утиліти `das-welcome` і `das-update`, профіль розробника та підписаний репозиторій на хостингу заплановані на наступні етапи. Das OS базується на Void Linux, але не пов'язана з ним офіційно. +**Примітка:** Das OS — рання версія (0.2.0). Go-утиліти `das-welcome` і `das-update` (оновлення зі знімком перед ним), профіль розробника та підписаний репозиторій на хостингу заплановані на наступні етапи. Поки репозиторій не розміщено на хостингу, встановлена система отримує оновлення лише з Void. Das OS базується на Void Linux, але не пов'язана з ним офіційно. ###### _Made by -=:dAs:=-_ diff --git a/VERSION b/VERSION index 6e8bf73..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.2.0 diff --git a/images/grub-snapshots.png b/images/grub-snapshots.png new file mode 100644 index 0000000..eac371b Binary files /dev/null and b/images/grub-snapshots.png differ diff --git a/images/installer-partitions.png b/images/installer-partitions.png new file mode 100644 index 0000000..1cf1910 Binary files /dev/null and b/images/installer-partitions.png differ diff --git a/images/installer-welcome.png b/images/installer-welcome.png new file mode 100644 index 0000000..809fefb Binary files /dev/null and b/images/installer-welcome.png differ diff --git a/live/branding/issue b/live/branding/issue new file mode 100644 index 0000000..741ca52 --- /dev/null +++ b/live/branding/issue @@ -0,0 +1,2 @@ +Das OS \r (\l) + diff --git a/live/packages.x86_64 b/live/packages.x86_64 index 443e426..804a486 100644 --- a/live/packages.x86_64 +++ b/live/packages.x86_64 @@ -41,14 +41,19 @@ udisks2 xdg-user-dirs xdg-utils -# System tools for the live medium +# Boot loader and disk tools, also kept by the installed system btrfs-progs cryptsetup dosfstools +efibootmgr gptfdisk +grub +grub-x86_64-efi ntfs-3g +os-prober parted sudo +xfsprogs # Virtual machine guests qemu-ga @@ -56,5 +61,7 @@ spice-vdagent virtualbox-ose-guest # Das OS (local repository) +das-installer das-settings +das-snapshots das-theme diff --git a/scripts/container/build-iso.sh b/scripts/container/build-iso.sh index 153542d..6346c8e 100755 --- a/scripts/container/build-iso.sh +++ b/scripts/container/build-iso.sh @@ -43,6 +43,9 @@ for pattern in 'echo void-live >' 'voidlinux'; do fi done sed -i -e 's/echo void-live >/echo dasos >/' -e 's/voidlinux/live/g' "$adduser" +# mklive copies its /etc/issue (Void live logins) into the image, and the +# installer copies the image to disk, so use a neutral Das OS one. +cp /work/live/branding/issue /opt/void-mklive/data/issue rsvg-convert /work/live/branding/splash.svg --output "$work/splash.png" rm -f "$iso" diff --git a/scripts/container/build-packages.sh b/scripts/container/build-packages.sh index e81ad99..72d8546 100755 --- a/scripts/container/build-packages.sh +++ b/scripts/container/build-packages.sh @@ -50,6 +50,9 @@ cd "$vp" if [[ ! -f masterdir-x86_64/.xbps_chroot_init ]]; then as_builder ./xbps-src -H "$hostdir" binary-bootstrap fi +# A failed build leaves its destdir behind, and the next build of that package +# (also as a dependency of another one) would package the stale files +rm -rf masterdir-x86_64/destdir/* for name in "${names[@]}"; do echo "==> Building $name" as_builder ./xbps-src -H "$hostdir" -f pkg "$name" diff --git a/srcpkgs/calamares/template b/srcpkgs/calamares/template new file mode 100644 index 0000000..85ab258 --- /dev/null +++ b/srcpkgs/calamares/template @@ -0,0 +1,22 @@ +# Template file for 'calamares' +pkgname=calamares +version=3.4.3 +revision=2 +build_style=cmake +configure_args="-DWITH_QT6=ON -DWITH_QML=OFF -DWITH_PYTHON=ON -DWITH_PYBIND11=ON + -DINSTALL_CONFIG=OFF -DBUILD_TESTING=OFF -DBUILD_SCHEMA_TESTING=OFF + -DBUILD_CRASH_REPORTING=OFF -DCMAKE_INSTALL_LIBEXECDIR=libexec + -DUSE_services=none + -DSKIP_MODULES=dummycpp;dummyprocess;dummypython;initcpio;initcpiocfg;mkinitfs;openrcdmcryptcfg;plasmalnf;plymouthcfg;tracking;zfs;zfshostid;interactiveterminal" +hostmakedepends="extra-cmake-modules gettext pkg-config python3 qt6-base qt6-tools" +makedepends="icu-devel kf6-kcoreaddons-devel kpmcore-devel libparted-devel + libpwquality-devel libxcrypt-devel polkit-qt6-devel python3-devel qt6-base-devel + qt6-svg-devel qt6-tools-devel yaml-cpp-devel" +depends="ckbcomp kpmcore polkit python3 qt6-plugin-tls-openssl qt6-svg rsync + squashfs-tools xkeyboard-config" +short_desc="Distribution-independent installer framework" +maintainer="Das " +license="GPL-3.0-or-later" +homepage="https://calamares.codeberg.page" +distfiles="https://codeberg.org/Calamares/calamares/releases/download/v${version}/calamares-${version}.tar.gz" +checksum=144cbbf6bdcebfb21685950db4f0777218519df095f62f4aa392f28348110d18 diff --git a/srcpkgs/das-installer/files/LICENSE b/srcpkgs/das-installer/files/LICENSE new file mode 120000 index 0000000..5853aae --- /dev/null +++ b/srcpkgs/das-installer/files/LICENSE @@ -0,0 +1 @@ +../../../LICENSE \ No newline at end of file diff --git a/srcpkgs/das-installer/files/calamares/branding/dasos/branding.desc b/srcpkgs/das-installer/files/calamares/branding/dasos/branding.desc new file mode 100644 index 0000000..de7c469 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/branding/dasos/branding.desc @@ -0,0 +1,37 @@ +--- +componentName: dasos + +welcomeStyleCalamares: false +welcomeExpandingLogo: true +windowExpanding: normal +windowSize: 960px,640px +windowPlacement: center +sidebar: widget +navigation: widget + +strings: + productName: "Das OS" + shortProductName: "Das OS" + version: "0.2.0" + shortVersion: "0.2" + versionedName: "Das OS 0.2.0" + shortVersionedName: "Das OS 0.2" + bootloaderEntryName: "Das OS" + productUrl: "https://git.das.org.ua/das/Das-OS" + supportUrl: "https://git.das.org.ua/das/Das-OS/issues" + +images: + productIcon: "/usr/share/icons/hicolor/scalable/apps/das-logo.svg" + productLogo: "/usr/share/icons/hicolor/scalable/apps/das-logo.svg" + productWelcome: "welcome.svg" + +slideshow: + - "slide-1.svg" + - "slide-2.svg" + - "slide-3.svg" + +style: + SidebarBackground: "#1b1f27" + SidebarText: "#e3e6ec" + SidebarTextCurrent: "#1b1f27" + SidebarBackgroundCurrent: "#ffd23f" diff --git a/srcpkgs/das-installer/files/calamares/branding/dasos/slide-1.svg b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-1.svg new file mode 100644 index 0000000..07613d3 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-1.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + Ласкаво просимо! + Das OS — легка система на Void Linux + з робочим столом Xfce, українською + мовою та звичними програмами. + + + diff --git a/srcpkgs/das-installer/files/calamares/branding/dasos/slide-2.svg b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-2.svg new file mode 100644 index 0000000..e9ef142 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-2.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + Знімки системи + Btrfs і snapper щогодини зберігають + стан системи. Попередній знімок можна + завантажити з меню GRUB і повернути + командою sudo snapper-rollback. + + diff --git a/srcpkgs/das-installer/files/calamares/branding/dasos/slide-3.svg b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-3.svg new file mode 100644 index 0000000..94cd296 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/branding/dasos/slide-3.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + Ваші файли в безпеці + Домашня тека лежить в окремому + підтомі й не входить до знімків, + тому відкат системи її не зачіпає. + + + diff --git a/srcpkgs/das-installer/files/calamares/branding/dasos/welcome.svg b/srcpkgs/das-installer/files/calamares/branding/dasos/welcome.svg new file mode 100644 index 0000000..8d32d05 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/branding/dasos/welcome.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + Das OS + diff --git a/srcpkgs/das-installer/files/calamares/modules/bootloader.conf b/srcpkgs/das-installer/files/calamares/modules/bootloader.conf new file mode 100644 index 0000000..b37bfd9 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/bootloader.conf @@ -0,0 +1,13 @@ +--- +efiBootLoader: "grub" +kernelSearchPath: "/boot" +kernelPattern: "^vmlinuz.*" +kernelParams: [ "quiet", "loglevel=3" ] +grubInstall: "grub-install" +grubMkconfig: "grub-mkconfig" +grubCfg: "/boot/grub/grub.cfg" +grubProbe: "grub-probe" +efiBootMgr: "efibootmgr" +efiBootloaderId: "dasos" +installEFIFallback: true +installHybridGRUB: false diff --git a/srcpkgs/das-installer/files/calamares/modules/displaymanager.conf b/srcpkgs/das-installer/files/calamares/modules/displaymanager.conf new file mode 100644 index 0000000..ddb8757 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/displaymanager.conf @@ -0,0 +1,10 @@ +--- +displaymanagers: + - lightdm +defaultDesktopEnvironment: + executable: "startxfce4" + desktopFile: "xfce" +basicSetup: false +sysconfigSetup: false +lightdm: + preferred_greeters: ["lightdm-gtk-greeter.desktop"] diff --git a/srcpkgs/das-installer/files/calamares/modules/finished.conf b/srcpkgs/das-installer/files/calamares/modules/finished.conf new file mode 100644 index 0000000..3137fb4 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/finished.conf @@ -0,0 +1,4 @@ +--- +restartNowMode: user-unchecked +restartNowCommand: "loginctl reboot" +notifyOnFinished: false diff --git a/srcpkgs/das-installer/files/calamares/modules/fstab.conf b/srcpkgs/das-installer/files/calamares/modules/fstab.conf new file mode 100644 index 0000000..ffc78c3 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/fstab.conf @@ -0,0 +1,9 @@ +--- +crypttabOptions: luks +tmpOptions: + default: + tmpfs: true + options: "defaults,nosuid,nodev,mode=1777" + ssd: + tmpfs: true + options: "defaults,noatime,nosuid,nodev,mode=1777" diff --git a/srcpkgs/das-installer/files/calamares/modules/grubcfg.conf b/srcpkgs/das-installer/files/calamares/modules/grubcfg.conf new file mode 100644 index 0000000..15ecb45 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/grubcfg.conf @@ -0,0 +1,13 @@ +--- +overwrite: false +prefer_grub_d: false +keep_distributor: false +kernel_params: [ "quiet", "loglevel=3" ] +defaults: + GRUB_TIMEOUT: 5 + GRUB_DEFAULT: "saved" + GRUB_DISABLE_SUBMENU: true + GRUB_TERMINAL_OUTPUT: "console" + GRUB_DISABLE_RECOVERY: true + GRUB_DISABLE_OS_PROBER: false +always_use_defaults: false diff --git a/srcpkgs/das-installer/files/calamares/modules/keyboard.conf b/srcpkgs/das-installer/files/calamares/modules/keyboard.conf new file mode 100644 index 0000000..3f2c3b7 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/keyboard.conf @@ -0,0 +1,7 @@ +--- +xOrgConfFileName: "/etc/X11/xorg.conf.d/00-keyboard.conf" +convertedKeymapPath: "/usr/share/kbd/keymaps/xkb" +writeEtcDefaultKeyboard: false +configure: + kwin: false + gnome: false diff --git a/srcpkgs/das-installer/files/calamares/modules/locale.conf b/srcpkgs/das-installer/files/calamares/modules/locale.conf new file mode 100644 index 0000000..2b19fea --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/locale.conf @@ -0,0 +1,5 @@ +--- +region: "Europe" +zone: "Kyiv" +geoip: + style: none diff --git a/srcpkgs/das-installer/files/calamares/modules/machineid.conf b/srcpkgs/das-installer/files/calamares/modules/machineid.conf new file mode 100644 index 0000000..26c390b --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/machineid.conf @@ -0,0 +1,6 @@ +# Void has no systemd: only D-Bus needs a machine id (/var/lib/dbus/machine-id). +--- +systemd: false +dbus: true +dbus-symlink: false +entropy-copy: false diff --git a/srcpkgs/das-installer/files/calamares/modules/mount.conf b/srcpkgs/das-installer/files/calamares/modules/mount.conf new file mode 100644 index 0000000..9d9a159 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/mount.conf @@ -0,0 +1,48 @@ +--- +extraMounts: + - device: proc + fs: proc + mountPoint: /proc + - device: sys + fs: sysfs + mountPoint: /sys + - device: /dev + mountPoint: /dev + options: [ bind ] + - device: tmpfs + fs: tmpfs + mountPoint: /run + - device: /run/udev + mountPoint: /run/udev + options: [ bind ] + - device: efivarfs + fs: efivarfs + mountPoint: /sys/firmware/efi/efivars + efi: true + +# The flat layout that snapper-rollback expects: the root in @ and snapshots +# in @snapshots. Home, logs and the package cache stay out of root snapshots, +# so a rollback never touches personal files. +btrfsSubvolumes: + - mountPoint: / + subvolume: /@ + - mountPoint: /home + subvolume: /@home + - mountPoint: /.snapshots + subvolume: /@snapshots + - mountPoint: /var/log + subvolume: /@var_log + - mountPoint: /var/cache/xbps + subvolume: /@var_cache_xbps + +mountOptions: + - filesystem: default + options: [ defaults ] + - filesystem: efi + options: [ defaults, umask=0077 ] + - filesystem: btrfs + options: [ defaults, noatime, compress=zstd:1 ] + - filesystem: ext4 + options: [ defaults, noatime ] + - filesystem: xfs + options: [ defaults, noatime ] diff --git a/srcpkgs/das-installer/files/calamares/modules/packages.conf b/srcpkgs/das-installer/files/calamares/modules/packages.conf new file mode 100644 index 0000000..d2d9643 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/packages.conf @@ -0,0 +1,10 @@ +# The target is a copy of the live system: drop the installer and whatever was +# installed only for it. +--- +backend: xbps +skip_if_no_internet: false +update_db: false +update_system: false +operations: + - try_remove: + - das-installer diff --git a/srcpkgs/das-installer/files/calamares/modules/partition.conf b/srcpkgs/das-installer/files/calamares/modules/partition.conf new file mode 100644 index 0000000..e9220e9 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/partition.conf @@ -0,0 +1,29 @@ +--- +efi: + mountPoint: "/boot/efi" + recommendedSize: 512MiB + minimumSize: 64MiB + label: "EFI" + +userSwapChoices: + - none + - small + - suspend +initialSwapChoice: none + +drawNestedPartitions: false +alwaysShowPartitionLabels: true +allowManualPartitioning: true +initialPartitioningChoice: none + +# Btrfs subvolumes (see mount.conf) give snapper snapshots and rollback. +defaultFileSystemType: "btrfs" +availableFileSystemTypes: [ "btrfs", "ext4", "xfs" ] + +# Disk encryption needs extra initramfs and GRUB setup that Das OS does not +# have yet. +enableLuksAutomatedPartitioning: false + +essentialMounts: [ "live-*", "control", "ventoy" ] +lvm: + enable: false diff --git a/srcpkgs/das-installer/files/calamares/modules/shellprocess-postinstall.conf b/srcpkgs/das-installer/files/calamares/modules/shellprocess-postinstall.conf new file mode 100644 index 0000000..32bfef9 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/shellprocess-postinstall.conf @@ -0,0 +1,7 @@ +--- +dontChroot: false +timeout: 900 +verbose: true +script: + - command: "/usr/libexec/das/installer/postinstall" + timeout: 900 diff --git a/srcpkgs/das-installer/files/calamares/modules/shellprocess-snapshot.conf b/srcpkgs/das-installer/files/calamares/modules/shellprocess-snapshot.conf new file mode 100644 index 0000000..d05b2f1 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/shellprocess-snapshot.conf @@ -0,0 +1,9 @@ +# The first snapshot is the freshly installed system. grub-mkconfig then adds +# it to the boot menu through grub-btrfs. +--- +dontChroot: false +timeout: 300 +verbose: true +script: + - "-snapper --no-dbus -c root create -d 'Fresh install' -c number --userdata important=yes" + - "-grub-mkconfig -o /boot/grub/grub.cfg" diff --git a/srcpkgs/das-installer/files/calamares/modules/shellprocess-source.conf b/srcpkgs/das-installer/files/calamares/modules/shellprocess-source.conf new file mode 100644 index 0000000..b8aba39 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/shellprocess-source.conf @@ -0,0 +1,5 @@ +--- +dontChroot: true +timeout: 60 +script: + - "/usr/libexec/das/installer/mount-source" diff --git a/srcpkgs/das-installer/files/calamares/modules/unpackfs.conf b/srcpkgs/das-installer/files/calamares/modules/unpackfs.conf new file mode 100644 index 0000000..114fb68 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/unpackfs.conf @@ -0,0 +1,7 @@ +# Copy the clean live image that shellprocess@source mounts, not the running +# live root (see mount-source). +--- +unpack: + - source: "/run/das-installer/root" + sourcefs: "file" + destination: "" diff --git a/srcpkgs/das-installer/files/calamares/modules/users.conf b/srcpkgs/das-installer/files/calamares/modules/users.conf new file mode 100644 index 0000000..634acb5 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/users.conf @@ -0,0 +1,53 @@ +--- +defaultGroups: + - name: users + must_exist: true + system: true + - name: wheel + must_exist: true + system: true + - audio + - video + - input + - storage + - network + - optical + - scanner + - lp + - kvm + - plugdev + - name: bluetooth + must_exist: false + system: true + +sudoersGroup: wheel +sudoersConfigureWithGroup: true +autologinGroup: autologin + +setRootPassword: true +doReusePassword: true +displayAutologin: true +doAutologin: false + +passwordRequirements: + minLength: 4 + maxLength: -1 +allowWeakPasswords: true +allowWeakPasswordsDefault: true + +user: + shell: /bin/bash + forbidden_names: [ root, live ] + home_permissions: "o700" + +hostname: + location: EtcFile + writeHostsFile: true + template: "${login}-dasos" + forbidden_names: [ localhost ] + +presets: + fullName: + editable: true + loginName: + editable: true diff --git a/srcpkgs/das-installer/files/calamares/modules/welcome.conf b/srcpkgs/das-installer/files/calamares/modules/welcome.conf new file mode 100644 index 0000000..06b427d --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/modules/welcome.conf @@ -0,0 +1,24 @@ +--- +showSupportUrl: true +showKnownIssuesUrl: false +showReleaseNotesUrl: false +showDonateUrl: false + +requirements: + requiredStorage: 15 + requiredRam: 1.5 + internetCheckUrl: https://voidlinux.org + check: + - storage + - ram + - power + - internet + - root + - screen + required: + - storage + - ram + - root + +geoip: + style: none diff --git a/srcpkgs/das-installer/files/calamares/settings.conf b/srcpkgs/das-installer/files/calamares/settings.conf new file mode 100644 index 0000000..82af0d3 --- /dev/null +++ b/srcpkgs/das-installer/files/calamares/settings.conf @@ -0,0 +1,54 @@ +# Calamares settings for Das OS (Void Linux, runit). +--- +modules-search: [ local ] + +instances: +- id: source + module: shellprocess + config: shellprocess-source.conf +- id: postinstall + module: shellprocess + config: shellprocess-postinstall.conf +- id: snapshot + module: shellprocess + config: shellprocess-snapshot.conf + +sequence: +- show: + - welcome + - locale + - keyboard + - partition + - users + - summary +- exec: + - partition + - mount + - shellprocess@source + - unpackfs + - machineid + - locale + - keyboard + - localecfg + - fstab + - users + - displaymanager + - networkcfg + - hwclock + - grubcfg + - shellprocess@postinstall + - packages + - bootloader + - shellprocess@snapshot + - umount +- show: + - finished + +branding: dasos +prompt-install: true +dont-chroot: false +oem-setup: false +disable-cancel: false +disable-cancel-during-exec: false +hide-back-and-next-during-exec: true +quit-at-end: false diff --git a/srcpkgs/das-installer/files/das-install b/srcpkgs/das-installer/files/das-install new file mode 100755 index 0000000..73f8173 --- /dev/null +++ b/srcpkgs/das-installer/files/das-install @@ -0,0 +1,4 @@ +#!/bin/sh +# Start the Das OS installer as root. The live user has passwordless sudo. +exec sudo --preserve-env=DISPLAY,XAUTHORITY,LANG,LANGUAGE,LC_ALL \ + /usr/bin/calamares "$@" diff --git a/srcpkgs/das-installer/files/das-installer-icon.desktop b/srcpkgs/das-installer/files/das-installer-icon.desktop new file mode 100644 index 0000000..78c837f --- /dev/null +++ b/srcpkgs/das-installer/files/das-installer-icon.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Das OS installer icon +Comment=Put the installer on the live desktop +Exec=/usr/libexec/das/installer/installer-icon +OnlyShowIn=XFCE; +NoDisplay=true diff --git a/srcpkgs/das-installer/files/das-installer.desktop b/srcpkgs/das-installer/files/das-installer.desktop new file mode 100644 index 0000000..342e491 --- /dev/null +++ b/srcpkgs/das-installer/files/das-installer.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=Install Das OS +Name[uk]=Встановити Das OS +Comment=Install Das OS on this computer +Comment[uk]=Встановити Das OS на цей комп'ютер +Exec=das-install +Icon=das-logo +Terminal=false +Categories=System; +Keywords=installer;calamares; +Keywords[uk]=встановлення;інсталятор;calamares; diff --git a/srcpkgs/das-installer/files/installer-icon b/srcpkgs/das-installer/files/installer-icon new file mode 100755 index 0000000..3d148fe --- /dev/null +++ b/srcpkgs/das-installer/files/installer-icon @@ -0,0 +1,12 @@ +#!/bin/sh +# Put the installer launcher on the live user's desktop. Xfce runs launchers +# from the desktop only when they are executable and marked as trusted. +desktop=$(xdg-user-dir DESKTOP 2>/dev/null) +[ -n "$desktop" ] && [ "$desktop" != "$HOME" ] || desktop="$HOME/Desktop" +launcher="$desktop/das-installer.desktop" +[ -e "$launcher" ] && exit 0 + +mkdir -p "$desktop" +install -m 755 /usr/share/applications/das-installer.desktop "$launcher" +gio set -t string "$launcher" metadata::xfce-exe-checksum \ + "$(sha256sum "$launcher" | cut -d' ' -f1)" 2>/dev/null || true diff --git a/srcpkgs/das-installer/files/mount-source b/srcpkgs/das-installer/files/mount-source new file mode 100755 index 0000000..bdf4e75 --- /dev/null +++ b/srcpkgs/das-installer/files/mount-source @@ -0,0 +1,17 @@ +#!/bin/sh +# Mount the clean live image for Calamares' unpackfs at /run/das-installer/root. +# +# Dracut runs the live root as a device-mapper snapshot (live-rw) that also +# holds the live user and boot-time tweaks. Its origin, live-base, is the +# untouched LiveOS/rootfs.img; mount it read-only without journal replay. +set -eu + +root=/run/das-installer/root +mountpoint -q "$root" && exit 0 + +if [ ! -b /dev/mapper/live-base ]; then + echo "mount-source: /dev/mapper/live-base not found, is this the live system?" >&2 + exit 1 +fi +mkdir -p "$root" +mount -o ro,noload /dev/mapper/live-base "$root" diff --git a/srcpkgs/das-installer/files/postinstall b/srcpkgs/das-installer/files/postinstall new file mode 100755 index 0000000..b01cbd6 --- /dev/null +++ b/srcpkgs/das-installer/files/postinstall @@ -0,0 +1,49 @@ +#!/bin/sh +# Finish a Das OS installation. Calamares runs this inside the target system +# after users, locale and display manager are configured, before GRUB. +set -eu + +msg() { echo "das-postinstall: $*"; } + +# Calamares writes LANG to /etc/locale.conf, but glibc on Void only builds the +# locales enabled in /etc/default/libc-locales. +lang=$(sed -n 's/^LANG=//p' /etc/locale.conf 2>/dev/null | tr -d '"') +for l in "$lang" en_US.UTF-8; do + [ -n "$l" ] || continue + re=$(printf '%s' "$l" | sed 's/[.]/\\./g') + sed -i "s/^#\(${re} \)/\1/" /etc/default/libc-locales +done +msg "building locales" +xbps-reconfigure -f glibc-locales + +# Calamares mounts /tmp on tmpfs only when the root disk is an SSD; Void's own +# installer always does. +if ! grep -q '^[^#]*[[:space:]]/tmp[[:space:]]' /etc/fstab; then + echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >>/etc/fstab +fi + +# Guest tools are only useful inside a virtual machine. +if ! grep -q '^flags.* hypervisor' /proc/cpuinfo; then + msg "real hardware: removing virtual machine guest tools" + rm -f /etc/runit/runsvdir/default/spice-vdagentd + xbps-remove -Ry spice-vdagent qemu-ga virtualbox-ose-guest || true +fi + +# Snapper, hourly snapshots and the GRUB snapshot menu (Btrfs only). +das-snapper-setup + +# The installer copies files with rsync --sparse, which turns the zero tail of +# a kernel image into a Btrfs hole that GRUB 2.12 can't read ("premature end +# of file"). Rewrite the kernels in full. +for f in /boot/vmlinuz-*; do + cp --sparse=never "$f" "$f.das-tmp" + mv "$f.das-tmp" "$f" +done + +# The live image has a generic initramfs. Build the target's own the same way +# Void does on kernel updates (host-only), with das-snapshot-overlay included. +msg "building the initramfs" +for kver in $(ls /usr/lib/modules); do + dracut -q --force "/boot/initramfs-$kver.img" "$kver" +done +msg "done" diff --git a/srcpkgs/das-installer/template b/srcpkgs/das-installer/template new file mode 100644 index 0000000..5d5ed6a --- /dev/null +++ b/srcpkgs/das-installer/template @@ -0,0 +1,22 @@ +# Template file for 'das-installer' +pkgname=das-installer +version=0.1.0 +revision=1 +depends="calamares das-snapshots das-theme sudo" +short_desc="Das OS installer: Calamares configuration and branding for the live ISO" +maintainer="Das " +license="MIT" +homepage="https://git.das.org.ua/das/Das-OS" + +do_install() { + local f + vmkdir usr/share/calamares + vcopy "${FILESDIR}/calamares/*" usr/share/calamares + vbin ${FILESDIR}/das-install + vinstall ${FILESDIR}/postinstall 755 usr/libexec/das/installer + vinstall ${FILESDIR}/mount-source 755 usr/libexec/das/installer + vinstall ${FILESDIR}/installer-icon 755 usr/libexec/das/installer + vinstall ${FILESDIR}/das-installer.desktop 644 usr/share/applications + vinstall ${FILESDIR}/das-installer-icon.desktop 644 etc/xdg/autostart + vlicense ${FILESDIR}/LICENSE +} diff --git a/srcpkgs/das-settings/files/lightdm/sv-conf b/srcpkgs/das-settings/files/lightdm/sv-conf new file mode 100644 index 0000000..10c563e --- /dev/null +++ b/srcpkgs/das-settings/files/lightdm/sv-conf @@ -0,0 +1,8 @@ +# Sourced by /etc/sv/lightdm/run (installed by das-settings). +# runit starts services with an empty environment, so pass the system language +# from /etc/locale.conf to LightDM: the greeter and new sessions use it. +if [ -r /etc/locale.conf ]; then + set -a + . /etc/locale.conf + set +a +fi diff --git a/srcpkgs/das-settings/template b/srcpkgs/das-settings/template index 87fbd71..dbbf258 100644 --- a/srcpkgs/das-settings/template +++ b/srcpkgs/das-settings/template @@ -4,7 +4,7 @@ # Defaults go to /etc/xdg/das, which /etc/profile.d/das-xdg.sh puts in front of # /etc/xdg: stock Xfce files stay untouched and users' own changes still win. pkgname=das-settings -version=0.1.0 +version=0.2.0 revision=1 create_wrksrc=yes depends="das-theme lightdm lightdm-gtk-greeter xfce4-notifyd xfce4-panel @@ -14,7 +14,7 @@ short_desc="Das OS desktop defaults: Xfce panel, theme, fonts, login screen" maintainer="Das " license="MIT" homepage="https://git.das.org.ua/das/Das-OS" -conf_files="/etc/profile.d/das-xdg.sh /etc/xdg/das/xfce4/xfconf/xfce-perchannel-xml/*.xml" +conf_files="/etc/profile.d/das-xdg.sh /etc/sv/lightdm/conf /etc/xdg/das/xfce4/xfconf/xfce-perchannel-xml/*.xml" do_install() { local xml @@ -28,6 +28,7 @@ do_install() { vinstall "${FILESDIR}/autostart/das-session-init.desktop" 644 etc/xdg/autostart vinstall "${FILESDIR}/lightdm/50-das.conf" 644 usr/share/lightdm/lightdm.conf.d + vinstall "${FILESDIR}/lightdm/sv-conf" 644 etc/sv/lightdm conf vinstall "${FILESDIR}/lightdm/50-das-greeter.conf" 644 \ usr/share/lightdm/lightdm-gtk-greeter.conf.d 50-das.conf vlicense "${FILESDIR}/LICENSE" diff --git a/srcpkgs/das-snapshots/files/LICENSE b/srcpkgs/das-snapshots/files/LICENSE new file mode 120000 index 0000000..5853aae --- /dev/null +++ b/srcpkgs/das-snapshots/files/LICENSE @@ -0,0 +1 @@ +../../../LICENSE \ No newline at end of file diff --git a/srcpkgs/das-snapshots/files/das-snapper-setup b/srcpkgs/das-snapshots/files/das-snapper-setup new file mode 100755 index 0000000..4a0dafc --- /dev/null +++ b/srcpkgs/das-snapshots/files/das-snapper-setup @@ -0,0 +1,49 @@ +#!/bin/sh +# Set up snapper for a Das OS root file system on Btrfs. +# +# Expects the layout created by the installer: the root in subvolume @ and +# snapshots in subvolume @snapshots mounted at /.snapshots, which is what +# snapper-rollback needs. Safe to run again. +set -eu + +msg() { echo "das-snapper-setup: $*"; } + +if [ "$(id -u)" -ne 0 ]; then + msg "must be run as root" >&2 + exit 1 +fi +if [ "$(findmnt -no FSTYPE /)" != btrfs ]; then + msg "the root file system is not Btrfs, nothing to do" + exit 0 +fi +if [ "$(findmnt -no FSTYPE /.snapshots 2>/dev/null)" != btrfs ]; then + msg "/.snapshots is not a mounted Btrfs subvolume" >&2 + exit 1 +fi + +if [ ! -e /etc/snapper/configs/root ]; then + install -m 640 /usr/share/das/snapper/root /etc/snapper/configs/root + msg "created /etc/snapper/configs/root" +fi +if ! grep -q '^SNAPPER_CONFIGS=".*\broot\b' /etc/conf.d/snapper; then + sed -i 's/^SNAPPER_CONFIGS=.*/SNAPPER_CONFIGS="root"/' /etc/conf.d/snapper +fi +chmod 750 /.snapshots +chgrp wheel /.snapshots + +# snapper-rollback mounts the top-level subvolume from this device. +dev=$(findmnt -no SOURCE / | sed 's/\[.*\]$//') +uuid=$(blkid -s UUID -o value "$dev") +sed -i "s|^#\?\s*dev = .*|dev = /dev/disk/by-uuid/$uuid|" /etc/snapper-rollback.conf + +# Name the GRUB submenu that grub-btrfs adds +cfg=/etc/default/grub-btrfs/config +if [ -f "$cfg" ] && ! grep -q '^GRUB_BTRFS_SUBMENUNAME=' "$cfg"; then + echo 'GRUB_BTRFS_SUBMENUNAME="Das OS snapshots"' >>"$cfg" +fi + +# Hourly snapshots come from cron, and grub-btrfs adds them to the boot menu. +for sv in cronie grub-btrfs; do + ln -sfn "/etc/sv/$sv" "/etc/runit/runsvdir/default/$sv" +done +msg "snapshots are enabled" diff --git a/srcpkgs/das-snapshots/files/das-snapshots.conf b/srcpkgs/das-snapshots/files/das-snapshots.conf new file mode 100644 index 0000000..6093caf --- /dev/null +++ b/srcpkgs/das-snapshots/files/das-snapshots.conf @@ -0,0 +1,2 @@ +# Lets a read-only snapper snapshot boot from the GRUB menu (see das-snapshot-overlay). +add_dracutmodules+=" das-snapshot-overlay " diff --git a/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/das-snapshot-overlay.sh b/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/das-snapshot-overlay.sh new file mode 100755 index 0000000..72bd473 --- /dev/null +++ b/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/das-snapshot-overlay.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Snapper snapshots are read-only, and the system can't start from a read-only +# root. When GRUB boots a snapshot, mount it under an overlay whose writable +# layer lives in RAM. Changes made in that session are lost at shutdown. + +[ "$(btrfs property get -ts "$NEWROOT" ro 2>/dev/null)" = "ro=true" ] || return 0 + +info "das-snapshot-overlay: read-only snapshot, adding a writable overlay" +lower=$(mktemp -d -p /) +ram=$(mktemp -d -p /) +mount --move "$NEWROOT" "$lower" +mount -t tmpfs -o mode=0755 das-overlay "$ram" +mkdir -p "$ram/upper" "$ram/work" +mount -t overlay -o "lowerdir=$lower,upperdir=$ram/upper,workdir=$ram/work" das-overlay "$NEWROOT" diff --git a/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/module-setup.sh b/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/module-setup.sh new file mode 100755 index 0000000..0acccde --- /dev/null +++ b/srcpkgs/das-snapshots/files/dracut/90das-snapshot-overlay/module-setup.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Dracut module: boot read-only Btrfs snapshots with a writable overlay in RAM. + +check() { + require_binaries btrfs || return 1 + return 0 +} + +depends() { + echo btrfs +} + +installkernel() { + hostonly='' instmods overlay +} + +install() { + inst_multiple btrfs mktemp + inst_hook pre-pivot 10 "$moddir/das-snapshot-overlay.sh" +} diff --git a/srcpkgs/das-snapshots/files/snapper-root.conf b/srcpkgs/das-snapshots/files/snapper-root.conf new file mode 100644 index 0000000..1e54b86 --- /dev/null +++ b/srcpkgs/das-snapshots/files/snapper-root.conf @@ -0,0 +1,37 @@ +# Snapper configuration for the Das OS root file system. +# das-snapper-setup copies it to /etc/snapper/configs/root. + +SUBVOLUME="/" +FSTYPE="btrfs" +QGROUP="" + +# Snapshots may use at most half of the file system and must leave 20% free. +SPACE_LIMIT="0.5" +FREE_LIMIT="0.2" + +# Members of wheel can list and compare snapshots without sudo. +ALLOW_USERS="" +ALLOW_GROUPS="wheel" +SYNC_ACL="yes" + +BACKGROUND_COMPARISON="yes" + +# Snapshots made by das-update and by hand. +NUMBER_CLEANUP="yes" +NUMBER_MIN_AGE="3600" +NUMBER_LIMIT="20" +NUMBER_LIMIT_IMPORTANT="10" + +# Hourly snapshots made by cron. +TIMELINE_CREATE="yes" +TIMELINE_CLEANUP="yes" +TIMELINE_MIN_AGE="3600" +TIMELINE_LIMIT_HOURLY="5" +TIMELINE_LIMIT_DAILY="7" +TIMELINE_LIMIT_WEEKLY="2" +TIMELINE_LIMIT_MONTHLY="0" +TIMELINE_LIMIT_QUARTERLY="0" +TIMELINE_LIMIT_YEARLY="0" + +EMPTY_PRE_POST_CLEANUP="yes" +EMPTY_PRE_POST_MIN_AGE="3600" diff --git a/srcpkgs/das-snapshots/template b/srcpkgs/das-snapshots/template new file mode 100644 index 0000000..e8d7237 --- /dev/null +++ b/srcpkgs/das-snapshots/template @@ -0,0 +1,20 @@ +# Template file for 'das-snapshots' +pkgname=das-snapshots +version=0.1.0 +revision=1 +depends="btrfs-progs cronie dracut grub-btrfs snapper snapper-rollback" +short_desc="Das OS Btrfs snapshots: snapper setup, boot menu entries and rollback" +maintainer="Das " +license="MIT" +homepage="https://git.das.org.ua/das/Das-OS" + +do_install() { + vbin ${FILESDIR}/das-snapper-setup + vinstall ${FILESDIR}/snapper-root.conf 644 usr/share/das/snapper root + vinstall ${FILESDIR}/das-snapshots.conf 644 usr/lib/dracut/dracut.conf.d 50-das-snapshots.conf + vinstall ${FILESDIR}/dracut/90das-snapshot-overlay/module-setup.sh 755 \ + usr/lib/dracut/modules.d/90das-snapshot-overlay + vinstall ${FILESDIR}/dracut/90das-snapshot-overlay/das-snapshot-overlay.sh 755 \ + usr/lib/dracut/modules.d/90das-snapshot-overlay + vlicense ${FILESDIR}/LICENSE +}