backupworld.update.20130406.patch

thomas.nikolajsen, 04/06/2013 03:32 PM

Download (12.3 KB)

View differences:

Makefile
29 29
#			of the system for DragonFly. ex. two compilers
30 30
# most                - Build user commands, no libraries or include files.
31 31
# installmost         - Install user commands, no libraries or include files.
32
# backupworld         - Copies /bin /sbin /usr/bin /usr/sbin /lib /libexec
33
#                       to manual backup dir.
34
# backupworld-auto-clean - Delete backup from auto-backup dir.
35
# backupworld-auto-clean-all - Delete all backups from auto-backup dir.
36
# backupworld-clean   - Delete backup from manual backup dir.
37
# restoreworld        - Installs binaries from manual backup dir to world.
38
# restoreworld-auto   - Installs binaries from auto-backup dir to world;
39
#                       installworld target makes backup to auto-backup dir.
32 40
#
33 41
# This makefile is simple by design. The DragonFly make automatically reads
34 42
# /usr/share/mk/sys.mk unless the -m argument is specified on the 
Makefile.inc1
10 10
# realquickworld - skip the glue and depend stages and just build the meat
11 11
# crossworld  - only build the glue (particularly the cross-build environment)
12 12
# installworld- install everything built by "buildworld"
13
# backupworld - copies /bin /sbin /usr/bin /usr/sbin /libexec to backup dir
14
# restoreworld- installs binaries from backup dir to world
15 13
# most        - build user commands, no libraries or include files
16 14
# installmost - install user commands, no libraries or include files
15
# backupworld - copies /bin /sbin /usr/bin /usr/sbin /lib /libexec to manual backup dir
16
# backupworld-auto-clean - delete backup from auto-backup dir
17
# backupworld-auto-clean-all - delete all backups from auto-backup dir
18
# backupworld-clean - delete backup from manual backup dir
19
# restoreworld- installs binaries from manual backup dir to world
20
# restoreworld-auto - installs binaries from auto-backup dir to world
17 21
#
18 22
# Standard targets (not defined here) are documented in the makefiles in
19 23
# /usr/share/mk.  These include:
......
125 129
WORLD_LDVER?=		ld.bfd
126 130
WORLD_BINUTILSVER?=	binutils222
127 131

  
128
# Set the backup parameters if they are not already defined
129
#
130
WORLD_BACKUP?=		/var/backups/world_backup
131
AUTO_BACKUP=		${OBJTREE}/world_backup
132

  
133 132
# temporary until everybody has converted to x86_64
134 133
.if ${MACHINE_ARCH} == "amd64"
135 134
MACHINE_ARCH=	x86_64
......
178 177
.endif
179 178
.endif
180 179

  
180
# Set the backup parameters if they are not already defined
181
#
182
WORLD_BACKUP?=		/var/backups/world_backup
183
HOSTNAME!=		hostname
184
AUTO_BACKUP_BASE=	${OBJTREE}/world_backup
185
AUTO_BACKUP=		${AUTO_BACKUP_BASE}/${HOSTNAME}/${TARGET_ARCH}/${DESTDIR}
186

  
181 187
THREAD_LIB?=	thread_xu
182 188
.if ${THREAD_LIB} == "c_r"
183 189
.if defined(NO_LIBC_R)
......
421 427
	@echo ">>> stage 4d: building everything.."
422 428
	@echo "--------------------------------------------------------------"
423 429
	cd ${.CURDIR}; ${WMAKE} all
424
	@rm -f ${AUTO_BACKUP}/installstamp
425 430

  
426 431
# note: buildworld no longer depends on _cleanobj because we rm -rf the
427 432
# entire object tree and built the bootstrap tools in a different location.
......
1053 1058
xmakeenv:
1054 1059
	@echo '${XMAKEENV} /bin/sh'
1055 1060

  
1056
backupworld:
1061
backupworld: backupworld-clean
1057 1062
	@mkdir -p ${WORLD_BACKUP}
1058
	@chflags -R noschg ${WORLD_BACKUP}
1059
	@rm -rf ${WORLD_BACKUP}/sbin ${WORLD_BACKUP}/bin \
1060
	        ${WORLD_BACKUP}/usr.sbin ${WORLD_BACKUP}/usr.bin \
1061
	        ${WORLD_BACKUP}/usr.libexec
1062
	cp -RpP /bin ${WORLD_BACKUP}/bin
1063
	cp -RpP /sbin ${WORLD_BACKUP}/sbin
1064
	cp -RpP /usr/bin ${WORLD_BACKUP}/usr.bin
1065
	cp -RpP /usr/lib ${WORLD_BACKUP}/usr.lib
1066
	cp -RpP /usr/sbin ${WORLD_BACKUP}/usr.sbin
1067
	cp -RpP /usr/libexec ${WORLD_BACKUP}/usr.libexec
1063
.if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1064
     exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1065
     exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1066
	tar -czf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1067
		--options gzip:compression-level=1 \
1068
		sbin bin usr/sbin usr/bin usr/lib usr/libexec
1069
.endif
1068 1070

  
1069 1071
backupworld-auto:
1070
.if !exists(${AUTO_BACKUP}/installstamp)
1072
.if defined(BACKUPWORLD_AUTO)
1073
	rm -f ${AUTO_BACKUP}/binaries.tar.gz
1071 1074
	@mkdir -p ${AUTO_BACKUP}
1072
	@chflags -R noschg ${AUTO_BACKUP}
1073
	@rm -rf ${AUTO_BACKUP}/sbin ${AUTO_BACKUP}/bin \
1074
	        ${AUTO_BACKUP}/usr.sbin ${AUTO_BACKUP}/usr.bin \
1075
	        ${AUTO_BACKUP}/usr.libexec
1076
	cp -RpP /bin ${AUTO_BACKUP}/bin
1077
	cp -RpP /sbin ${AUTO_BACKUP}/sbin
1078
	cp -RpP /usr/bin ${AUTO_BACKUP}/usr.bin
1079
	cp -RpP /usr/lib ${AUTO_BACKUP}/usr.lib
1080
	cp -RpP /usr/sbin ${AUTO_BACKUP}/usr.sbin
1081
	cp -RpP /usr/libexec ${AUTO_BACKUP}/usr.libexec
1082
	@date '+%Y-%m-%d %H:%M:%S' > ${AUTO_BACKUP}/installstamp
1075
.if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1076
     exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1077
     exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1078
	tar -czf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1079
		--options gzip:compression-level=1 \
1080
		sbin bin usr/sbin usr/bin usr/lib usr/libexec
1081
.endif
1083 1082
.endif
1084 1083

  
1084
backupworld-auto-clean:
1085
	rm -f ${AUTO_BACKUP}/binaries.tar.gz
1086

  
1087
backupworld-auto-clean-all:
1088
	rm -rf ${AUTO_BACKUP_BASE}
1089

  
1090
backupworld-clean:
1091
	rm -f ${WORLD_BACKUP}/binaries.tar.gz
1092

  
1085 1093
restoreworld:
1086
.if !(exists(${WORLD_BACKUP}/sbin) && exists(${WORLD_BACKUP}/bin) && \
1087
      exists(${WORLD_BACKUP}/usr.sbin) && exists(${WORLD_BACKUP}/usr.bin) && \
1088
      exists(${WORLD_BACKUP}/usr.lib) && exists(${WORLD_BACKUP}/usr.libexec))
1094
.if !exists(${WORLD_BACKUP}/binaries.tar.gz)
1089 1095
	@echo "There does not seem to be a valid archive present."
1090 1096
.else
1091 1097
	@echo "Restoring system binaries from manual backup archive..."
1092
	@rm -f /tmp/rs.tmp
1093
.for BX in sbin bin usr.sbin usr.bin usr.lib usr.libexec
1094
	@chflags -R noschg /${BX:S/./\//}
1095
	@cd ${WORLD_BACKUP}/${BX} && find * -type f -perm +700 -exec \
1096
	  echo cp ${WORLD_BACKUP}/${BX}/{} /${BX:S/./\//}/{} >> /tmp/rs.tmp \;
1097
.endfor
1098
	@grep -Ev ' (/bin/sh|/bin/cp|/sbin/init.bak|/usr/bin/make|/usr/libexec/ld-elf.so.2|/usr/libexec/ld-elf.so.2.old)$$' \
1099
	   /tmp/rs.tmp > /tmp/restore.script
1100
	@/bin/sh /tmp/restore.script
1101
	@rm /tmp/rs.tmp /tmp/restore.script
1102
	@echo "These files were not restored from ${WORLD_BACKUP}:"
1103
	@echo "   /bin/cp"
1104
	@echo "   /bin/sh"
1105
	@echo "   /usr/bin/make"
1106
	@echo "   /usr/libexec/ld-elf.so.2"
1098
	@chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1099
		${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1100
		${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1101
	tar -xzf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1107 1102
.endif
1108 1103

  
1109 1104
restoreworld-auto:
1110
.if !(exists(${AUTO_BACKUP}/sbin) && exists(${AUTO_BACKUP}/bin) && \
1111
      exists(${AUTO_BACKUP}/usr.sbin) && exists(${AUTO_BACKUP}/usr.bin) && \
1112
      exists(${AUTO_BACKUP}/usr.lib) && exists(${AUTO_BACKUP}/usr.libexec))
1105
.if !exists(${AUTO_BACKUP}/binaries.tar.gz)
1113 1106
	@echo "There does not seem to be a valid archive present."
1114 1107
.else
1115 1108
	@echo "Restoring system binaries from auto-backup archive..."
1116
	@rm -f /tmp/rs.tmp
1117
.for BX in sbin bin usr.sbin usr.bin usr.lib usr.libexec
1118
	@chflags -R noschg /${BX:S/./\//}
1119
	@cd ${AUTO_BACKUP}/${BX} && find * -type f -perm +700 -exec \
1120
	  echo cp ${AUTO_BACKUP}/${BX}/{} /${BX:S/./\//}/{} >> /tmp/rs.tmp \;
1121
.endfor
1122
	@grep -Ev ' (/bin/sh|/bin/cp|/sbin/init.bak|/usr/bin/make|/usr/libexec/ld-elf.so.2|/usr/libexec/ld-elf.so.2.old)$$' \
1123
	   /tmp/rs.tmp > /tmp/restore.script
1124
	@/bin/sh /tmp/restore.script
1125
	@rm /tmp/rs.tmp /tmp/restore.script
1126
	@echo "These files were not restored from ${AUTO_BACKUP}:"
1127
	@echo "   /bin/cp"
1128
	@echo "   /bin/sh"
1129
	@echo "   /usr/bin/make"
1130
	@echo "   /usr/libexec/ld-elf.so.2"
1109
	@chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1110
		${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1111
		${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1112
	tar -xzf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1131 1113
.endif
1132 1114

  
1133 1115
# Take advantage of bmake error response
etc/defaults/make.conf
81 81
# Compare before install
82 82
#INSTALL=install -C
83 83
#
84
# To backup old world binaries as part of installworld
85
#BACKUPWORLD_AUTO= true
86
#
84 87
# To build ppp with normal permissions
85 88
#PPP_NOSUID=	true
86 89
#
share/man/man5/make.conf.5
24 24
.\"
25 25
.\" $FreeBSD: src/share/man/man5/make.conf.5,v 1.12.2.30 2003/05/18 17:05:55 brueffer Exp $
26 26
.\"
27
.Dd February 17, 2013
27
.Dd April 6, 2013
28 28
.Dt MAKE.CONF 5
29 29
.Os
30 30
.Sh NAME
......
212 212
.Bd -literal -offset indent
213 213
INSTALL="install -C"
214 214
.Ed
215
.It Va BACKUPWORLD_AUTO
216
.Pq Vt str
217
Enable backup of old world binaries as part of
218
.Dq installworld
219
.Xr make 1
220
target.
221
Default is unset.
215 222
.It Va WORLD_BACKUP
216 223
.Pq Vt str
217 224
defines where system binaries will be backed up for the
218
.Dq make backupworld
219
target.  The default value is
220
.Dq /var/backups/world_backup .
225
.Dq backupworld
226
.Xr make 1
227
target.
228
The default value is
229
.Dq Pa /var/backups/world_backup .
221 230
.It Va LOCAL_DIRS
222 231
.Pq Vt str
223
List any directories that should be entered when running make
224
.Pa /usr/src
225
in this variable.
232
List of directories that should be entered when running
233
.Xr make 1
234
in
235
.Pa /usr/src .
226 236
.It Va MAKE_SHELL
227 237
.Pq Vt str
228 238
Controls the shell used internally by
share/man/man7/build.7
23 23
.\" SUCH DAMAGE.
24 24
.\"
25 25
.\" $FreeBSD: src/share/man/man7/build.7,v 1.19.2.1 2002/03/18 08:33:02 murray Exp $
26
.\" $DragonFly: src/share/man/man7/build.7,v 1.18 2008/11/14 15:04:42 swildner Exp $
27 26
.\"
28
.Dd April 12, 2009
27
.Dd April 6, 2013
29 28
.Dt BUILD 7
30 29
.Os
31 30
.Sh NAME
......
132 131
Build user commands, no libraries or include files.
133 132
.It Cm installmost
134 133
Install user commands, no libraries or include files.
134
.It Cm backupworld
135
Backup binaries from installed world to location specified in
136
.Ev WORLD_BACKUP .
137
.It Cm backupworld-auto
138
Backup binaries from installed world to auto-backup directory.
139
This is only done if
140
.Ev BACKUPWORLD_AUTO
141
is defined.
142
Auto-backup directory is:
143
.Ev MAKEOBJDIRPREFIX Ns Pa /world_binaries/ Ns Ao Ar hostname Ac Ns / Ns Ev TARGET_ARCH Ns / Ns Ev DESTDIR .
144
This is executed as initial part of
145
.Cm installworld .
146
.It Cm backupworld-auto-clean
147
Delete backup from auto-backup directory.
148
See
149
.Cm backupworld-auto .
150
.It Cm backupworld-auto-clean-all
151
Delete all backups from auto-backup base directory:
152
.Ev MAKEOBJDIRPREFIX Ns Pa /world_binaries .
153
.It Cm restoreworld
154
Restore binaries to installed world from location specified in
155
.Ev WORLD_BACKUP .
156
.It Cm restoreworld-auto
157
Restore binaries to installed world from auto-backup directory.
158
See
159
.Cm backupworld-auto .
135 160
.El
136 161
.Sh ENVIRONMENT
137 162
.Bl -tag -width ".Ev MAKEOBJDIRPREFIX"
......
208 233
.Ev DESTKERNDIR .
209 234
This overrides the effect of
210 235
.Ev DESTLABEL .
236
.It Ev WORLD_BACKUP
237
Directory for manual backup of binaries of installed world (the default is
238
.Pa /var/backups/world_backup ) .
211 239
.El
212 240
.Sh FILES
213 241
.Bl -tag -width ".Pa /usr/src/Makefile_upgrade.inc" -compact