1 |
hollow 08/10/28 12:17:34 |
2 |
|
3 |
Added: porticron-0.1 |
4 |
Log: |
5 |
initial version |
6 |
(Portage version: 2.1.4.5) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 app-portage/porticron/files/porticron-0.1 |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-portage/porticron/files/porticron-0.1?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-portage/porticron/files/porticron-0.1?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: porticron-0.1 |
15 |
=================================================================== |
16 |
#!/bin/bash |
17 |
|
18 |
SCRIPT_NAME=$(basename $0) |
19 |
FQDN=$(hostname --fqdn) |
20 |
IP=$(dig +short ${FQDN}) |
21 |
DATE=$(date -R) |
22 |
PORTDIR=$(portageq portdir) |
23 |
|
24 |
# only sync portage if PORTDIR is mounted read-write |
25 |
if touch "${PORTDIR}"/.read_only_check &>/dev/null; then |
26 |
rm -f "${PORTDIR}"/.read_only_check |
27 |
/usr/bin/emerge --sync --quiet &>/dev/null |
28 |
fi |
29 |
|
30 |
PACKAGES=$(/usr/bin/emerge --pretend --changelog --update --deep --newuse --quiet --usepkg world 2>/dev/null) |
31 |
|
32 |
if [[ -z ${PACKAGES} ]]; then |
33 |
exit 0 |
34 |
fi |
35 |
|
36 |
cat <<EOF | sendmail -t |
37 |
To: root@${FQDN} |
38 |
From: root@${FQDN} |
39 |
Subject: Gentoo package updates on ${FQDN} |
40 |
Date: ${DATE} |
41 |
|
42 |
porticron report [${DATE}] |
43 |
======================================================================== |
44 |
|
45 |
${SCRIPT_NAME} has detected that some packages need upgrading on: |
46 |
|
47 |
${FQDN} |
48 |
[ ${IP} ] |
49 |
|
50 |
The following packages are currently pending an upgrade: |
51 |
|
52 |
$(echo "${PACKAGES}" | sed 's/^\[/ [/') |
53 |
|
54 |
======================================================================== |
55 |
|
56 |
You can perform the upgrade by issuing the command: |
57 |
|
58 |
emerge -NDuk world |
59 |
|
60 |
as root on ${FQDN} |
61 |
|
62 |
It is recommended that you pretend the upgrade first to confirm that |
63 |
the actions that would be taken are reasonable. The upgrade may be |
64 |
pretended by issuing the command: |
65 |
|
66 |
emerge -NDuvpk world |
67 |
|
68 |
-- |
69 |
${SCRIPT_NAME} |
70 |
EOF |