Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/website/static/security/patches/EN-15:04/freebsd-update.patch
18096 views
1
Index: usr.sbin/freebsd-update/freebsd-update.8
2
===================================================================
3
--- usr.sbin/freebsd-update/freebsd-update.8 (revision 282245)
4
+++ usr.sbin/freebsd-update/freebsd-update.8 (working copy)
5
@@ -25,7 +25,7 @@
6
.\"
7
.\" $FreeBSD$
8
.\"
9
-.Dd July 14, 2010
10
+.Dd March 2, 2015
11
.Dt FREEBSD-UPDATE 8
12
.Os FreeBSD
13
.Sh NAME
14
@@ -36,10 +36,12 @@
15
.Op Fl b Ar basedir
16
.Op Fl d Ar workdir
17
.Op Fl f Ar conffile
18
+.Op Fl F
19
.Op Fl k Ar KEY
20
.Op Fl r Ar newrelease
21
.Op Fl s Ar server
22
.Op Fl t Ar address
23
+.Op Fl -not-running-from-cron
24
.Cm command ...
25
.Sh DESCRIPTION
26
The
27
@@ -54,16 +56,16 @@ by the
28
.Fx
29
Release Engineering Team, e.g.,
30
.Fx
31
-7.3-RELEASE and
32
+9.3-RELEASE and
33
.Fx
34
-8.0-RELEASE, but not
35
+10.1-RELEASE, but not
36
.Fx
37
-6.3-STABLE or
38
+9.3-STABLE or
39
.Fx
40
-9.0-CURRENT.
41
+11-CURRENT.
42
.Sh OPTIONS
43
The following options are supported:
44
-.Bl -tag -width "-f conffile"
45
+.Bl -tag -width "-r newrelease"
46
.It Fl b Ar basedir
47
Operate on a system mounted at
48
.Ar basedir .
49
@@ -81,6 +83,10 @@ Read configuration options from
50
.Ar conffile .
51
(default:
52
.Pa /etc/freebsd-update.conf )
53
+.It Fl F
54
+Force
55
+.Nm Cm fetch
56
+to proceed where it normally would not, such as an unfinished upgrade
57
.It Fl k Ar KEY
58
Trust an RSA key with SHA256 of
59
.Ar KEY .
60
@@ -98,12 +104,21 @@ Mail output of
61
command, if any, to
62
.Ar address .
63
(default: root, or as given in the configuration file.)
64
+.It Fl -not-running-from-cron
65
+Force
66
+.Nm Cm fetch
67
+to proceed when there is no controlling tty.
68
+This is for use by automated scripts and orchestration tools.
69
+Please do not run
70
+.Nm Cm fetch
71
+from crontab or similar using this flag, see:
72
+.Nm Cm cron
73
.El
74
.Sh COMMANDS
75
The
76
.Cm command
77
can be any one of the following:
78
-.Bl -tag -width "-f conffile"
79
+.Bl -tag -width "rollback"
80
.It Cm fetch
81
Based on the currently installed world and the configuration
82
options set, fetch all available binary updates.
83
Index: usr.sbin/freebsd-update/freebsd-update.sh
84
===================================================================
85
--- usr.sbin/freebsd-update/freebsd-update.sh (revision 282245)
86
+++ usr.sbin/freebsd-update/freebsd-update.sh (working copy)
87
@@ -43,12 +43,15 @@ Options:
88
(default: /var/db/freebsd-update/)
89
-f conffile -- Read configuration options from conffile
90
(default: /etc/freebsd-update.conf)
91
+ -F -- Force a fetch operation to proceed
92
-k KEY -- Trust an RSA key with SHA256 hash of KEY
93
-r release -- Target for upgrade (e.g., 6.2-RELEASE)
94
-s server -- Server from which to fetch updates
95
(default: update.FreeBSD.org)
96
-t address -- Mail output of cron command, if any, to address
97
(default: root)
98
+ --not-running-from-cron
99
+ -- Run without a tty, for use by automated tools
100
Commands:
101
fetch -- Fetch updates from server
102
cron -- Sleep rand(3600) seconds, fetch updates, and send an
103
@@ -399,6 +402,12 @@ init_params () {
104
105
# No commands specified yet
106
COMMANDS=""
107
+
108
+ # Force fetch to proceed
109
+ FORCEFETCH=0
110
+
111
+ # Run without a TTY
112
+ NOTTYOK=0
113
}
114
115
# Parse the command line
116
@@ -411,6 +420,12 @@ parse_cmdline () {
117
if [ ! -z "${CONFFILE}" ]; then usage; fi
118
shift; CONFFILE="$1"
119
;;
120
+ -F)
121
+ FORCEFETCH=1
122
+ ;;
123
+ --not-running-from-cron)
124
+ NOTTYOK=1
125
+ ;;
126
127
# Configuration file equivalents
128
-b)
129
@@ -665,6 +680,14 @@ fetch_check_params () {
130
echo "(Did you mean 'upgrade' instead?)"
131
exit 1
132
fi
133
+
134
+ # Check that we have updates ready to install
135
+ if [ -f ${BDHASH}-install/kerneldone -a $FORCEFETCH -eq 0 ]; then
136
+ echo "You have a partially completed upgrade pending"
137
+ echo "Run '$0 install' first."
138
+ echo "Run '$0 fetch -F' to proceed anyway."
139
+ exit 1
140
+ fi
141
}
142
143
# Perform sanity checks etc. before fetching upgrades.
144
@@ -3202,7 +3225,7 @@ get_params () {
145
# Fetch command. Make sure that we're being called
146
# interactively, then run fetch_check_params and fetch_run
147
cmd_fetch () {
148
- if [ ! -t 0 ]; then
149
+ if [ ! -t 0 -a $NOTTYOK -eq 0 ]; then
150
echo -n "`basename $0` fetch should not "
151
echo "be run non-interactively."
152
echo "Run `basename $0` cron instead."
153
154