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
|
|
|
|
|
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'
|
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'
|
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"
|
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
|
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'
|
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
|
|
|
|
|
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
|