Alkit is a tool to setup a running (Arch¹) Linux system from template(s).
Alkit version 0.1.0
usage:
alkit <command> [<template> ...]
command:
stat show <template> status in system
diff show <template> differences in system
push copy <template> to system
template(s):
relative path to template dir. default "$ALKIT_TPL/*/"
environment variables:
ALKIT_SYS path to system root. default: "/"
ALKIT_TPL path to template root. default: "$PWD"
ALKIT_MNT path to varifs mount. default: "/tmp/alkitmountdir"
ALKIT_CNF path to config file. default: "$ALKIT_TPL/alkit.conf"
¹Alkit is Arch Linux specific only cause it uses pacman, but if there is a tool that does system package "push/stat/diff" for "every" Linux distro, i would love to use it!
We have an optional configuration file alkit.conf
, defining some variables and values:
alkit.conf
┌──────────────────────────┐
│ keymap = de │
│ locale = en_IE.UTF-8 │
│ timezone = Europe/Berlin │
└──────────────────────────┘
Freely definable directories with a .alkitdir
file, marking them as an Alkit template:
alkit.conf
base/
.alkitdir
Some Linux system files, optionally referencing those variables:
alkit.conf
base/
.alkitdir
etc/locale.conf
┌───────────────┐
│ LANG=«locale» │
└───────────────┘
etc/localtime → /usr/share/zoneinfo/«timezone»
etc/vconsole.conf
┌─────────────────┐
│ KEYMAP=«keymap» │
└─────────────────┘
Some optional Alkit file pkgs.list
, listing system packages to install:
alkit.conf
base/
.alkitdir
etc/locale.conf
etc/localtime
etc/vconsole.conf
pkgs.list
┌───────┐
│ base │
│ kbd │
│ linux │
└───────┘
Then we can check the status of the system with alkit stat
:
$ alkit stat
[base]
OK: (linux kbd)
OK: etc/locale.conf
DIFF: etc/vconsole.conf
OK: etc/localtime
Check what is different between system and template with alkit diff
:
$ alkit diff
DIFF: [base] >fc.T...... etc/vconsole.conf
1c1
< KEYMAP=en
---
> KEYMAP=de
And change the system according to the template with sudo alkit push
:
$ sudo alkit push
[base]
warning: linux-6.8.2.arch2-1 is up to date -- skipping
warning: kbd-2.6.4-1 is up to date -- skipping
>fc.T...... etc/vconsole.conf
Now we have a nice clean directory that we can check in to a version control system.
If we have an alkit.conf
and/or alkit.conf.secret
file, all alkit
commands will resolve all defined variables during file read.
The definition syntax is:
variable = value
An Alkit template is simply a directory with Linux system files and optional Alkit files.
The only required file is an empty .alkitdir
Symlinks (with variables in target) are also supported.
If we defined variables in alkit.conf
, we can reference them with:
«variable»
There are also some value modifiers, see https://github.com/oskude/varifs for more info.
Optional Alkit files:
File | Info |
---|---|
pkgs.list |
List of system packages to install on push . (space and/or newline seperated) |
stat.sh |
Bash script to run after stat |
diff.sh |
Bash script to run after diff |
push.sh |
Bash script to run after push |
- Is there a tool that diffs (also) file permissions and symlinks?
- Export UPPER_CASE keys from ALKIT_CNF to environment?
- That way we could easily overwrite VARIFS_*
- eg. let user define prefix/suffix etc.
- That way we could easily overwrite VARIFS_*
- Option to disable output colors
- Undo?
- Template has meta info which variables it uses?
- Alkit could then scan and generate/update alkit.conf?