Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brightness control(xorg) , Auto login DM, Bootable pendrive maker script, auto power profiling using auto-cpufreq, timeshift backup, samba-ssh server setup #465

Merged
merged 22 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
418cb9d
added auto-login
guruswarupa Sep 18, 2024
0b8a649
added pendrive maker script
guruswarupa Sep 18, 2024
4bb3ba5
added power profile script
guruswarupa Sep 18, 2024
d99d26d
added timeshift backup script
guruswarupa Sep 18, 2024
71beabd
set brightness monitor scontrol script
guruswarupa Sep 18, 2024
ea9d6d7
samba ssh setup script added
guruswarupa Sep 18, 2024
6cbba30
Update tabs/utils/tab_data.toml
guruswarupa Sep 18, 2024
60405aa
Update tabs/system-setup/5-samba-ssh-setup.sh
guruswarupa Sep 18, 2024
1d59a55
Update tabs/utils/auto-login.sh
guruswarupa Sep 18, 2024
1b0b9bb
Update tabs/system-setup/5-samba-ssh-setup.sh
guruswarupa Sep 18, 2024
0d7213d
Update tabs/utils/auto-login.sh
guruswarupa Sep 18, 2024
8fdb105
Update tabs/utils/auto-login.sh
guruswarupa Sep 18, 2024
6646c4d
Update tabs/utils/auto-login.sh
guruswarupa Sep 18, 2024
d0ccb23
Update tabs/utils/auto-login.sh
guruswarupa Sep 18, 2024
dc26890
Update tabs/system-setup/5-samba-ssh-setup.sh
guruswarupa Sep 18, 2024
d30ba11
Update tabs/system-setup/5-samba-ssh-setup.sh
guruswarupa Sep 18, 2024
59fafbb
Update tabs/system-setup/5-samba-ssh-setup.sh
guruswarupa Sep 18, 2024
28ee76b
Update tabs/system-setup/5-samba-ssh-setup.sh
ChrisTitusTech Sep 18, 2024
7f28646
Update tabs/utils/monitor-control/set_brightness.sh
ChrisTitusTech Sep 18, 2024
3f6209e
Update tabs/utils/monitor-control/set_brightness.sh
ChrisTitusTech Sep 18, 2024
60d4d4b
Remove bashisms
ChrisTitusTech Sep 18, 2024
46a9d57
Merge branch 'main' into main
ChrisTitusTech Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added auto-login
  • Loading branch information
guruswarupa committed Sep 18, 2024
commit 418cb9db44eed260e5c2d9fe2e3ed9a96a34fed5
179 changes: 179 additions & 0 deletions tabs/utils/auto-login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#!/bin/sh -e

. ../common-script.sh

# Function to list common session options
list_sessions() {
echo "Select the session:"
echo "1) GNOME (gnome.desktop)"
echo "2) KDE Plasma (plasma.desktop)"
echo "3) XFCE (xfce.desktop)"
echo "4) LXDE (LXDE.desktop)"
echo "5) LXQt (lxqt.desktop)"
echo "6) Cinnamon (cinnamon.desktop)"
echo "7) MATE (mate.desktop)"
echo "8) Openbox (openbox.desktop)"
echo "9) i3 (i3.desktop)"
echo "10) Custom session"
echo "Enter your choice [1-10]: "
read session_choice

case "$session_choice" in
1) session="gnome.desktop" ;;
2) session="plasma.desktop" ;;
3) session="xfce.desktop" ;;
4) session="LXDE.desktop" ;;
5) session="lxqt.desktop" ;;
6) session="cinnamon.desktop" ;;
7) session="mate.desktop" ;;
8) session="openbox.desktop" ;;
9) session="i3.desktop" ;;
10)
echo "Enter custom session name (e.g., mysession.desktop): "
read session ;;
guruswarupa marked this conversation as resolved.
Show resolved Hide resolved
*)
echo "Invalid option selected."
exit 1 ;;
esac
}

# Function to configure LightDM
configure_lightdm() {
echo "Configuring LightDM for autologin..."

echo "Enter username for LightDM autologin: "
read user
guruswarupa marked this conversation as resolved.
Show resolved Hide resolved

$ESCALATION_TOOL "echo '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
$ESCALATION_TOOL "echo 'autologin-user=$user' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"
$ESCALATION_TOOL "echo 'autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"

echo "LightDM has been configured for autologin."
}

# Function to remove LightDM autologin
remove_lightdm_autologin() {
echo "Removing LightDM autologin configuration..."
$ESCALATION_TOOL rm -f /etc/lightdm/lightdm.conf.d/50-autologin.conf
echo "LightDM autologin configuration has been removed."
}

# Function to configure GDM
configure_gdm() {
echo "Configuring GDM for autologin..."

echo "Enter username for GDM autologin: "
read user
guruswarupa marked this conversation as resolved.
Show resolved Hide resolved

$ESCALATION_TOOL "echo '[daemon]' > /etc/gdm/custom.conf"
$ESCALATION_TOOL "echo 'AutomaticLoginEnable = true' >> /etc/gdm/custom.conf"
$ESCALATION_TOOL "echo 'AutomaticLogin = $user' >> /etc/gdm/custom.conf"

echo "GDM has been configured for autologin."
}

# Function to remove GDM autologin
remove_gdm_autologin() {
echo "Removing GDM autologin configuration..."
$ESCALATION_TOOL sed -i '/AutomaticLoginEnable/d' /etc/gdm/custom.conf
$ESCALATION_TOOL sed -i '/AutomaticLogin/d' /etc/gdm/custom.conf
echo "GDM autologin configuration has been removed."
}

# Function to configure SDDM
configure_sddm() {
echo "Configuring SDDM for autologin..."

echo "Enter username for SDDM autologin: "
read user
guruswarupa marked this conversation as resolved.
Show resolved Hide resolved
list_sessions # Show session options

$ESCALATION_TOOL "echo '[Autologin]' > /etc/sddm.conf"
$ESCALATION_TOOL "echo 'User=$user' >> /etc/sddm.conf"
$ESCALATION_TOOL "echo 'Session=$session' >> /etc/sddm.conf"

echo "SDDM has been configured for autologin."
}

# Function to remove SDDM autologin
remove_sddm_autologin() {
echo "Removing SDDM autologin configuration..."
$ESCALATION_TOOL sed -i '/\[Autologin\]/,+2d' /etc/sddm.conf
echo "SDDM autologin configuration has been removed."
}

# Function to configure LXDM
configure_lxdm() {
echo "Configuring LXDM for autologin..."

echo "Enter username for LXDM autologin: "
read user
guruswarupa marked this conversation as resolved.
Show resolved Hide resolved
list_sessions # Show session options

$ESCALATION_TOOL sed -i "s/^#.*autologin=.*$/autologin=${user}/" /etc/lxdm/lxdm.conf
$ESCALATION_TOOL sed -i "s|^#.*session=.*$|session=/usr/bin/${session}|; s|^session=.*$|session=/usr/bin/${session}|" /etc/lxdm/lxdm.conf

echo "LXDM has been configured for autologin."
}

# Function to remove LXDM autologin
remove_lxdm_autologin() {
echo "Removing LXDM autologin configuration..."
$ESCALATION_TOOL sed -i "s/^autologin=.*$/#autologin=/" /etc/lxdm/lxdm.conf
$ESCALATION_TOOL sed -i "s/^session=.*$/#session=/" /etc/lxdm/lxdm.conf
echo "LXDM autologin configuration has been removed."
}

# Function to configure or remove autologin based on user choice
configure_or_remove_autologin() {
echo "Do you want to add or remove autologin?"
echo "1) Add autologin"
echo "2) Remove autologin"
echo "Enter your choice [1-2]: "
read action_choice

if [ "$action_choice" = "1" ]; then
echo "Choose the display manager to configure:"
echo "1) LightDM"
echo "2) GDM"
echo "3) SDDM"
echo "4) LXDM"
echo "Enter your choice [1-4]: "
read choice

case "$choice" in
1) configure_lightdm ;;
2) configure_gdm ;;
3) configure_sddm ;;
4) configure_lxdm ;;
*) echo "Invalid option selected." ;;
esac
elif [ "$action_choice" = "2" ]; then
echo "Choose the display manager to remove autologin:"
echo "1) LightDM"
echo "2) GDM"
echo "3) SDDM"
echo "4) LXDM"
echo "Enter your choice [1-4]: "
read choice

case "$choice" in
1) remove_lightdm_autologin ;;
2) remove_gdm_autologin ;;
3) remove_sddm_autologin ;;
4) remove_lxdm_autologin ;;
*) echo "Invalid option selected." ;;
esac
else
echo "Invalid choice. Exiting..."
exit 1
fi

echo "Action completed. Exiting..."
exit 0
}


checkEnv
checkEscalationTool
configure_or_remove_autologin
9 changes: 9 additions & 0 deletions tabs/utils/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ script = "ollama.sh"
name = "Service Manager"
script = "service-control.sh"

[[data]]
name = "Auto Login"
script = "auto-login.sh"

[[data]]
name = "Monitor Control"

Expand Down Expand Up @@ -73,3 +77,8 @@ script = "monitor-control/scale_monitor.sh"
name = "Reset Scaling"
script = "monitor-control/reset_scaling.sh"
matches = true

[[data.entries]]
name = "Set Brightness"
script = "monitor-control/set_brightness.sh"
matches = true