Initial Commit
This commit is contained in:
commit
f1abd591b4
12 changed files with 553 additions and 0 deletions
29
00-header
Executable file
29
00-header
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 00-header - create the header of the MOTD
|
||||
# Copyright (C) 2009-2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
[ -r /etc/lsb-release ] && . /etc/lsb-release
|
||||
|
||||
if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
|
||||
# Fall back to using the very slow lsb_release utility
|
||||
DISTRIB_DESCRIPTION=$(lsb_release -s -d)
|
||||
fi
|
||||
figlet -f fire $(hostname)
|
||||
printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
|
||||
[ "$(date +%m/%d)" = "03/14" ] && figlet -f fire "Happy PI day!"
|
34
09-sysinfo
Executable file
34
09-sysinfo
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 09-sysinfo - generate the system information
|
||||
# Copyright (c) 2013 Nick Charlton
|
||||
#
|
||||
# Authors: Nick Charlton <hello@nickcharlton.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
date=`date`
|
||||
load=`cat /proc/loadavg | awk '{print $1}'`
|
||||
root_usage=`df -h / | awk '/\// {print $(NF-1)}'`
|
||||
memory_usage=`free -m | awk '/Mem/ { printf("%3.1f%%", $3/$2*100) }'`
|
||||
swap_usage=`free -m | awk '/Swap/ { printf("%3.1f%%", $3/$2*100) }'`
|
||||
users=`users | wc -w`
|
||||
|
||||
echo "System information as of: $date"
|
||||
echo
|
||||
printf "System load:\t%s\tMemory usage:\t%s\n" $load $memory_usage
|
||||
printf "Usage on /:\t%s\tSwap usage:\t%s\n" $root_usage $swap_usage
|
||||
printf "Local users:\t%s\n" $users
|
||||
echo
|
28
10-help-text
Executable file
28
10-help-text
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 10-help-text - print the help text associated with the distro
|
||||
# Copyright (C) 2009-2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@canonical.com>,
|
||||
# Brian Murray <brian@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
printf "\n"
|
||||
printf " * Documentation: https://raspberrypi.com/documentation\n"
|
||||
#printf " * Management: https://landscape.canonical.com\n"
|
||||
printf " * Support: https://forums.raspberrypi.com\n"
|
||||
#spinner /etc/update-motd.d/50-motd-news --force --null
|
||||
printf " \n"
|
2
10-uname
Normal file
2
10-uname
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
uname -snrvm
|
157
50-motd-news
Executable file
157
50-motd-news
Executable file
|
@ -0,0 +1,157 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 50-motd-news - print the live news from the Ubuntu wire
|
||||
# Copyright (C) 2016-2020 Canonical Ltd.
|
||||
# Copyright (C) 2016-2017 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@canonical.com>
|
||||
# Steve Langasek <steve.langasek@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
##############################################################################
|
||||
# This program could be rewritten in C or Golang for faster performance.
|
||||
# Or it could be rewritten in Python or another higher level language
|
||||
# for more modularity.
|
||||
# However, I've insisted on shell here for transparency!
|
||||
# - Dustin
|
||||
##############################################################################
|
||||
|
||||
# Source the local configuration
|
||||
[ -r /etc/default/motd-news ] && . /etc/default/motd-news
|
||||
|
||||
# Exit immediately, unless we're enabled
|
||||
# This makes this script very easy to disable in /etc/default/motd-news configuration
|
||||
[ "$ENABLED" = "1" ] || exit 0
|
||||
|
||||
# Ensure sane defaults
|
||||
[ -n "$URLS" ] || URLS="https://motd.ubuntu.com"
|
||||
[ -n "$WAIT" ] || WAIT=5
|
||||
[ -n "$CACHE" ] || CACHE="/var/cache/motd-news"
|
||||
[ "$1" = "--force" ] && FORCED=1
|
||||
|
||||
# Ensure we print safely, maximum of the first 10 lines,
|
||||
# maximum of the first 80 chars per line, no control chars
|
||||
safe_print() {
|
||||
cat "$1" | head -n 10 | tr -d '\000-\011\013\014\016-\037' | cut -c -80
|
||||
}
|
||||
|
||||
|
||||
# If we're not forcing an update, and we have a cached motd-news file,
|
||||
# then just print it and exit as quickly as possible, for login performance.
|
||||
# Note that systemd should keep this cache file up to date, asynchronously
|
||||
if [ "$FORCED" != "1" ]; then
|
||||
if [ -r $CACHE ]; then
|
||||
echo " * News:"
|
||||
safe_print $CACHE
|
||||
elif [ "$(id -u)" -eq 0 ]; then
|
||||
printf " * News:\n * No News\n"
|
||||
: > $CACHE
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If we've made it here, we've been given the --force argument,
|
||||
# probably from the systemd motd-news.service. Let's update...
|
||||
|
||||
# Abort early if wget is missing
|
||||
[ -x /usr/bin/wget ] || exit 0
|
||||
|
||||
# Generate our temp files, clean up when done
|
||||
NEWS=$(mktemp) || exit 1
|
||||
ERR=$(mktemp) || exit 1
|
||||
CLOUD=$(mktemp) || exit 1
|
||||
trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP KILL BUS TERM
|
||||
|
||||
# Construct a user agent, similar to Firefox/Chrome/Safari/IE to
|
||||
# ensure a proper, tailored, accurate message of the day
|
||||
|
||||
# wget browser version, for debug purposes
|
||||
wget_ver="$(dpkg -l wget | awk '$1 == "ii" { print($3); exit(0); }')"
|
||||
|
||||
# Distribution version, for messages releated to this Ubuntu release
|
||||
. /etc/lsb-release
|
||||
lsb=$(echo "$DISTRIB_DESCRIPTION" | sed -e "s/ /\//g")
|
||||
codename="$DISTRIB_CODENAME"
|
||||
|
||||
# Kernel version and CPU type, for messages related to a particular revision or hardware
|
||||
platform="$(uname -o)/$(uname -r)/$(uname -m)"
|
||||
arch="$(uname -m)"
|
||||
cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")"
|
||||
cloud_id="unknown"
|
||||
if [ -x /usr/bin/cloud-id ]; then
|
||||
/usr/bin/cloud-id > "$CLOUD" 2>/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
# sanitize it a bit, just in case
|
||||
cloud_id=$(cut -c -40 "${CLOUD}" | tr -c -d '[:alnum:]')
|
||||
if [ -z "${cloud_id}" ]; then
|
||||
cloud_id="unknown"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Piece together the user agent
|
||||
USER_AGENT="wget/$wget_ver $lsb $platform $cpu cloud_id/$cloud_id"
|
||||
|
||||
# Loop over any configured URLs
|
||||
for u in $URLS; do
|
||||
# Ensure https:// protocol, for security reasons
|
||||
case $u in
|
||||
https://*)
|
||||
true
|
||||
;;
|
||||
https://motd.ubuntu.com)
|
||||
u="$u/$codename/$arch"
|
||||
;;
|
||||
call*)
|
||||
cmd=$(echo $u|cut -c 6-)
|
||||
response=$($cmd)
|
||||
title=$(echo "$response"|grep -E " \* " --color=never)
|
||||
url=$(echo "$response"|tail -1)
|
||||
echo "$title\n\n$url" > "$CACHE"
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
# If we're forced, set the wait to much higher (1 minute)
|
||||
[ "$FORCED" = "1" ] && WAIT=60
|
||||
# Fetch and print the news motd
|
||||
result=0
|
||||
not_found_is_ok=0
|
||||
wget --timeout "$WAIT" -U "$USER_AGENT" -O- --content-on-error "$u" >"$NEWS" 2>"$ERR" || result=$?
|
||||
# from wget's manpage: 8 Server issued an error response.
|
||||
if [ $result -eq 8 ]; then
|
||||
if grep -q "ERROR 404" "$ERR"; then
|
||||
# The server's 404 document is the generic, non cloud-specific, motd-news
|
||||
# content present in the index.txt file
|
||||
not_found_is_ok=1
|
||||
fi
|
||||
fi
|
||||
if [ $result -eq 0 ] || [ $not_found_is_ok -eq 1 ]; then
|
||||
echo
|
||||
# At most, 10 lines of text, remove control characters, print at most 80 characters per line
|
||||
echo " * News:"
|
||||
safe_print "$NEWS"
|
||||
# Try to update the cache
|
||||
safe_print "$NEWS" 2>/dev/null >$CACHE || true
|
||||
else
|
||||
printf " * News:\n * No News"
|
||||
echo " * No News" > "$CACHE"
|
||||
fi
|
||||
done
|
||||
rm -f "$NEWS" "$ERR" "$CLOUD"
|
||||
exit 0
|
5
85-fwupd
Executable file
5
85-fwupd
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -f /run/motd.d/85-fwupd ]; then
|
||||
cat /run/motd.d/85-fwupd
|
||||
fi
|
8
91-contract-ua-esm-status
Executable file
8
91-contract-ua-esm-status
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
contract_status_stamp="/var/lib/ubuntu-advantage/messages/motd-contract-status"
|
||||
|
||||
[ ! -r "$contract_status_stamp" ] || cat "$contract_status_stamp"
|
||||
|
||||
auto_attach_stamp="/var/lib/ubuntu-advantage/messages/motd-auto-attach-status"
|
||||
|
||||
[ ! -r "$auto_attach_stamp" ] || cat "$auto_attach_stamp"
|
20
91-release-upgrade
Executable file
20
91-release-upgrade
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
# if the current release is under development there won't be a new one
|
||||
[ -r /etc/lsb-release ] && . /etc/lsb-release
|
||||
if [ -z "$DISTRIB_DESCRIPTION" ] && command -v lsb_release > /dev/null; then
|
||||
DISTRIB_DESCRIPTION=$(lsb_release -s -d)
|
||||
fi
|
||||
|
||||
if [ "$(echo "$DISTRIB_DESCRIPTION" | cut -d' ' -f4)" = "(development" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if it is non-root user, skip
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then
|
||||
exec /usr/lib/ubuntu-release-upgrader/release-upgrade-motd
|
||||
fi
|
5
92-unattended-upgrades
Executable file
5
92-unattended-upgrades
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -x /usr/share/unattended-upgrades/update-motd-unattended-upgrades ]; then
|
||||
exec /usr/share/unattended-upgrades/update-motd-unattended-upgrades
|
||||
fi
|
125
93-updates
Executable file
125
93-updates
Executable file
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/python3
|
||||
#
|
||||
# 20-updates - create the system updates section of the MOTD
|
||||
# Copyright (c) 2013 Nick Charlton
|
||||
#
|
||||
# Authors: Nick Charlton <hello@nickcharlton.net>
|
||||
# Based upon prior work by Dustin Kirkland and Michael Vogt.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import apt_pkg
|
||||
|
||||
print("")
|
||||
print(" * Updates:")
|
||||
|
||||
if subprocess.Popen(["is_tty"], stdout=subprocess.PIPE).communicate()[0].strip().decode()!="tty":
|
||||
print(" Updates are not checked on non-tty sessions")
|
||||
print(" so as to not slow down login times")
|
||||
print("")
|
||||
sys.exit(0)
|
||||
|
||||
DISTRO = subprocess.Popen(["lsb_release", "-c", "-s"],
|
||||
stdout=subprocess.PIPE).communicate()[0].strip()
|
||||
|
||||
class OpNullProgress(object):
|
||||
'''apt progress handler which supresses any output.'''
|
||||
def update(self):
|
||||
pass
|
||||
def done(self):
|
||||
pass
|
||||
|
||||
def is_security_upgrade(pkg):
|
||||
'''
|
||||
Checks to see if a package comes from a DISTRO-security source.
|
||||
'''
|
||||
security_package_sources = [("Ubuntu", "%s-security" % DISTRO),
|
||||
("Debian", "%s-security" % DISTRO)]
|
||||
|
||||
for (file, index) in pkg.file_list:
|
||||
for origin, archive in security_package_sources:
|
||||
if (file.archive == archive and file.origin == origin):
|
||||
return True
|
||||
return False
|
||||
|
||||
# init apt and config
|
||||
apt_pkg.init()
|
||||
|
||||
# open the apt cache
|
||||
try:
|
||||
cache = apt_pkg.Cache(OpNullProgress())
|
||||
except SystemError as e:
|
||||
sys.stderr.write("Error: Opening the cache (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
# setup a DepCache instance to interact with the repo
|
||||
depcache = apt_pkg.DepCache(cache)
|
||||
|
||||
# take into account apt policies
|
||||
depcache.read_pinfile()
|
||||
|
||||
# initialise it
|
||||
depcache.init()
|
||||
|
||||
# give up if packages are broken
|
||||
if depcache.broken_count > 0:
|
||||
sys.stderr.write("Error: Broken packages exist.")
|
||||
sys.exit(-1)
|
||||
|
||||
# mark possible packages
|
||||
try:
|
||||
# run distro-upgrade
|
||||
depcache.upgrade(True)
|
||||
# reset if packages get marked as deleted -> we don't want to break anything
|
||||
if depcache.del_count > 0:
|
||||
depcache.init()
|
||||
|
||||
# then a standard upgrade
|
||||
depcache.upgrade()
|
||||
except SystemError as e:
|
||||
sys.stderr.write("Error: Couldn't mark the upgrade (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
# run around the packages
|
||||
upgrades = 0
|
||||
security_upgrades = 0
|
||||
for pkg in cache.packages:
|
||||
candidate = depcache.get_candidate_ver(pkg)
|
||||
current = pkg.current_ver
|
||||
|
||||
# skip packages not marked as upgraded/installed
|
||||
if not (depcache.marked_install(pkg) or depcache.marked_upgrade(pkg)):
|
||||
continue
|
||||
|
||||
# increment the upgrade counter
|
||||
upgrades += 1
|
||||
|
||||
# keep another count for security upgrades
|
||||
if is_security_upgrade(candidate):
|
||||
security_upgrades += 1
|
||||
|
||||
# double check for security upgrades masked by another package
|
||||
for version in pkg.version_list:
|
||||
if (current and apt_pkg.version_compare(version.ver_str, current.ver_str) <= 0):
|
||||
continue
|
||||
if is_security_upgrade(version):
|
||||
security_upgrades += 1
|
||||
break
|
||||
|
||||
print(" %d updates to install." % upgrades)
|
||||
print(" %d are security updates." % security_upgrades)
|
||||
print("") # leave a trailing blank line
|
116
93-updates.bak
Executable file
116
93-updates.bak
Executable file
|
@ -0,0 +1,116 @@
|
|||
#!/usr/bin/python3
|
||||
#
|
||||
# 20-updates - create the system updates section of the MOTD
|
||||
# Copyright (c) 2013 Nick Charlton
|
||||
#
|
||||
# Authors: Nick Charlton <hello@nickcharlton.net>
|
||||
# Based upon prior work by Dustin Kirkland and Michael Vogt.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import apt_pkg
|
||||
|
||||
DISTRO = subprocess.Popen(["lsb_release", "-c", "-s"],
|
||||
stdout=subprocess.PIPE).communicate()[0].strip()
|
||||
|
||||
class OpNullProgress(object):
|
||||
'''apt progress handler which supresses any output.'''
|
||||
def update(self):
|
||||
pass
|
||||
def done(self):
|
||||
pass
|
||||
|
||||
def is_security_upgrade(pkg):
|
||||
'''
|
||||
Checks to see if a package comes from a DISTRO-security source.
|
||||
'''
|
||||
security_package_sources = [("Ubuntu", "%s-security" % DISTRO),
|
||||
("Debian", "%s-security" % DISTRO)]
|
||||
|
||||
for (file, index) in pkg.file_list:
|
||||
for origin, archive in security_package_sources:
|
||||
if (file.archive == archive and file.origin == origin):
|
||||
return True
|
||||
return False
|
||||
|
||||
# init apt and config
|
||||
apt_pkg.init()
|
||||
|
||||
# open the apt cache
|
||||
try:
|
||||
cache = apt_pkg.Cache(OpNullProgress())
|
||||
except SystemError, e:
|
||||
sys.stderr.write("Error: Opening the cache (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
# setup a DepCache instance to interact with the repo
|
||||
depcache = apt_pkg.DepCache(cache)
|
||||
|
||||
# take into account apt policies
|
||||
depcache.read_pinfile()
|
||||
|
||||
# initialise it
|
||||
depcache.init()
|
||||
|
||||
# give up if packages are broken
|
||||
if depcache.broken_count > 0:
|
||||
sys.stderr.write("Error: Broken packages exist.")
|
||||
sys.exit(-1)
|
||||
|
||||
# mark possible packages
|
||||
try:
|
||||
# run distro-upgrade
|
||||
depcache.upgrade(True)
|
||||
# reset if packages get marked as deleted -> we don't want to break anything
|
||||
if depcache.del_count > 0:
|
||||
depcache.init()
|
||||
|
||||
# then a standard upgrade
|
||||
depcache.upgrade()
|
||||
except SystemError, e:
|
||||
sys.stderr.write("Error: Couldn't mark the upgrade (%s)" % e)
|
||||
sys.exit(-1)
|
||||
|
||||
# run around the packages
|
||||
upgrades = 0
|
||||
security_upgrades = 0
|
||||
for pkg in cache.packages:
|
||||
candidate = depcache.get_candidate_ver(pkg)
|
||||
current = pkg.current_ver
|
||||
|
||||
# skip packages not marked as upgraded/installed
|
||||
if not (depcache.marked_install(pkg) or depcache.marked_upgrade(pkg)):
|
||||
continue
|
||||
|
||||
# increment the upgrade counter
|
||||
upgrades += 1
|
||||
|
||||
# keep another count for security upgrades
|
||||
if is_security_upgrade(candidate):
|
||||
security_upgrades += 1
|
||||
|
||||
# double check for security upgrades masked by another package
|
||||
for version in pkg.version_list:
|
||||
if (current and apt_pkg.version_compare(version.ver_str, current.ver_str) <= 0):
|
||||
continue
|
||||
if is_security_upgrade(version):
|
||||
security_upgrades += 1
|
||||
break
|
||||
|
||||
print "%d updates to install." % upgrades
|
||||
print "%d are security updates." % security_upgrades
|
||||
print "" # leave a trailing blank line
|
24
99-footer
Executable file
24
99-footer
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 99-footer - write the admin's footer to the MOTD
|
||||
# Copyright (c) 2013 Nick Charlton
|
||||
# Copyright (c) 2009-2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Nick Charlton <hello@nickcharlton.net>
|
||||
# Dustin Kirkland <kirkland@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
[ -f /etc/motd.tail ] && cat /etc/motd.tail || true
|
Loading…
Reference in a new issue