From ce63e63d7aaf900bac4339503c5d79ff3bd03d18 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 28 Feb 2017 16:55:02 -0500 Subject: Z99-cloud-locale-test.sh: install and make consistent. Modify upstream packaging to install this file, which was already installed in ubuntu packaging. Also, white space changes from tabs to spaces. Very few things in cloud-init are tabs now. Lastly, remove the executable bit on this as ait is not necessary. Scripts in /etc/profile.d do not have executable bit. --- packages/debian/rules.in | 1 + 1 file changed, 1 insertion(+) (limited to 'packages') diff --git a/packages/debian/rules.in b/packages/debian/rules.in index 9b004357..3df6053a 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -11,6 +11,7 @@ override_dh_install: dh_install install -d debian/cloud-init/etc/rsyslog.d cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf + install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init/etc/profile.d/Z99-cloud-locale-test.sh override_dh_auto_test: ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) -- cgit v1.2.3 From 33518d7d62493c7d00e3792146399c9572abe915 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 28 Feb 2017 16:53:56 -0500 Subject: Add profile.d script for showing warnings on login. Z99-cloudinit-warnings.sh can be dropped into /etc/profile.d. Warnings that are written to /var/lib/cloud/instance/warnings will be displayed to the user on stderr when they log in. --- packages/debian/rules.in | 1 + tools/Z99-cloudinit-warnings.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tools/Z99-cloudinit-warnings.sh (limited to 'packages') diff --git a/packages/debian/rules.in b/packages/debian/rules.in index 3df6053a..053b7649 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -12,6 +12,7 @@ override_dh_install: install -d debian/cloud-init/etc/rsyslog.d cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init/etc/profile.d/Z99-cloud-locale-test.sh + install -D ./tools/Z99-cloudinit-warnings.sh debian/cloud-init/etc/profile.d/Z99-cloudinit-warnings.sh override_dh_auto_test: ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) diff --git a/tools/Z99-cloudinit-warnings.sh b/tools/Z99-cloudinit-warnings.sh new file mode 100644 index 00000000..b237786b --- /dev/null +++ b/tools/Z99-cloudinit-warnings.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# This file is part of cloud-init. See LICENSE file for license information. + +# Purpose: show user warnings on login. + +cloud_init_warnings() { + local skipf="" warning="" idir="/var/lib/cloud/instance" n=0 + local warndir="$idir/warnings" + local ufile="$HOME/.cloud-warnings.skip" sfile="$warndir/.skip" + [ -d "$warndir" ] || return 0 + [ ! -f "$ufile" ] || return 0 + [ ! -f "$skipf" ] || return 0 + + for warning in "$warndir"/*; do + [ -f "$warning" ] || continue + cat "$warning" + n=$((n+1)) + done + [ $n -eq 0 ] && return 0 + echo "" + echo "Disable the warnings above by:" + echo " touch $ufile" + echo "or" + echo " touch $sfile" +} + +cloud_init_warnings 1>&2 +unset cloud_init_warnings + +# vi: syntax=sh ts=4 expandtab -- cgit v1.2.3