This shows you the differences between two versions of the page.
linux:lxdm_login_theming_setup [2014/09/15 21:40] walter [/etc/lxdm/PreLogin | (Executed as root)] |
linux:lxdm_login_theming_setup [2021/05/02 21:36] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Introduction ====== | ||
- | The ArchLinux Workstations are themed with either the ACM Logo or LUG logo. They are set to alternate between workstations. | ||
- | |||
- | I(clee231)(Chase Lee) have written a script to determine and switch the logos based on hostname. | ||
- | |||
- | Currently, the script is setup to run once before logging in the user as root. This means that there needs to be at least one login for the script to run. | ||
- | |||
- | ====== Setup ====== | ||
- | |||
- | This is setup by two files: | ||
- | |||
- | * /etc/lxdm/PreLogin | ||
- | * /etc/lxdm/SetLogo | ||
- | |||
- | ** PreLogin ** - This calls the SetLogo script. Executed by LXDM as root. | ||
- | |||
- | ** SetLogo ** - Contains a set of all six workstation hostnames, and detects which theme to use. | ||
- | |||
- | ====== Scripts ====== | ||
- | Up to date as of **August 23, 2013**. | ||
- | ==== /etc/lxdm/PreLogin | (Executed as root) ==== | ||
- | <code bash> | ||
- | #!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | #!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | #loltask > /dev/null & | ||
- | #mount -B /opt/Steam /home/$USER/Steam | ||
- | #mount -B /opt/Steamlocal $HOME/.local/share/Steam | ||
- | #if [ "$?" -ne "0" ] | ||
- | #then | ||
- | # mkdir -p $HOME/.local/share/Stean | ||
- | # mount -B /opt/Steamlocal $HOME/.local/share/Steam | ||
- | #fi | ||
- | #chown -R $USER:users $HOME/.local/share/Steam | ||
- | #/bin/bash /etc/lxdm/SetLogo | ||
- | </code> | ||
- | |||
- | ==== /etc/lxdm/SetLogo | (Inherently run as root be previous script.) ==== | ||
- | <code bash> | ||
- | #!/bin/bash | ||
- | # Author: Chase Lee (clee231) | ||
- | # Date: August 23, 2013 | ||
- | # Version: 1.02 | ||
- | # Description: Determines and sets the login theming based on hostname. | ||
- | # Dependencies: | ||
- | # - Hostname (GNU inetutils >= 1.9.1) | ||
- | # - Sed (sed >= 4.2.2) | ||
- | # - Bash (GNU Bash >= 4.2) (;-P) | ||
- | |||
- | CURRENT_HOSTNAME=`hostname` | ||
- | # As of August 23, 2013, there resides 6 workstations in the ACM/LUG office. | ||
- | ACM_HOSTNAMES=( defiant.acm.cs miranda.acm.cs sovereign.acm.cs ) | ||
- | LUG_HOSTNAMES=( constitution.acm.cs galaxy.acm.cs intrepid.acm.cs ) | ||
- | |||
- | function contains() { | ||
- | local n=$# | ||
- | local value=${!n} | ||
- | for ((i=1;i < $#;i++)) { | ||
- | if [ "${!i}" == "${value}" ]; then | ||
- | echo "y" | ||
- | return 0 | ||
- | fi | ||
- | } | ||
- | echo "n" | ||
- | return 1 | ||
- | } | ||
- | |||
- | if [ $(contains "${ACM_HOSTNAMES[@]}" "${CURRENT_HOSTNAME}") == "y" ] | ||
- | then | ||
- | # echo "This is an ACM Logo." | ||
- | sed -i -e 's/^theme=.*/theme=acm/' /etc/lxdm/lxdm.conf | ||
- | elif [ $(contains "${LUG_HOSTNAMES[@]}" "${CURRENT_HOSTNAME}") == "y" ] | ||
- | then | ||
- | # echo "This is an LUG Logo." | ||
- | sed -i -e 's/^theme=.*/theme=lug/' /etc/lxdm/lxdm.conf | ||
- | fi | ||
- | </code> |