リビジョン | 483a5eb25a2a257085b767f008338b2762558f82 (tree) |
---|---|
日時 | 2019-04-08 23:49:51 |
作者 | Gardentree <keigo3142011@yaho...> |
コミッター | Gardentree |
delete initial,add whoami
@@ -1,4 +1,4 @@ | ||
1 | -#!/bin/sh | |
1 | +#!/bin/bash | |
2 | 2 | # |
3 | 3 | # 00-header - create the header of the MOTD |
4 | 4 | # Copyright (C) 2009-2010 Canonical Ltd. |
@@ -0,0 +1,4 @@ | ||
1 | +#!/bin/bash | |
2 | + | |
3 | +printf "User:" | |
4 | +whoami |
@@ -1,26 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | -# | |
3 | -# 10-help-text - print the help text associated with the distro | |
4 | -# Copyright (C) 2009-2010 Canonical Ltd. | |
5 | -# | |
6 | -# Authors: Dustin Kirkland <kirkland@canonical.com>, | |
7 | -# Brian Murray <brian@canonical.com> | |
8 | -# | |
9 | -# This program is free software; you can redistribute it and/or modify | |
10 | -# it under the terms of the GNU General Public License as published by | |
11 | -# the Free Software Foundation; either version 2 of the License, or | |
12 | -# (at your option) any later version. | |
13 | -# | |
14 | -# This program is distributed in the hope that it will be useful, | |
15 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | -# GNU General Public License for more details. | |
18 | -# | |
19 | -# You should have received a copy of the GNU General Public License along | |
20 | -# with this program; if not, write to the Free Software Foundation, Inc., | |
21 | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 | - | |
23 | -printf "\n" | |
24 | -printf " * Documentation: https://help.ubuntu.com\n" | |
25 | -printf " * Management: https://landscape.canonical.com\n" | |
26 | -printf " * Support: https://ubuntu.com/advantage\n" |
@@ -1,123 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | -# | |
3 | -# 50-motd-news - print the live news from the Ubuntu wire | |
4 | -# Copyright (C) 2016-2017 Canonical Ltd. | |
5 | -# Copyright (C) 2016-2017 Dustin Kirkland | |
6 | -# | |
7 | -# Authors: Dustin Kirkland <kirkland@canonical.com> | |
8 | -# | |
9 | -# This program is free software; you can redistribute it and/or modify | |
10 | -# it under the terms of the GNU General Public License as published by | |
11 | -# the Free Software Foundation; either version 2 of the License, or | |
12 | -# (at your option) any later version. | |
13 | -# | |
14 | -# This program is distributed in the hope that it will be useful, | |
15 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | -# GNU General Public License for more details. | |
18 | -# | |
19 | -# You should have received a copy of the GNU General Public License along | |
20 | -# with this program; if not, write to the Free Software Foundation, Inc., | |
21 | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 | - | |
23 | -############################################################################## | |
24 | -# This program could be rewritten in C or Golang for faster performance. | |
25 | -# Or it could be rewritten in Python or another higher level language | |
26 | -# for more modularity. | |
27 | -# However, I've insisted on shell here for transparency! | |
28 | -# - Dustin | |
29 | -############################################################################## | |
30 | - | |
31 | -# Source the local configuration | |
32 | -[ -r /etc/default/motd-news ] && . /etc/default/motd-news | |
33 | - | |
34 | -# Exit immediately, unless we're enabled | |
35 | -# This makes this script very easy to disable in /etc/default/motd-news configuration | |
36 | -[ "$ENABLED" = "1" ] || exit 0 | |
37 | - | |
38 | -# Ensure sane defaults | |
39 | -[ -n "$URLS" ] || URLS="https://motd.ubuntu.com" | |
40 | -[ -n "$WAIT" ] || WAIT=5 | |
41 | -[ -n "$CACHE" ] || CACHE="/var/cache/motd-news" | |
42 | -[ "$1" = "--force" ] && FORCED=1 | |
43 | - | |
44 | -# Ensure we print safely, maximum of the first 10 lines, | |
45 | -# maximum of the first 80 chars per line, no control chars | |
46 | -safe_print() { | |
47 | - cat "$1" | head -n 10 | tr -d '\000-\011\013\014\016-\037' | cut -c -80 | |
48 | -} | |
49 | - | |
50 | - | |
51 | -# If we're not forcing an update, and we have a cached motd-news file, | |
52 | -# then just print it and exit as quickly as possible, for login performance. | |
53 | -# Note that systemd should keep this cache file up to date, asynchronously | |
54 | -if [ "$FORCED" != "1" ]; then | |
55 | - if [ -r $CACHE ]; then | |
56 | - echo | |
57 | - safe_print $CACHE | |
58 | - else | |
59 | - : > $CACHE | |
60 | - fi | |
61 | - exit 0 | |
62 | -fi | |
63 | - | |
64 | -# If we've made it here, we've been given the --force argument, | |
65 | -# probably from the systemd motd-news.service. Let's update... | |
66 | - | |
67 | -# Generate our temp files, clean up when done | |
68 | -NEWS=$(mktemp) || exit 1 | |
69 | -ERR=$(mktemp) || exit 1 | |
70 | -trap "rm -f $NEWS $ERR" HUP INT QUIT ILL TRAP KILL BUS TERM | |
71 | - | |
72 | -# Construct a user agent, similar to Firefox/Chrome/Safari/IE to | |
73 | -# ensure a proper, tailored, accurate message of the day | |
74 | - | |
75 | -# Curl browser version, for debug purposes | |
76 | -curl_ver="$(dpkg -l curl | awk '$1 == "ii" { print($3); exit(0); }')" | |
77 | - | |
78 | -# Distribution version, for messages releated to this Ubuntu release | |
79 | -. /etc/lsb-release | |
80 | -lsb=$(echo "$DISTRIB_DESCRIPTION" | sed -e "s/ /\//g") | |
81 | -codename="$DISTRIB_CODENAME" | |
82 | - | |
83 | -# Kernel version and CPU type, for messages related to a particular revision or hardware | |
84 | -platform="$(uname -o)/$(uname -r)/$(uname -m)" | |
85 | -arch="$(uname -m)" | |
86 | -cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")" | |
87 | - | |
88 | -# Some messages may only be pertinent before or after some amount of uptime | |
89 | -read up idle < /proc/uptime | |
90 | -uptime="uptime/$up/$idle" | |
91 | - | |
92 | -# Piece together the user agent | |
93 | -USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime" | |
94 | - | |
95 | -# Loop over any configured URLs | |
96 | -for u in $URLS; do | |
97 | - # Ensure https:// protocol, for security reasons | |
98 | - case $u in | |
99 | - https://*) | |
100 | - true | |
101 | - ;; | |
102 | - https://motd.ubuntu.com) | |
103 | - u="$u/$codename/$arch" | |
104 | - ;; | |
105 | - *) | |
106 | - continue | |
107 | - ;; | |
108 | - esac | |
109 | - # If we're forced, set the wait to much higher (1 minute) | |
110 | - [ "$FORCED" = "1" ] && WAIT=60 | |
111 | - # Fetch and print the news motd | |
112 | - if curl --connect-timeout "$WAIT" --max-time "$WAIT" -A "$USER_AGENT" -o- "$u" >"$NEWS" 2>"$ERR"; then | |
113 | - echo | |
114 | - # At most, 10 lines of text, remove control characters, print at most 80 characters per line | |
115 | - safe_print "$NEWS" | |
116 | - # Try to update the cache | |
117 | - safe_print "$NEWS" 2>/dev/null >$CACHE || true | |
118 | - else | |
119 | - : > "$CACHE" | |
120 | - fi | |
121 | -done | |
122 | -rm -f "$NEWS" "$ERR" | |
123 | -exit 0 |
@@ -1,24 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -SERIES=$(lsb_release -cs) | |
4 | -DESCRIPTION=$(lsb_release -ds) | |
5 | - | |
6 | -[ "$SERIES" = "precise" ] || exit 0 | |
7 | - | |
8 | -[ -x /usr/bin/ubuntu-advantage ] || exit 0 | |
9 | - | |
10 | -if ubuntu-advantage is-esm-enabled; then | |
11 | - cat <<EOF | |
12 | -This ${DESCRIPTION} system is configured to receive extended security updates | |
13 | -from Canonical: | |
14 | - * https://www.ubuntu.com/esm | |
15 | -EOF | |
16 | -else | |
17 | - cat <<EOF | |
18 | -This ${DESCRIPTION} system is past its End of Life, and is no longer | |
19 | -receiving security updates. To protect the integrity of this system, it’s | |
20 | -critical that you enable Extended Security Maintenance updates: | |
21 | - * https://www.ubuntu.com/esm | |
22 | -EOF | |
23 | -fi | |
24 | -echo |
@@ -1,93 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -UA=${UA:-"/usr/bin/ubuntu-advantage"} | |
4 | -UA_STATUS_CACHE=${UA_STATUS_CACHE:-"/var/cache/ubuntu-advantage-tools/ubuntu-advantage-status.cache"} | |
5 | - | |
6 | -[ -x "$UA" ] || exit 0 | |
7 | - | |
8 | -print_patch_state() { | |
9 | - local patch_state="$1" | |
10 | - | |
11 | - case "$patch_state" in | |
12 | - unapplied) | |
13 | - echo "Patches are available, will be deployed shortly." | |
14 | - ;; | |
15 | - applied) | |
16 | - echo "All available patches applied." | |
17 | - ;; | |
18 | - applied-with-bug|apply-failed) | |
19 | - echo "Live patching failed, please run \`ubuntu-bug linux\` to report a bug." | |
20 | - ;; | |
21 | - nothing-to-apply) | |
22 | - echo "All available patches applied." | |
23 | - ;; | |
24 | - applying) | |
25 | - echo "Live patching currently in progress." | |
26 | - ;; | |
27 | - *) | |
28 | - echo "Unknown patch status. Please see /var/log/syslog for more information." | |
29 | - echo " Status: \"$patch_state\"" | |
30 | - ;; | |
31 | - esac | |
32 | -} | |
33 | - | |
34 | -print_status() { | |
35 | - local check_state="$1" | |
36 | - local patch_state="$2" | |
37 | - | |
38 | - echo -n " - " | |
39 | - case "$check_state" in | |
40 | - needs-check) | |
41 | - echo "Regular server check is pending." | |
42 | - ;; | |
43 | - check-failed) | |
44 | - echo "Livepatch server check failed." | |
45 | - echo " Please see /var/log/syslog for more information." | |
46 | - ;; | |
47 | - checked) | |
48 | - print_patch_state "$patch_state" | |
49 | - ;; | |
50 | - *) | |
51 | - echo "Unknown check status. Please see /var/log/syslog for more information." | |
52 | - echo " Status: \"$check_state\"" | |
53 | - ;; | |
54 | - esac | |
55 | -} | |
56 | - | |
57 | - | |
58 | -service_name="livepatch" | |
59 | -# if there is no cache file yet (the cron job hasn't run yet), bail | |
60 | -[ -s "$UA_STATUS_CACHE" ] || exit 0 | |
61 | -ua_status=$(cat "$UA_STATUS_CACHE") | |
62 | -# if there is no livepatch section at all in the output, silently | |
63 | -# bail | |
64 | -has_livepatch=$(echo "${ua_status}" | grep "^${service_name}") | |
65 | -[ -n "${has_livepatch}" ] || exit 0 | |
66 | -livepatch_status=$(echo "$ua_status"|grep ^${service_name}:|sed -r -n "s,^${service_name}: (.*)$,\\1,p") | |
67 | -# only look for patchState and checkState inside the specific service | |
68 | -# block in the status output | |
69 | -patch_state=$(echo "$ua_status"|sed -r -n "/^${service_name}:/,/^\\S/s,^[[:blank:]]+patchState: (.*)$,\\1,p") | |
70 | -check_state=$(echo "$ua_status"|sed -r -n "/^${service_name}:/,/^\\S/s,^[[:blank:]]+checkState: (.*)$,\\1,p") | |
71 | - | |
72 | -case "$livepatch_status" in | |
73 | - "disabled (not available)") | |
74 | - # do nothing | |
75 | - ;; | |
76 | - "enabled") | |
77 | - echo | |
78 | - echo " * Canonical Livepatch is enabled." | |
79 | - print_status "${check_state}" "${patch_state}" | |
80 | - ;; | |
81 | - "disabled") | |
82 | - echo | |
83 | - echo " * Canonical Livepatch is available for installation." | |
84 | - echo " - Reduce system reboots and improve kernel security. Activate at:" | |
85 | - echo " https://ubuntu.com/livepatch" | |
86 | - ;; | |
87 | - *) | |
88 | - echo | |
89 | - echo " * Canonical Livepatch is in an unknown state." | |
90 | - echo " - Please see /var/log/syslog for more information." | |
91 | - echo " Status: \"$livepatch_status\"" | |
92 | - ;; | |
93 | -esac |
@@ -1,5 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -stamp="/var/lib/update-notifier/updates-available" | |
4 | - | |
5 | -[ ! -r "$stamp" ] || cat "$stamp" |
@@ -1,9 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -# if the current release is under development there won't be a new one | |
4 | -if [ "$(lsb_release -sd | cut -d' ' -f4)" = "(development" ]; then | |
5 | - exit 0 | |
6 | -fi | |
7 | -if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then | |
8 | - exec /usr/lib/ubuntu-release-upgrader/release-upgrade-motd | |
9 | -fi |
@@ -1,5 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -if [ -x /usr/lib/update-notifier/update-motd-hwe-eol ]; then | |
4 | - exec /usr/lib/update-notifier/update-motd-hwe-eol | |
5 | -fi |
@@ -1,5 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -if [ -x /usr/lib/update-notifier/update-motd-fsck-at-reboot ]; then | |
4 | - exec /usr/lib/update-notifier/update-motd-fsck-at-reboot | |
5 | -fi | |
\ No newline at end of file |
@@ -1,5 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -if [ -x /usr/lib/update-notifier/update-motd-reboot-required ]; then | |
4 | - exec /usr/lib/update-notifier/update-motd-reboot-required | |
5 | -fi | |
\ No newline at end of file |