Tim Landscheidt has uploaded a new change for review. https://gerrit.wikimedia.org/r/78486
Change subject: Tools: Puppetize tips.sh ...................................................................... Tools: Puppetize tips.sh Change-Id: Iad5685e0fe559108d36ae50d43c28fcce809eace --- A modules/toollabs/files/tips.sh M modules/toollabs/manifests/bastion.pp 2 files changed, 60 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/86/78486/1 diff --git a/modules/toollabs/files/tips.sh b/modules/toollabs/files/tips.sh new file mode 100644 index 0000000..34551ca --- /dev/null +++ b/modules/toollabs/files/tips.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Disable when non-interactive. +if ! tty -s; then + exit 0 +fi + +# Check if user wants to display tips. +if [ -f ~/.suppresstips ]; then + exit 0 +fi + +# Check if there is a tip DB. +if [ ! -f /data/project/.system/tips ]; then + exit 0 +fi + +# Don't display tips for root and tool accounts. +if [ $UID -eq 0 ] || [ "${USER:0:6}" = "local-" ]; then + exit 0 +fi + +# Check shell level. +if [ "$SHLVL" -gt 1 ]; then + exit 0 +fi + +# If user is sysadmin print the sysadmin motd instead. +if groups | fgrep -qw local-admin; then + if [ -f /etc/motd.sysadmin ]; then + echo + echo + cat /etc/motd.sysadmin + fi + + # We don't want to show tips to sysadmins. + exit 0 +fi + +echo -e "\n\033[0;1;4mDid you know\033[0m that `shuf -n 1 /data/project/.system/tips`\n" diff --git a/modules/toollabs/manifests/bastion.pp b/modules/toollabs/manifests/bastion.pp index 2e17bb0..ecb7b8c 100644 --- a/modules/toollabs/manifests/bastion.pp +++ b/modules/toollabs/manifests/bastion.pp @@ -45,6 +45,26 @@ source => "puppet:///modules/toollabs/sql", } + # Display tips. + package { 'grep': + ensure => present, + } + + file { "/etc/profile.d/tips.sh": + ensure => file, + mode => "0755", + owner => "root", + group => "root", + source => "puppet:///modules/toollabs/tips.sh", + require => Package['grep'], + } + + file { [ '/data/project/.system/tips.sh', + '/data/project/.system/bin/tips.sh', + '/data/project/.system/bin/tips2.sh' ]: + ensure => absent, + } + package { [ 'jobutils', 'misctools' ]: ensure => latest, } -- To view, visit https://gerrit.wikimedia.org/r/78486 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iad5685e0fe559108d36ae50d43c28fcce809eace Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits