1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * 7 * $FreeBSD$ 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer, 17 * verbatim and that no modifications are made prior to this 18 * point in the file. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 23 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 */ 36 37#include "sysinstall.h" 38#include <sys/disklabel.h> 39#include <sys/errno.h> 40#include <sys/ioctl.h> 41#include <sys/fcntl.h> 42#include <sys/wait.h> 43#include <sys/param.h> 44#include <sys/stat.h> 45#include <unistd.h> 46#include <sys/mount.h> 47 48static int installUpgradeNonInteractive(dialogMenuItem *self); 49 50typedef struct _hitList { 51 enum { JUST_COPY, CALL_HANDLER } action ; 52 char *name; 53 Boolean optional; 54 void (*handler)(struct _hitList *self); 55} HitList; 56 57/* These are the only meaningful files I know about */ 58static HitList etc_files [] = { 59 { JUST_COPY, "Xaccel.ini", TRUE, NULL }, 60 { JUST_COPY, "X11", TRUE, NULL }, 61 { JUST_COPY, "adduser.conf", TRUE, NULL }, 62 { JUST_COPY, "aliases", TRUE, NULL }, 63 { JUST_COPY, "aliases.db", TRUE, NULL }, 64 { JUST_COPY, "amd.map", TRUE, NULL }, 65 { JUST_COPY, "auth.conf", TRUE, NULL }, 66 { JUST_COPY, "crontab", TRUE, NULL }, 67 { JUST_COPY, "csh.cshrc", TRUE, NULL }, 68 { JUST_COPY, "csh.login", TRUE, NULL }, 69 { JUST_COPY, "csh.logout", TRUE, NULL }, 70 { JUST_COPY, "cvsupfile", TRUE, NULL }, 71 { JUST_COPY, "devfs.conf", TRUE, NULL }, 72 { JUST_COPY, "dhclient.conf", TRUE, NULL }, 73 { JUST_COPY, "disktab", TRUE, NULL }, 74 { JUST_COPY, "dumpdates", TRUE, NULL }, 75 { JUST_COPY, "exports", TRUE, NULL }, 76 { JUST_COPY, "fbtab", TRUE, NULL }, 77 { JUST_COPY, "fstab", FALSE, NULL }, 78 { JUST_COPY, "ftpusers", TRUE, NULL }, 79 { JUST_COPY, "gettytab", TRUE, NULL }, 80 { JUST_COPY, "gnats", TRUE, NULL }, 81 { JUST_COPY, "group", FALSE, NULL }, 82 { JUST_COPY, "hosts", TRUE, NULL }, 83 { JUST_COPY, "hosts.allow", TRUE, NULL }, 84 { JUST_COPY, "hosts.equiv", TRUE, NULL }, 85 { JUST_COPY, "hosts.lpd", TRUE, NULL }, 86 { JUST_COPY, "inetd.conf", TRUE, NULL }, 87 { JUST_COPY, "localtime", TRUE, NULL }, 88 { JUST_COPY, "login.access", TRUE, NULL }, 89 { JUST_COPY, "login.conf", TRUE, NULL }, 90 { JUST_COPY, "mail", TRUE, NULL }, 91 { JUST_COPY, "mail.rc", TRUE, NULL }, 92 { JUST_COPY, "mac.conf", TRUE, NULL }, 93 { JUST_COPY, "make.conf", TRUE, NULL }, 94 { JUST_COPY, "manpath.config", TRUE, NULL }, 95 { JUST_COPY, "master.passwd", FALSE, NULL }, 96 { JUST_COPY, "mergemaster.rc", TRUE, NULL }, 97 { JUST_COPY, "motd", TRUE, NULL }, 98 { JUST_COPY, "namedb", TRUE, NULL }, 99 { JUST_COPY, "networks", TRUE, NULL }, 100 { JUST_COPY, "newsyslog.conf", TRUE, NULL }, 101 { JUST_COPY, "nsmb.conf", TRUE, NULL }, 102 { JUST_COPY, "nsswitch.conf", TRUE, NULL }, 103 { JUST_COPY, "ntp.conf", TRUE, NULL }, 104 { JUST_COPY, "pam.conf", TRUE, NULL }, 105 { JUST_COPY, "passwd", TRUE, NULL }, 106 { JUST_COPY, "periodic", TRUE, NULL }, 107 { JUST_COPY, "pf.conf", TRUE, NULL }, 108 { JUST_COPY, "portsnap.conf", TRUE, NULL }, 109 { JUST_COPY, "ppp", TRUE, NULL }, 110 { JUST_COPY, "printcap", TRUE, NULL }, 111 { JUST_COPY, "profile", TRUE, NULL }, 112 { JUST_COPY, "protocols", TRUE, NULL }, 113 { JUST_COPY, "pwd.db", TRUE, NULL }, 114 { JUST_COPY, "rc.local", TRUE, NULL }, 115 { JUST_COPY, "rc.firewall", TRUE, NULL }, 116 { JUST_COPY, "rc.conf.local", TRUE, NULL }, 117 { JUST_COPY, "remote", TRUE, NULL }, 118 { JUST_COPY, "resolv.conf", TRUE, NULL }, 119 { JUST_COPY, "rmt", TRUE, NULL }, 120 { JUST_COPY, "sendmail.cf", TRUE, NULL }, 121 { JUST_COPY, "sendmail.cw", TRUE, NULL }, 122 { JUST_COPY, "services", TRUE, NULL }, 123 { JUST_COPY, "shells", TRUE, NULL }, 124 { JUST_COPY, "skeykeys", TRUE, NULL }, 125 { JUST_COPY, "snmpd.config", TRUE, NULL }, 126 { JUST_COPY, "spwd.db", TRUE, NULL }, 127 { JUST_COPY, "src.conf", TRUE, NULL }, 128 { JUST_COPY, "ssh", TRUE, NULL }, 129 { JUST_COPY, "sysctl.conf", TRUE, NULL }, 130 { JUST_COPY, "syslog.conf", TRUE, NULL }, 131 { JUST_COPY, "ttys", TRUE, NULL }, 132 { 0, NULL, FALSE, NULL }, 133}; 134 135static void 136traverseHitlist(HitList *h) 137{ 138 system("rm -rf /etc/upgrade"); 139 Mkdir("/etc/upgrade"); 140 while (h->name) { 141 if (!file_readable(h->name)) { 142 if (!h->optional) 143 msgConfirm("Unable to find an old /etc/%s file! That is decidedly non-standard and\n" 144 "your upgraded system may function a little strangely as a result.", h->name); 145 } 146 else { 147 if (h->action == JUST_COPY) { 148 /* Move the just-loaded copy aside */ 149 vsystem("mv /etc/%s /etc/upgrade/%s", h->name, h->name); 150 151 /* Copy the old one into its place */ 152 msgNotify("Resurrecting %s..", h->name); 153 /* Do this with tar so that symlinks and such are preserved */ 154 if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name)) 155 msgConfirm("Unable to resurrect your old /etc/%s! Hmmmm.", h->name); 156 } 157 else /* call handler */ 158 h->handler(h); 159 } 160 ++h; 161 } 162} 163 164int 165installUpgrade(dialogMenuItem *self) 166{ 167 char saved_etc[FILENAME_MAX]; 168 Boolean extractingBin = TRUE; 169 170 if (variable_get(VAR_NONINTERACTIVE)) 171 return installUpgradeNonInteractive(self); 172 173 variable_set2(SYSTEM_STATE, "upgrade", 0); 174 dialog_clear(); 175 176 if (msgYesNo("Before beginning a binary upgrade, please review the upgrade instructions,\n" 177 "which are located in the \"Install\" document under the main documentation\n" 178 "menu. Given that you have read these instructions and understand the risks\n" 179 "and precautions involved, are you sure that you want to proceed with\n" 180 "this upgrade?") != 0) 181 return DITEM_FAILURE; 182 183 if (!Dists) { 184 msgConfirm("First, you must select some distribution components. The upgrade procedure\n" 185 "will only upgrade the distributions you select in the next set of menus."); 186 if (!dmenuOpenSimple(&MenuDistributions, FALSE) || !Dists) 187 return DITEM_FAILURE; 188 } 189 else if (!(Dists & DIST_BASE)) { /* No base selected? Not much of an upgrade.. */ 190 if (msgYesNo("You didn't select the base distribution as one of the distributons to load.\n" 191 "This one is pretty vital to a successful upgrade. Are you SURE you don't\n" 192 "want to select the base distribution? Chose No to bring up the Distributions\n" 193 "menu again.") != 0) { 194 if (!dmenuOpenSimple(&MenuDistributions, FALSE)) 195 return DITEM_FAILURE; 196 } 197 } 198 199 /* Still?! OK! They must know what they're doing.. */ 200 if (!(Dists & DIST_BASE)) 201 extractingBin = FALSE; 202 203 if (RunningAsInit) { 204 Device **devs; 205 int i, cnt; 206 char *cp; 207 208 cp = variable_get(VAR_DISK); 209 devs = deviceFind(cp, DEVICE_TYPE_DISK); 210 cnt = deviceCount(devs); 211 if (!cnt) { 212 msgConfirm("No disks found! Please verify that your disk controller is being\n" 213 "properly probed at boot time. See the Hardware Guide on the\n" 214 "Documentation menu for clues on diagnosing this type of problem."); 215 return DITEM_FAILURE | DITEM_RESTORE; 216 } 217 else { 218 /* Enable all the drives before we start */ 219 for (i = 0; i < cnt; i++) 220 devs[i]->enabled = TRUE; 221 } 222 223 msgConfirm("OK. First, we're going to go to the disk label editor. In this editor\n" 224 "you will be expected to Mount any partitions you're interested in\n" 225 "upgrading. DO NOT set the Newfs flag to Y on anything in the label editor\n" 226 "unless you're absolutely sure you know what you're doing! In this\n" 227 "instance, you'll be using the label editor as little more than a fancy\n" 228 "screen-oriented partition mounting tool.\n\n" 229 "Once you're done in the label editor, press Q to return here for the next\n" 230 "step."); 231 232 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 233 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 234 "aborted."); 235 return DITEM_FAILURE | DITEM_RESTORE; 236 } 237 238 /* Don't write out MBR info */ 239 variable_set2(DISK_PARTITIONED, "written", 0); 240 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 241 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 242 "aborted."); 243 variable_unset(DISK_PARTITIONED); 244 return DITEM_FAILURE | DITEM_RESTORE; 245 } 246 247 msgNotify("Updating /stand on root filesystem"); 248 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 249 250 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 251 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 252 "root partition or the way it's mounted if this doesn't work."); 253 variable_unset(DISK_PARTITIONED); 254 return DITEM_FAILURE | DITEM_RESTORE; 255 } 256 chdir("/"); 257 installEnvironment(); 258 systemCreateHoloshell(); 259 } 260 261 saved_etc[0] = '\0'; 262 263 /* Don't allow sources to be upgraded if we have src already */ 264 if (directory_exists("/usr/src/") && (Dists & DIST_SRC)) { 265 Dists &= ~DIST_SRC; 266 SrcDists = 0; 267 msgConfirm("Warning: /usr/src exists and sources were selected as upgrade\n" 268 "targets. Unfortunately, this is not the way to upgrade your\n" 269 "sources - please use CTM or CVSup or some other method which\n" 270 "handles ``deletion events'', unlike this particular feature.\n\n" 271 "Your existing /usr/src will not be affected by this upgrade.\n"); 272 } 273 274 if (extractingBin) { 275 while (!*saved_etc) { 276 char *cp = msgGetInput("/var/tmp/etc", "Under which directory do you wish to save your current /etc?"); 277 278 if (!cp || !*cp || Mkdir(cp)) { 279 if (msgYesNo("Directory was not specified, was invalid or user selected Cancel.\n\n" 280 "Doing an upgrade without first backing up your /etc directory is a very\n" 281 "bad idea! Do you want to go back and specify the save directory again?") != 0) 282 break; 283 } 284 else { 285 SAFE_STRCPY(saved_etc, cp); 286 } 287 } 288 289 if (saved_etc[0]) { 290 msgNotify("Preserving /etc directory.."); 291 if (vsystem("tar -cBpf - -C /etc . | tar --unlink -xBpf - -C %s", saved_etc)) 292 if (msgYesNo("Unable to backup your /etc into %s.\n" 293 "Do you want to continue anyway?", saved_etc) != 0) 294 return DITEM_FAILURE; 295 msgNotify("Preserving /root directory.."); 296 vsystem("tar -cBpf - -C / root | tar --unlink -xBpf - -C %s", saved_etc); 297 } 298 299 msgNotify("chflags'ing old binaries - please wait."); 300 (void)vsystem("chflags -R noschg /bin /sbin /lib /libexec /usr/bin /usr/sbin /usr/lib /usr/libexec /var/empty /boot/kernel*"); 301 302 if (directory_exists("/boot/kernel")) { 303 if (directory_exists("/boot/kernel.prev")) { 304 msgNotify("Removing /boot/kernel.prev"); 305 if (system("rm -fr /boot/kernel.prev")) { 306 msgConfirm("NOTICE: I'm trying to back up /boot/kernel to\n" 307 "/boot/kernel.prev, but /boot/kernel.prev exists and I\n" 308 "can't remove it. This means that the backup will, in\n" 309 "all probability, fail."); 310 } 311 } 312 msgNotify("Moving old kernel to /boot/kernel.prev"); 313 if (system("mv /boot/kernel /boot/kernel.prev")) { 314 if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n" 315 "treat this as a big problem and abort the upgrade? Due to the\n" 316 "way that this upgrade process works, you will have to reboot\n" 317 "and start over from the beginning. Select Yes to reboot now")) 318 systemShutdown(1); 319 } 320 else 321 msgConfirm("NOTICE: Your old kernel is in /boot/kernel.prev should this\n" 322 "upgrade fail for any reason and you need to boot your old\n" 323 "kernel."); 324 } 325 } 326 327media: 328 /* We do this very late, but we unfortunately need to back up /etc first */ 329 if (!mediaVerify()) 330 return DITEM_FAILURE; 331 332 if (!DEVICE_INIT(mediaDevice)) { 333 if (!msgYesNo("Couldn't initialize the media. Would you like\n" 334 "to adjust your media selection and try again?")) { 335 mediaDevice = NULL; 336 goto media; 337 } 338 else 339 return DITEM_FAILURE | DITEM_REDRAW | DITEM_RESTORE; 340 } 341 342 msgNotify("Beginning extraction of distributions."); 343 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { 344 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" 345 "should be considered a failure and started from the beginning, sorry!\n" 346 "The system will reboot now."); 347 dialog_clear(); 348 systemShutdown(1); 349 } 350 else if (Dists) { 351 if (!extractingBin || !(Dists & DIST_BASE)) { 352 msgNotify("The extraction process seems to have had some problems, but we got most\n" 353 "of the essentials. We'll treat this as a warning since it may have been\n" 354 "only non-essential distributions which failed to load."); 355 } 356 else { 357 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" 358 "should be considered a failure and started from the beginning, sorry!\n" 359 "The system will reboot now."); 360 dialog_clear(); 361 systemShutdown(1); 362 } 363 } 364 365 if (extractingBin) 366 vsystem("disklabel -B `awk '$2~/\\/$/ {print substr($1, 6, 5)}' /etc/fstab`"); 367 msgNotify("First stage of upgrade completed successfully!\n\n" 368 "Next comes stage 2, where we attempt to resurrect your /etc\n" 369 "directory!"); 370 371 if (chdir(saved_etc)) { 372 msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n" 373 "Something went seriously wrong! It's quite possible that\n" 374 "your former /etc is toast. I hope you didn't have any\n" 375 "important customizations you wanted to keep in there.. :(", saved_etc); 376 } 377 else { 378 /* Now try to resurrect the /etc files */ 379 traverseHitlist(etc_files); 380 /* Resurrect the root dotfiles */ 381 vsystem("tar -cBpf - root | tar -xBpf - -C / && rm -rf root"); 382 } 383 384 msgConfirm("Upgrade completed! All of your old /etc files have been restored.\n" 385 "For your reference, the new /etc files are in /etc/upgrade/ in case\n" 386 "you wish to upgrade these files by hand (though that should not be\n" 387 "strictly necessary). If your root partition is specified in /etc/fstab\n" 388 "using the old \"compatibility\" slice, you may also wish to update it to\n" 389 "use a fully qualified slice name in order to avoid warnings on startup.\n\n" 390 "When you're ready to reboot into the new system, simply exit the installation."); 391 return DITEM_SUCCESS | DITEM_REDRAW | DITEM_RESTORE; 392} 393 394static int 395installUpgradeNonInteractive(dialogMenuItem *self) 396{ 397 char *saved_etc; 398 Boolean extractingBin = TRUE; 399 400 variable_set2(SYSTEM_STATE, "upgrade", 0); 401 402 /* Make sure at least BIN is selected */ 403 Dists |= DIST_BASE; 404 405 if (RunningAsInit) { 406 Device **devs; 407 int i, cnt; 408 char *cp; 409 410 cp = variable_get(VAR_DISK); 411 devs = deviceFind(cp, DEVICE_TYPE_DISK); 412 cnt = deviceCount(devs); 413 if (!cnt) { 414 msgConfirm("No disks found! Please verify that your disk controller is being\n" 415 "properly probed at boot time. See the Hardware Guide on the\n" 416 "Documentation menu for clues on diagnosing this type of problem."); 417 return DITEM_FAILURE; 418 } 419 else { 420 /* Enable all the drives before we start */ 421 for (i = 0; i < cnt; i++) 422 devs[i]->enabled = TRUE; 423 } 424 425 msgConfirm("OK. First, we're going to go to the disk label editor. In this editor\n" 426 "you will be expected to Mount any partitions you're interested in\n" 427 "upgrading. DO NOT set the Newfs flag to Y on anything in the label editor\n" 428 "unless you're absolutely sure you know what you're doing! In this\n" 429 "instance, you'll be using the label editor as little more than a fancy\n" 430 "screen-oriented partition mounting tool.\n\n" 431 "Once you're done in the label editor, press Q to return here for the next\n" 432 "step."); 433 434 if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { 435 msgConfirm("The disk label editor returned an error status. Upgrade operation\n" 436 "aborted."); 437 return DITEM_FAILURE; 438 } 439 440 /* Don't write out MBR info */ 441 variable_set2(DISK_PARTITIONED, "written", 0); 442 if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { 443 msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" 444 "aborted."); 445 variable_unset(DISK_PARTITIONED); 446 return DITEM_FAILURE; 447 } 448 449 if (extractingBin) { 450 msgNotify("chflags'ing old binaries - please wait."); 451 (void)vsystem("chflags -R noschg /mnt/"); 452 } 453 msgNotify("Updating /stand on root filesystem"); 454 (void)vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity()); 455 456 if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { 457 msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" 458 "root partition or the way it's mounted if this doesn't work."); 459 variable_unset(DISK_PARTITIONED); 460 return DITEM_FAILURE; 461 } 462 chdir("/"); 463 systemCreateHoloshell(); 464 } 465 466 if (!mediaVerify() || !DEVICE_INIT(mediaDevice)) { 467 msgNotify("Upgrade: Couldn't initialize media."); 468 return DITEM_FAILURE; 469 } 470 471 saved_etc = "/var/tmp/etc"; 472 Mkdir(saved_etc); 473 msgNotify("Preserving /etc directory.."); 474 if (vsystem("tar -cpBf - -C /etc . | tar -xpBf - -C %s", saved_etc)) { 475 msgNotify("Unable to backup your /etc into %s.", saved_etc); 476 return DITEM_FAILURE; 477 } 478 479 /* 480 * Back up the old kernel, leaving it in place in case we 481 * crash and reboot. 482 */ 483 if (directory_exists("/boot/kernel")) { 484 if (directory_exists("/boot/kernel.prev")) { 485 msgNotify("Removing /boot/kernel.prev"); 486 if (system("rm -fr /boot/kernel.prev")) { 487 msgConfirm("NOTICE: I'm trying to back up /boot/kernel to\n" 488 "/boot/kernel.prev, but /boot/kernel.prev exists and I\n" 489 "can't remove it. This means that the backup will, in\n" 490 "all probability, fail."); 491 } 492 } 493 msgNotify("Copying old kernel to /boot/kernel.prev"); 494 vsystem("cp -Rp /boot/kernel /boot/kernel.prev"); 495 } 496 497 msgNotify("Beginning extraction of distributions."); 498 if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { 499 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" 500 "should be considered a failure and started from the beginning, sorry!\n" 501 "The system will reboot now."); 502 dialog_clear(); 503 systemShutdown(1); 504 } 505 else if (Dists) { 506 if (!(Dists & DIST_BASE)) { 507 msgNotify("The extraction process seems to have had some problems, but we got most\n" 508 "of the essentials. We'll treat this as a warning since it may have been\n" 509 "only non-essential distributions which failed to upgrade."); 510 } 511 else { 512 msgConfirm("Hmmmm. We couldn't even extract the base distribution. This upgrade\n" 513 "should be considered a failure and started from the beginning, sorry!\n" 514 "The system will reboot now."); 515 dialog_clear(); 516 systemShutdown(1); 517 } 518 } 519 520 msgNotify("First stage of upgrade completed successfully."); 521 if (vsystem("tar -cpBf - -C %s . | tar --unlink -xpBf - -C /etc", saved_etc)) { 522 msgNotify("Unable to resurrect your old /etc!"); 523 return DITEM_FAILURE; 524 } 525 return DITEM_SUCCESS | DITEM_REDRAW; 526} 527