LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
#!/bin/sh
# lordos-live-prep — prepares the live system before lord-sessiond (ExecStartPre of
# lordos.service). On an installed system it does nothing. See docs/ISO.md and docs/SESSIONS.md.
#
# Options on the kernel command line (grub menu):
# lordos.lang=es interface language (en by default; es and pt): /etc/default/locale and the live
# user's settings the first time
# lordos.gpu=0 safe mode: everything on the CPU. lord-sessiond reads it from /proc/cmdline and
# passes LORD_GPU=0 to every session (nothing is needed here).
set -u
[ -d /run/live ] || exit 0 # only on the live system (live-boot)
USER_NAME=lordos
getent passwd "$USER_NAME" >/dev/null || exit 0
LANG_UI=en
for arg in $(cat /proc/cmdline); do
case "$arg" in
lordos.lang=es) LANG_UI=es ;;
lordos.lang=pt) LANG_UI=pt ;;
esac
done
# the keyboard follows the language (the SDK's default is latam); Settings → Keyboard changes it
case "$LANG_UI" in
es) LOC=es_ES.UTF-8; KB=latam; DIRS="Escritorio Documentos Descargas Música Imágenes Videos" ;;
pt) LOC=pt_BR.UTF-8; KB=br; DIRS="Área_de_trabalho Documentos Downloads Música Imagens Vídeos" ;;
*) LOC=en_US.UTF-8; KB=us; DIRS="Desktop Documents Downloads Music Pictures Videos" ;;
esac
printf 'LANG=%s\n' "$LOC" > /etc/default/locale # also the login screen language
HOME_DIR=$(getent passwd "$USER_NAME" | cut -d: -f6)
CFG="$HOME_DIR/.config/lordos"
if [ ! -f "$CFG/settings.json" ]; then
install -d -o "$USER_NAME" -g "$USER_NAME" "$HOME_DIR/.config" "$CFG"
printf '{\n "language": "%s",\n "keyboards": [{ "layout": "%s", "variant": "" }]\n}\n' "$LANG_UI" "$KB" > "$CFG/settings.json"
printf 'LANG=%s\n' "$LOC" > "$HOME_DIR/.config/locale.conf"
chown "$USER_NAME:$USER_NAME" "$CFG/settings.json" "$HOME_DIR/.config/locale.conf"
fi
if [ ! -e "$CFG/.dirs" ]; then
for d in $DIRS; do install -d -o "$USER_NAME" -g "$USER_NAME" "$HOME_DIR/$(echo "$d" | tr _ ' ')"; done
: > "$CFG/.dirs"; chown "$USER_NAME:$USER_NAME" "$CFG/.dirs"
fi
# live-boot writes /etc/network/interfaces with the NICs on DHCP; without ifupdown nobody uses it and
# LordOS would take it as "system networking" and not configure it: only lo is kept.
if [ ! -x /sbin/ifup ] && [ -f /etc/network/interfaces ] && grep -qv '^\s*\(#\|$\|auto lo\|iface lo\)' /etc/network/interfaces; then
printf 'auto lo\niface lo inet loopback\n' > /etc/network/interfaces
fi
exit 0