lemurs/install.sh

76 lines
1.9 KiB
Bash
Raw Normal View History

2021-12-31 19:02:53 +00:00
#! /bin/sh
ROOT_CMD=""
if which "doas" > /dev/null 2>&1
then
ROOT_CMD="doas"
else
if which "sudo" > /dev/null 2>&1
then
ROOT_CMD="sudo";
else
echo '`sudo` or `doas` needs to be installed';
exit 1;
fi
fi
Next version (#42) * Add maximum width option to input fields (#41) * Add maximum width option to input fields * Format input field code * Fix crash when no graphical environment is specified (#43) * Catch errors in shutdown and reboot scripts (#45) * Set PWD upon logging in (#48) * Set PWD upon logging in * Fix formatting * Load the /etc/lemurs/config.toml file (#49) * Load the /etc/lemurs/config.toml file * Formatting config.rs * Load the /etc/lemurs/config.toml file * Isolate and improve environment variables (#53) Add the XDG environment variables and isolate the setting of environment variables to their own module. The TTY is now also settable from the `config.toml`. * Add an option to remember the username from the last login (#55) * Add option to remember the username in /var/cache * Formatting * Remove mouse capture (#56) * Improve install script (#58) * Change configuration to extend default configuration (#57) * Change configuration to extend default configuration * Formatting * Remove test workflow * Massively cleanup, small improvements and improve the logging (#60) - Log path moved from `/tmp/lemurs.log` to `/var/log/lemurs.log` - Add the `--no-log` flag - Move the preview log file from `out.log` to `lemurs.log` - Handle tty switching errors - Change name config section `wm_selector` to `environment_switcher` - Change the pam service used from `login` to `system-login` - Separate all authentication and environment starting logic from the UI logic - Properly handle X starting errors - Create an event handling thread so that status messages can now be displayed while processing * Properly set groups when logging in with X (#72) * Fix installation file * Remove creation of Xauthority file * Dynamically wait for X to start * Add feature(set_groups) * Change back to 'login' auth * Update Cargo.lock * Update README.md file * Version bump * Remove unused code * Remove unwraps * Update Cargo.lock * Fix shared state and InputField * Fix input box * Clippy warnings * Make waiting dependent on time instead of loop count
2022-07-30 17:41:41 +00:00
echo 'Lemurs install script'
echo
2021-12-31 19:02:53 +00:00
# Compile lemurs
2023-03-03 19:06:55 +00:00
echo 'Compile Lemurs'
Next version (#76) * Caching Post-Login Environment (#75) * Add a configuration option for focus behaviour (#74) * Add a configuration option for focus behaviour * Rust fmt * Add caching for post login environment * Fmt * Clippy * Fix the status message (#77) * Fix status message * Handle render unwraps * Add comment * FMT and Clippy * Switch arg parsing to clap-derive (#78) * Switch arg parsing to clap-derive * RustFmt Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Make nightly the default toolchain * Enable building with stable toolchain (#79) * Adjust code so that it builds with stable Rust * Move unsafety to only wrap the 'pre_exec' * Fix PERMERR by reordering to set{groups, gid, uid} * Remove +nightly from install script Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Add command to show possible environments * Exclude non-executable environments * Add subcommand to view cached information * Add --tty CLI flag to override TTY configuration (#81) * Add TTY Shell environment (#82) Add TTY shell environment * Always display TTYSHELL if no wms are found (#83) * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * [FIX]: Show TTY Shell on dir misconfiguration (#89) * Wayland support (#84) * Get started on wayland support * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * Working Wayland * Improve the README to reflect changes * Version Bump and Document Dependencies * Change power control commands to systemd * Change cover image * Crop cover image * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * UTMPX Support (#90) * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * Clippy and include Cargo.lock Co-authored-by: Marcin Puc <tranzystorek.io@protonmail.com>
2022-11-22 15:30:26 +00:00
cargo build --release
2021-12-31 19:02:53 +00:00
if [ $? -ne 0 ]; then exit 1; fi
# Move lemurs to /usr/bin
2023-03-03 19:06:55 +00:00
echo 'Move lemurs into /usr/bin'
2021-12-31 19:02:53 +00:00
$ROOT_CMD cp -f "target/release/lemurs" "/usr/bin/lemurs"
if [ $? -ne 0 ]; then exit 1; fi
# Create lemurs directory
2023-03-03 19:06:55 +00:00
echo 'Create lemurs configuration directory'
Next version (#76) * Caching Post-Login Environment (#75) * Add a configuration option for focus behaviour (#74) * Add a configuration option for focus behaviour * Rust fmt * Add caching for post login environment * Fmt * Clippy * Fix the status message (#77) * Fix status message * Handle render unwraps * Add comment * FMT and Clippy * Switch arg parsing to clap-derive (#78) * Switch arg parsing to clap-derive * RustFmt Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Make nightly the default toolchain * Enable building with stable toolchain (#79) * Adjust code so that it builds with stable Rust * Move unsafety to only wrap the 'pre_exec' * Fix PERMERR by reordering to set{groups, gid, uid} * Remove +nightly from install script Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Add command to show possible environments * Exclude non-executable environments * Add subcommand to view cached information * Add --tty CLI flag to override TTY configuration (#81) * Add TTY Shell environment (#82) Add TTY shell environment * Always display TTYSHELL if no wms are found (#83) * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * [FIX]: Show TTY Shell on dir misconfiguration (#89) * Wayland support (#84) * Get started on wayland support * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * Working Wayland * Improve the README to reflect changes * Version Bump and Document Dependencies * Change power control commands to systemd * Change cover image * Crop cover image * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * UTMPX Support (#90) * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * Clippy and include Cargo.lock Co-authored-by: Marcin Puc <tranzystorek.io@protonmail.com>
2022-11-22 15:30:26 +00:00
echo 'NOTE: You still have to move your X or Wayland startup into the proper directories'
2021-12-31 19:02:53 +00:00
$ROOT_CMD mkdir -p "/etc/lemurs/wms"
Next version (#76) * Caching Post-Login Environment (#75) * Add a configuration option for focus behaviour (#74) * Add a configuration option for focus behaviour * Rust fmt * Add caching for post login environment * Fmt * Clippy * Fix the status message (#77) * Fix status message * Handle render unwraps * Add comment * FMT and Clippy * Switch arg parsing to clap-derive (#78) * Switch arg parsing to clap-derive * RustFmt Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Make nightly the default toolchain * Enable building with stable toolchain (#79) * Adjust code so that it builds with stable Rust * Move unsafety to only wrap the 'pre_exec' * Fix PERMERR by reordering to set{groups, gid, uid} * Remove +nightly from install script Co-authored-by: Gijs Burghoorn <g.burghoorn@gmail.com> * Add command to show possible environments * Exclude non-executable environments * Add subcommand to view cached information * Add --tty CLI flag to override TTY configuration (#81) * Add TTY Shell environment (#82) Add TTY shell environment * Always display TTYSHELL if no wms are found (#83) * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * [FIX]: Show TTY Shell on dir misconfiguration (#89) * Wayland support (#84) * Get started on wayland support * Add AUR installation instructions (#87) * File overview in README (#88) Add file overview in README * Working Wayland * Improve the README to reflect changes * Version Bump and Document Dependencies * Change power control commands to systemd * Change cover image * Crop cover image * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * UTMPX Support (#90) * [FEATURE]: Add UTMPX support * RUSTFMT and add libc dependency * Clippy and include Cargo.lock Co-authored-by: Marcin Puc <tranzystorek.io@protonmail.com>
2022-11-22 15:30:26 +00:00
$ROOT_CMD mkdir -p "/etc/lemurs/wayland"
2021-12-31 19:02:53 +00:00
if [ $? -ne 0 ]; then exit 1; fi
2022-01-05 19:07:01 +00:00
# Copy over configuration file
2023-03-03 19:06:55 +00:00
echo 'Copy over default configuration'
2022-01-05 19:07:01 +00:00
$ROOT_CMD cp -f "extra/config.toml" "/etc/lemurs/config.toml"
if [ $? -ne 0 ]; then exit 1; fi
2021-12-31 19:02:53 +00:00
# Copy over xsetup
2023-03-03 19:06:55 +00:00
echo 'Copy over more files'
2021-12-31 19:02:53 +00:00
$ROOT_CMD cp -f "extra/xsetup.sh" "/etc/lemurs/xsetup.sh"
if [ $? -ne 0 ]; then exit 1; fi
# Copy over default xinitrc
Next version (#42) * Add maximum width option to input fields (#41) * Add maximum width option to input fields * Format input field code * Fix crash when no graphical environment is specified (#43) * Catch errors in shutdown and reboot scripts (#45) * Set PWD upon logging in (#48) * Set PWD upon logging in * Fix formatting * Load the /etc/lemurs/config.toml file (#49) * Load the /etc/lemurs/config.toml file * Formatting config.rs * Load the /etc/lemurs/config.toml file * Isolate and improve environment variables (#53) Add the XDG environment variables and isolate the setting of environment variables to their own module. The TTY is now also settable from the `config.toml`. * Add an option to remember the username from the last login (#55) * Add option to remember the username in /var/cache * Formatting * Remove mouse capture (#56) * Improve install script (#58) * Change configuration to extend default configuration (#57) * Change configuration to extend default configuration * Formatting * Remove test workflow * Massively cleanup, small improvements and improve the logging (#60) - Log path moved from `/tmp/lemurs.log` to `/var/log/lemurs.log` - Add the `--no-log` flag - Move the preview log file from `out.log` to `lemurs.log` - Handle tty switching errors - Change name config section `wm_selector` to `environment_switcher` - Change the pam service used from `login` to `system-login` - Separate all authentication and environment starting logic from the UI logic - Properly handle X starting errors - Create an event handling thread so that status messages can now be displayed while processing * Properly set groups when logging in with X (#72) * Fix installation file * Remove creation of Xauthority file * Dynamically wait for X to start * Add feature(set_groups) * Change back to 'login' auth * Update Cargo.lock * Update README.md file * Version bump * Remove unused code * Remove unwraps * Update Cargo.lock * Fix shared state and InputField * Fix input box * Clippy warnings * Make waiting dependent on time instead of loop count
2022-07-30 17:41:41 +00:00
if [ -f .xinitrc ]
then
2023-03-03 19:06:55 +00:00
echo 'Copy over existing xinitrc'
Next version (#42) * Add maximum width option to input fields (#41) * Add maximum width option to input fields * Format input field code * Fix crash when no graphical environment is specified (#43) * Catch errors in shutdown and reboot scripts (#45) * Set PWD upon logging in (#48) * Set PWD upon logging in * Fix formatting * Load the /etc/lemurs/config.toml file (#49) * Load the /etc/lemurs/config.toml file * Formatting config.rs * Load the /etc/lemurs/config.toml file * Isolate and improve environment variables (#53) Add the XDG environment variables and isolate the setting of environment variables to their own module. The TTY is now also settable from the `config.toml`. * Add an option to remember the username from the last login (#55) * Add option to remember the username in /var/cache * Formatting * Remove mouse capture (#56) * Improve install script (#58) * Change configuration to extend default configuration (#57) * Change configuration to extend default configuration * Formatting * Remove test workflow * Massively cleanup, small improvements and improve the logging (#60) - Log path moved from `/tmp/lemurs.log` to `/var/log/lemurs.log` - Add the `--no-log` flag - Move the preview log file from `out.log` to `lemurs.log` - Handle tty switching errors - Change name config section `wm_selector` to `environment_switcher` - Change the pam service used from `login` to `system-login` - Separate all authentication and environment starting logic from the UI logic - Properly handle X starting errors - Create an event handling thread so that status messages can now be displayed while processing * Properly set groups when logging in with X (#72) * Fix installation file * Remove creation of Xauthority file * Dynamically wait for X to start * Add feature(set_groups) * Change back to 'login' auth * Update Cargo.lock * Update README.md file * Version bump * Remove unused code * Remove unwraps * Update Cargo.lock * Fix shared state and InputField * Fix input box * Clippy warnings * Make waiting dependent on time instead of loop count
2022-07-30 17:41:41 +00:00
$ROOT_CMD cp -f "~/.xinitrc" "/etc/lemurs/wms/xinitrc"
fi
# Cache the current user
2023-03-03 19:06:55 +00:00
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'
2023-03-03 19:20:40 +00:00
$ROOT_CMD /bin/bash -c "echo 'xinitrc\n$USER' > /var/cache/lemurs"
2021-12-31 19:02:53 +00:00
# Disable previous Display Manager
2023-03-03 19:06:55 +00:00
echo 'Disabling the current display-manager. This might throw an error if no display manager is set up.'
2021-12-31 19:02:53 +00:00
$ROOT_CMD systemctl disable display-manager.service
# Copy over systemd service
2023-03-03 19:06:55 +00:00
echo 'Setting up lemurs service'
2021-12-31 19:02:53 +00:00
$ROOT_CMD cp -f extra/lemurs.service /usr/lib/systemd/system/lemurs.service
if [ $? -ne 0 ]; then exit 1; fi
Next version (#42) * Add maximum width option to input fields (#41) * Add maximum width option to input fields * Format input field code * Fix crash when no graphical environment is specified (#43) * Catch errors in shutdown and reboot scripts (#45) * Set PWD upon logging in (#48) * Set PWD upon logging in * Fix formatting * Load the /etc/lemurs/config.toml file (#49) * Load the /etc/lemurs/config.toml file * Formatting config.rs * Load the /etc/lemurs/config.toml file * Isolate and improve environment variables (#53) Add the XDG environment variables and isolate the setting of environment variables to their own module. The TTY is now also settable from the `config.toml`. * Add an option to remember the username from the last login (#55) * Add option to remember the username in /var/cache * Formatting * Remove mouse capture (#56) * Improve install script (#58) * Change configuration to extend default configuration (#57) * Change configuration to extend default configuration * Formatting * Remove test workflow * Massively cleanup, small improvements and improve the logging (#60) - Log path moved from `/tmp/lemurs.log` to `/var/log/lemurs.log` - Add the `--no-log` flag - Move the preview log file from `out.log` to `lemurs.log` - Handle tty switching errors - Change name config section `wm_selector` to `environment_switcher` - Change the pam service used from `login` to `system-login` - Separate all authentication and environment starting logic from the UI logic - Properly handle X starting errors - Create an event handling thread so that status messages can now be displayed while processing * Properly set groups when logging in with X (#72) * Fix installation file * Remove creation of Xauthority file * Dynamically wait for X to start * Add feature(set_groups) * Change back to 'login' auth * Update Cargo.lock * Update README.md file * Version bump * Remove unused code * Remove unwraps * Update Cargo.lock * Fix shared state and InputField * Fix input box * Clippy warnings * Make waiting dependent on time instead of loop count
2022-07-30 17:41:41 +00:00
# Enable lemurs
2023-03-03 19:06:55 +00:00
echo 'Enable the lemurs service'
2021-12-31 19:02:53 +00:00
$ROOT_CMD systemctl enable lemurs.service
if [ $? -ne 0 ]; then exit 1; fi