mirror of
https://github.com/coastalwhite/lemurs
synced 2024-11-10 05:14:11 +00:00
Cleanup for release
This commit is contained in:
parent
0cfedf0102
commit
6def9f2da0
4 changed files with 44 additions and 84 deletions
58
README.md
58
README.md
|
@ -5,16 +5,14 @@
|
|||
|
||||
Lemurs provides a *Terminal User Interface* (TUI) for a [Display/Login
|
||||
Managers](https://wiki.archlinux.org/title/Display_manager) in Rust for most
|
||||
GNU/Linux and BSD distributions. It can work both with or without SystemD and
|
||||
allows for configuration with _One-Time Password_ (OTP) tokens. Lemurs works on
|
||||
most Unix systems including Linux, FreeBSD and NetBSD.
|
||||
GNU/Linux and BSD distributions. It can work both *with or without SystemD*.
|
||||
Lemurs works on most Unix systems including Linux, FreeBSD and NetBSD.
|
||||
|
||||
## Goal
|
||||
|
||||
This project creates a small, robust and yet customizable Login Manager which
|
||||
can serve as the front-end to your TTY, X11 or Wayland sessions. Lemurs uses
|
||||
[_Pluggable Authentication Modules_][pam] (PAM) as its method of
|
||||
authentication.
|
||||
[_Pluggable Authentication Modules_][pam] (PAM) as its method of authentication.
|
||||
|
||||
## Screenshot
|
||||
|
||||
|
@ -24,14 +22,16 @@ authentication.
|
|||
|
||||
[![Packaging status](https://repology.org/badge/vertical-allrepos/lemurs.svg)](https://repology.org/project/lemurs/versions)
|
||||
|
||||
There are two different ways to install Lemurs. Both require the rust toolchain
|
||||
to be installed. I.e. there is currently no precompiled option.
|
||||
Installation follows three steps.
|
||||
|
||||
### Arch Linux --- AUR
|
||||
1. Compile the codebase
|
||||
2. Copy all files to correct positions
|
||||
3. Enable `init` process to run `lemurs`
|
||||
|
||||
### Arch Linux
|
||||
|
||||
Lemurs can be installed from the [AUR](https://aur.archlinux.org). This will
|
||||
build the package on your local machine. It will automatically pull in rustup,
|
||||
but you might have to set the default toolchain with `rustup default stable`.
|
||||
build the package on your local machine.
|
||||
|
||||
```bash
|
||||
paru -S lemurs-git # paru can be replaced by any other AUR helper
|
||||
|
@ -42,19 +42,6 @@ sudo systemctl disable display-manager.service
|
|||
sudo systemctl enable lemurs.service
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
git clone https://aur.archlinux.org/lemurs-git.git
|
||||
cd lemurs-git
|
||||
makepkg -si
|
||||
|
||||
# Not needed if do don't have a window manager yet
|
||||
sudo systemctl disable display-manager.service
|
||||
|
||||
sudo systemctl enable lemurs.service
|
||||
```
|
||||
|
||||
### Compiling from source
|
||||
|
||||
The `install.sh` script can be used to compile and setup the display manager on
|
||||
|
@ -119,12 +106,6 @@ The flag `--config <CONFIG FIlE>` can be used to select another configuration
|
|||
file instead. An example configuration can be found in the `extra` folder in
|
||||
this repository.
|
||||
|
||||
## Documentation of Internals
|
||||
|
||||
To make Lemurs a lot of investigation happened into how the Login sequence of
|
||||
many environments can be supported. [This document](./doc/internals.md)
|
||||
describes information learned there. It can be useful when debugging.
|
||||
|
||||
## Preview & Debugging
|
||||
|
||||
Lemurs logs a lot of information of it running to a logging file. This is
|
||||
|
@ -143,24 +124,32 @@ want to tweak details for their own installation.
|
|||
|
||||
```
|
||||
|- src: Rust Source Code
|
||||
| |- main.rs: CLI argument parsing & main logic
|
||||
| |- auth: Interaction with PAM modules
|
||||
| |- main.rs
|
||||
| |- chvt.rs: UNIX calls to change of TTY
|
||||
| |- cli.rs: CLI argument parsing
|
||||
| |- config.rs: Configuration file format and options
|
||||
| |- info_caching.rs: Reading and writing cached login information
|
||||
| |- env_container.rs: Handles resetting and resetting the environment variables
|
||||
| |- info_caching.rs: Handling cached username and session environment
|
||||
| |- auth: Interaction with PAM modules and UTMPX
|
||||
| | |- mod.rs
|
||||
| | |- pam.rs
|
||||
| | |- utmpx.rs
|
||||
| |- post_login: All logic after authentication
|
||||
| | |- mod.rs
|
||||
| | |- env_variables.rs: General environment variables settings
|
||||
| | |- x.rs: Logic concerning Xorg
|
||||
| |- ui: TUI code
|
||||
| | |- mod.rs: UI calling logic, separated over 2 threads
|
||||
| | |- chunks.rs: Division of the TUI screen
|
||||
| | |- input_field.rs: TUI input field used for username and password
|
||||
| | |- power_menu.rs: Shutdown and Reboot options UI
|
||||
| | |- status_message.rs: UI for error and information messages
|
||||
| | |- switcher.rs: UI for environment switcher
|
||||
| | |- chunks.rs: Division of the TUI screen
|
||||
|- extra: Configuration and extra files needed
|
||||
| |- config.toml: The default configuration file
|
||||
| |- xsetup.sh: Script used to setup a Xorg session
|
||||
| |- lemurs.service: The systemd service used to start at boot
|
||||
| |- lemurs.pam: PAM service configuration
|
||||
```
|
||||
|
||||
## Platforms
|
||||
|
@ -173,7 +162,8 @@ Tested on
|
|||
|
||||
## MSRV Policy
|
||||
|
||||
Lemurs has a _Minimum Supported Rust Version_ policy of _N - 2_. This means that we only use Rust languages features that have been in Rust as of 2 releases.
|
||||
Lemurs has a _Minimum Supported Rust Version_ policy of _N - 2_. This means that
|
||||
we only use Rust languages features that have been in Rust as of 2 releases.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# Internals
|
||||
|
||||
## Boot Sequence
|
||||
|
||||
As input, it will
|
||||
|
||||
### 0. Take snapshot of the environment variables.
|
||||
1. Set `DISPLAY` environment variable
|
||||
2. Set `XDG` session parameters.
|
||||
1. `XDG_SESSION_CLASS` with `user`
|
||||
2. `XDG_SESSION_DESKTOP` with `$DESKTOP` # NOT YET IMPLEMENTED
|
||||
3. `XDG_CURRENT_DESKTOP` with `$DESKTOP` # NOT YET IMPLEMENTED
|
||||
4. `XDG_SESSION_TYPE` with `tty` / `x11` / `wayland`
|
||||
4. Call PAM with Username and Password
|
||||
5. Set `XDG` seat variables. Since `pam_systemd` / `logind` may set these variables, they are only set if they are not set already.
|
||||
1. `XDG_SEAT` with `seat0`
|
||||
2. `XDG_VTNR` with `$TTY`
|
||||
6. Set `XDG` session variables. Since `pam_systemd` / `logind` may set these variables, they are only set if they are not set already. The variables and their default values are:
|
||||
1. `XDG_RUNTIME_DIR` with `/run/user/$UID`
|
||||
2. `XDG_SESSION_ID` with `1`
|
||||
5. Set basic environment variables
|
||||
1. `HOME` with user's home directory in `/etc/passwd`
|
||||
2. `PWD` to the user's home directory in `/etc/passwd`
|
||||
3. `SHELL` to the user's shell in the `/etc/passwd` file
|
||||
4. `USER` to the username
|
||||
5. `LOGNAME` to the username
|
||||
6. `PATH` to `/usr/local/sbin:/usr/local/bin:/usr/bin`
|
||||
6. Set `XDG` common paths.
|
||||
1. `XDG_CONFIG_DIR` with `$HOME/.config`
|
||||
2. `XDG_CACHE_HOME` with `$HOME/.cache`
|
||||
3. `XDG_DATA_HOME` with `$HOME/.local/share`
|
||||
4. `XDG_STATE_HOME` with `$HOME/.local/state`
|
||||
5. `XDG_DATA_DIRS` with `/usr/local/share:/usr/share`
|
||||
6. `XDG_CONFIG_DIRS` with `/etc/xdg`
|
||||
7. Start Session Environment. This can possibly set more environment variables.
|
||||
8. Log UTMP Entry
|
||||
10. Restore to previously taken snapshot
|
||||
11. Wait for Session Environment to Finish
|
||||
```
|
5
extra/lemurs.pam
Normal file
5
extra/lemurs.pam
Normal file
|
@ -0,0 +1,5 @@
|
|||
#%PAM-1.0
|
||||
auth required login
|
||||
account required login
|
||||
session required login
|
||||
password required login
|
26
install.sh
26
install.sh
|
@ -19,58 +19,62 @@ echo 'Lemurs install script'
|
|||
echo
|
||||
|
||||
# Compile lemurs
|
||||
echo 'Step 1: Compile Lemurs'
|
||||
echo 'Compile Lemurs'
|
||||
cargo build --release
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Move lemurs to /usr/bin
|
||||
echo 'Step 2: Move lemurs into /usr/bin'
|
||||
echo 'Move lemurs into /usr/bin'
|
||||
$ROOT_CMD cp -f "target/release/lemurs" "/usr/bin/lemurs"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Create lemurs directory
|
||||
echo 'Step 3: Create lemurs configuration directory'
|
||||
echo 'Create lemurs configuration directory'
|
||||
echo 'NOTE: You still have to move your X or Wayland startup into the proper directories'
|
||||
$ROOT_CMD mkdir -p "/etc/lemurs/wms"
|
||||
$ROOT_CMD mkdir -p "/etc/lemurs/wayland"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Copy over configuration file
|
||||
echo 'Step 4: Copy over default configuration'
|
||||
echo 'Copy over default configuration'
|
||||
$ROOT_CMD cp -f "extra/config.toml" "/etc/lemurs/config.toml"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Copy over xsetup
|
||||
echo 'Step 5: Copy over more files'
|
||||
echo 'Copy over more files'
|
||||
$ROOT_CMD cp -f "extra/xsetup.sh" "/etc/lemurs/xsetup.sh"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Copy over default xinitrc
|
||||
if [ -f .xinitrc ]
|
||||
then
|
||||
echo 'Step 6: Copy over existing xinitrc'
|
||||
echo 'Copy over existing xinitrc'
|
||||
$ROOT_CMD cp -f "~/.xinitrc" "/etc/lemurs/wms/xinitrc"
|
||||
fi
|
||||
|
||||
# Cache the current user
|
||||
echo 'Step 7: Caching the current user'
|
||||
echo 'Copy over PAM service'
|
||||
$ROOT_CMD cp -f "extra/lemurs.pam" "/etc/pam.d/lemurs"
|
||||
|
||||
# Cache the current user
|
||||
echo 'Caching the current user'
|
||||
$ROOT_CMD /bin/bash -c "echo $USER > /var/cache/lemurs"
|
||||
|
||||
# Disable previous Display Manager
|
||||
echo 'Step 7: Disabling the current display-manager. This might throw an error if no display manager is set up.'
|
||||
echo 'Disabling the current display-manager. This might throw an error if no display manager is set up.'
|
||||
$ROOT_CMD systemctl disable display-manager.service
|
||||
|
||||
# Copy over systemd service
|
||||
echo 'Step 8: Setting up lemurs service'
|
||||
echo 'Setting up lemurs service'
|
||||
$ROOT_CMD cp -f extra/lemurs.service /usr/lib/systemd/system/lemurs.service
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Enable lemurs
|
||||
echo 'Step 9: Enable the lemurs service'
|
||||
echo 'Enable the lemurs service'
|
||||
$ROOT_CMD systemctl enable lemurs.service
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Make sure Xauthority file exists
|
||||
echo 'Step 10: Ensure the Xauthority file exists'
|
||||
echo 'Ensure the Xauthority file exists'
|
||||
touch ~/.Xauthority
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
|
Loading…
Reference in a new issue