1*5c51f124SMoriah Waterland /* 2*5c51f124SMoriah Waterland * CDDL HEADER START 3*5c51f124SMoriah Waterland * 4*5c51f124SMoriah Waterland * The contents of this file are subject to the terms of the 5*5c51f124SMoriah Waterland * Common Development and Distribution License (the "License"). 6*5c51f124SMoriah Waterland * You may not use this file except in compliance with the License. 7*5c51f124SMoriah Waterland * 8*5c51f124SMoriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5c51f124SMoriah Waterland * or http://www.opensolaris.org/os/licensing. 10*5c51f124SMoriah Waterland * See the License for the specific language governing permissions 11*5c51f124SMoriah Waterland * and limitations under the License. 12*5c51f124SMoriah Waterland * 13*5c51f124SMoriah Waterland * When distributing Covered Code, include this CDDL HEADER in each 14*5c51f124SMoriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5c51f124SMoriah Waterland * If applicable, add the following below this CDDL HEADER, with the 16*5c51f124SMoriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying 17*5c51f124SMoriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner] 18*5c51f124SMoriah Waterland * 19*5c51f124SMoriah Waterland * CDDL HEADER END 20*5c51f124SMoriah Waterland */ 21*5c51f124SMoriah Waterland 22*5c51f124SMoriah Waterland /* 23*5c51f124SMoriah Waterland * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 24*5c51f124SMoriah Waterland * Use is subject to license terms. 25*5c51f124SMoriah Waterland */ 26*5c51f124SMoriah Waterland 27*5c51f124SMoriah Waterland /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28*5c51f124SMoriah Waterland /* All Rights Reserved */ 29*5c51f124SMoriah Waterland 30*5c51f124SMoriah Waterland 31*5c51f124SMoriah Waterland #include <stdio.h> 32*5c51f124SMoriah Waterland #include <signal.h> 33*5c51f124SMoriah Waterland #include <stdlib.h> 34*5c51f124SMoriah Waterland #include <unistd.h> 35*5c51f124SMoriah Waterland #include <pkgdev.h> 36*5c51f124SMoriah Waterland #include <locale.h> 37*5c51f124SMoriah Waterland #include <libintl.h> 38*5c51f124SMoriah Waterland #include <pkglib.h> 39*5c51f124SMoriah Waterland #include "libadm.h" 40*5c51f124SMoriah Waterland 41*5c51f124SMoriah Waterland extern struct pkgdev pkgdev; 42*5c51f124SMoriah Waterland extern char pkgloc[], *t_pkgmap, *t_pkginfo; 43*5c51f124SMoriah Waterland 44*5c51f124SMoriah Waterland extern int started; 45*5c51f124SMoriah Waterland 46*5c51f124SMoriah Waterland #define MSG_COMPLETE "## Packaging complete.\n" 47*5c51f124SMoriah Waterland #define MSG_TERM "## Packaging terminated at user request.\n" 48*5c51f124SMoriah Waterland #define MSG_ERROR "## Packaging was not successful.\n" 49*5c51f124SMoriah Waterland 50*5c51f124SMoriah Waterland void 51*5c51f124SMoriah Waterland quit(int retcode) 52*5c51f124SMoriah Waterland { 53*5c51f124SMoriah Waterland (void) signal(SIGINT, SIG_IGN); 54*5c51f124SMoriah Waterland (void) signal(SIGHUP, SIG_IGN); 55*5c51f124SMoriah Waterland 56*5c51f124SMoriah Waterland if (retcode == 3) 57*5c51f124SMoriah Waterland (void) fprintf(stderr, gettext(MSG_TERM)); 58*5c51f124SMoriah Waterland else if (retcode) 59*5c51f124SMoriah Waterland (void) fprintf(stderr, gettext(MSG_ERROR)); 60*5c51f124SMoriah Waterland else 61*5c51f124SMoriah Waterland (void) fprintf(stderr, gettext(MSG_COMPLETE)); 62*5c51f124SMoriah Waterland 63*5c51f124SMoriah Waterland if (retcode && started) 64*5c51f124SMoriah Waterland (void) rrmdir(pkgloc); /* clean up output directory */ 65*5c51f124SMoriah Waterland 66*5c51f124SMoriah Waterland if (pkgdev.mount) 67*5c51f124SMoriah Waterland (void) pkgumount(&pkgdev); 68*5c51f124SMoriah Waterland 69*5c51f124SMoriah Waterland if (t_pkgmap) 70*5c51f124SMoriah Waterland (void) unlink(t_pkgmap); 71*5c51f124SMoriah Waterland if (t_pkginfo) 72*5c51f124SMoriah Waterland (void) unlink(t_pkginfo); 73*5c51f124SMoriah Waterland exit(retcode); 74*5c51f124SMoriah Waterland } 75