This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
linux:lxdm_login_theming_setup [2013/08/23 23:19] clee231 Updated Scripts to account for changes to workstation setup |
linux:lxdm_login_theming_setup [2016/02/02 05:03] walter |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== LXDM Login Theming Setup ====== | ||
+ | |||
====== Introduction ====== | ====== Introduction ====== | ||
The ArchLinux Workstations are themed with either the ACM Logo or LUG logo. They are set to alternate between workstations. | 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. | + | ====== Setup ====== |
- | 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. | + | <WRAP center round info 60%> |
+ | Setup the [[linux:acm_custom_repo|ACM custom repo]] on the workstation first | ||
+ | </WRAP> | ||
- | ====== Setup ====== | + | Install themes with this command and follow the post install instructions |
+ | <code|bash> | ||
+ | pacman -S acm-lug-lxdm-themes | ||
+ | </code> | ||
- | This is setup by two files: | + | Unpack {{:acm-themes.tar.gz|this archive with the ACM and LUG themes}} into /usr/share/lxdm/themes |
+ | This is setup by three files: | ||
+ | |||
+ | * /etc/lxdm/LoginReady | ||
* /etc/lxdm/PreLogin | * /etc/lxdm/PreLogin | ||
* /etc/lxdm/SetLogo | * /etc/lxdm/SetLogo | ||
- | ** PreLogin ** - This calls the SetLogo script. Executed by LXDM as root. | + | ** LoginReady ** - This is exicuted as root when LXDM is ready to show the screen. |
- | ** SetLogo ** - Contains a set of all six workstation hostnames, and detects which theme to use. | + | ** PreLogin ** - Executed by LXDM as root. |
+ | |||
+ | ** SetLogo ** - Contains the sed regex for the link and IP, the 'even' and 'odd' themes settings, and detects which theme to use. | ||
====== Scripts ====== | ====== Scripts ====== | ||
- | Up to date as of **August 23, 2013**. | + | Up to date as of **September 19, 2014**. |
+ | ==== /etc/lxdm/LoginReady | (Executed as root) ==== | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | /etc/lxdm/SetLogo | ||
+ | </code> | ||
==== /etc/lxdm/PreLogin | (Executed as root) ==== | ==== /etc/lxdm/PreLogin | (Executed as root) ==== | ||
<code bash> | <code bash> | ||
Line 30: | Line 47: | ||
#loltask > /dev/null & | #loltask > /dev/null & | ||
#mount -B /opt/Steam /home/$USER/Steam | #mount -B /opt/Steam /home/$USER/Steam | ||
- | mount -B /opt/Steamlocal $HOME/.local/share/Steam | + | #mount -B /opt/Steamlocal $HOME/.local/share/Steam |
- | if [ "$?" -ne "0" ] | + | #if [ "$?" -ne "0" ] |
- | then | + | #then |
- | mkdir -p $HOME/.local/share/Stean | + | # mkdir -p $HOME/.local/share/Stean |
- | mount -B /opt/Steamlocal $HOME/.local/share/Steam | + | # mount -B /opt/Steamlocal $HOME/.local/share/Steam |
- | fi | + | #fi |
- | chown -R $USER:users $HOME/.local/share/Steam | + | #chown -R $USER:users $HOME/.local/share/Steam |
- | /bin/bash /etc/lxdm/SetLogo | + | #/bin/bash /etc/lxdm/SetLogo |
</code> | </code> | ||
Line 43: | Line 60: | ||
<code bash> | <code bash> | ||
#!/bin/bash | #!/bin/bash | ||
- | # Author: Chase Lee (clee231) | + | # Authors: Chase Lee (clee231), Walter Dworak (walter) |
- | # Date: August 23, 2013 | + | # Date: September 15, 2014 |
- | # Version: 1.02 | + | # Version: 1.03 |
- | # Description: Determines and sets the login theming based on hostname. | + | # Description: Determines and sets the login theming based on modulus 2 op on last segment of IPv4 address. |
# Dependencies: | # Dependencies: | ||
- | # - Hostname (GNU inetutils >= 1.9.1) | + | # - Awk (Awk >= 4.1.0) |
- | # - Sed (sed >= 4.2.2) | + | # - Bash (GNU Bash >= 4.2) (;-P) |
- | # - Bash (GNU Bash >= 4.2) (;-P) | + | |
- | CURRENT_HOSTNAME=`hostname` | + | # As of July 16, 2013, there resides 6 workstations in the ACM/LUG office. |
- | # As of August 23, 2013, there resides 6 workstations in the ACM/LUG office. | + | _EVEN_THEME="acm" |
- | ACM_HOSTNAMES=( defiant.acm.cs miranda.acm.cs sovereign.acm.cs ) | + | _ODD_THEME="lug" |
- | LUG_HOSTNAMES=( constitution.acm.cs galaxy.acm.cs intrepid.acm.cs ) | + | _IP="$(ip addr | awk '/inet/ && /enp/{sub(/\/.*$/,"",$2); print $2}' | cut -d'.' -f4)" |
- | + | _REMAIN=$(expr $_IP % 2) | |
- | function contains() { | + | if [ $_REMAIN -eq 0 ] |
- | 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 | then | ||
- | # echo "This is an LUG Logo." | + | echo "This is an ACM Logo." |
- | sed -i -e 's/^theme=.*/theme=lug/' /etc/lxdm/lxdm.conf | + | sed -i -e 's/^theme=.*/theme='$_EVEN_THEME'/' /etc/lxdm/lxdm.conf |
+ | else | ||
+ | echo "This is an LUG Logo." | ||
+ | sed -i -e 's/^theme=.*/theme='$_ODD_THEME'/' /etc/lxdm/lxdm.conf | ||
fi | fi | ||
</code> | </code> |