home *** CD-ROM | disk | FTP | other *** search
- Subject: v24i069: Purdue software product installation system, Part07/07
- Newsgroups: comp.sources.unix
- Approved: rsalz@uunet.UU.NET
- X-Checksum-Snefru: c2bfe58b ad7997c1 be537abf 72ed87e3
-
- Submitted-by: Kevin Braunsdorf <ksb@cc.purdue.edu>
- Posting-number: Volume 24, Issue 69
- Archive-name: pucc-install/part07
-
- #!/bin/sh
- # This is part 07 of pucc-1b
- # ============= instck/path.h ==============
- if test ! -d 'instck'; then
- echo 'x - creating directory instck'
- mkdir 'instck'
- fi
- if test -f 'instck/path.h' -a X"$1" != X"-c"; then
- echo 'x - skipping instck/path.h (File already exists)'
- else
- echo 'x - extracting instck/path.h (Text)'
- sed 's/^X//' << 'Purdue' > 'instck/path.h' &&
- /*
- X * $Id: path.h,v 7.1 90/09/17 10:25:43 ksb Exp $
- X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
- X * 47907. All rights reserved.
- X *
- X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
- X *
- X * This software is not subject to any license of the American Telephone
- X * and Telegraph Company or the Regents of the University of California.
- X *
- X * Permission is granted to anyone to use this software for any purpose on
- X * any computer system, and to alter it and redistribute it freely, subject
- X * to the following restrictions:
- X *
- X * 1. Neither the authors nor Purdue University are responsible for any
- X * consequences of the use of this software.
- X *
- X * 2. The origin of this software must not be misrepresented, either by
- X * explicit claim or by omission. Credit to the authors and Purdue
- X * University must appear in documentation and sources.
- X *
- X * 3. Altered versions must be plainly marked as such, and must not be
- X * misrepresented as being the original software.
- X *
- X * 4. This notice may not be removed or altered.
- X */
- X
- /*
- X * we assume that the user has somehow defined a typedef for PATH_DATA...
- X */
- typedef struct CMnode {
- X struct CMnode *pCMsibling;
- X struct CMnode *pCMchild;
- X char *pccomp;
- X PATH_DATA user_data;
- X short fprint;
- } COMPONENT;
- #define nilCM ((COMPONENT *) 0)
- #define newCM() ((COMPONENT *) malloc(sizeof(COMPONENT)))
- X
- extern int chSep;
- X
- #if HAVE_PROTO
- extern int ApplyPath(COMPONENT *, int (*)());
- extern PATH_DATA *AddPath(COMPONENT **, char *);
- #else
- extern int ApplyPath();
- extern PATH_DATA *AddPath();
- #endif
- Purdue
- chmod 0444 instck/path.h ||
- echo 'restore of instck/path.h failed'
- Wc_c="`wc -c < 'instck/path.h'`"
- test 1580 -eq "$Wc_c" ||
- echo 'instck/path.h: original size 1580, current size' "$Wc_c"
- fi
- # ============= instck/gen.h ==============
- if test -f 'instck/gen.h' -a X"$1" != X"-c"; then
- echo 'x - skipping instck/gen.h (File already exists)'
- else
- echo 'x - extracting instck/gen.h (Text)'
- sed 's/^X//' << 'Purdue' > 'instck/gen.h' &&
- /*
- X * $Id: gen.h,v 7.3 90/11/28 13:08:24 ksb Exp $
- X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
- X * 47907. All rights reserved.
- X *
- X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
- X *
- X * This software is not subject to any license of the American Telephone
- X * and Telegraph Company or the Regents of the University of California.
- X *
- X * Permission is granted to anyone to use this software for any purpose on
- X * any computer system, and to alter it and redistribute it freely, subject
- X * to the following restrictions:
- X *
- X * 1. Neither the authors nor Purdue University are responsible for any
- X * consequences of the use of this software.
- X *
- X * 2. The origin of this software must not be misrepresented, either by
- X * explicit claim or by omission. Credit to the authors and Purdue
- X * University must appear in documentation and sources.
- X *
- X * 3. Altered versions must be plainly marked as such, and must not be
- X * misrepresented as being the original software.
- X *
- X * 4. This notice may not be removed or altered.
- X */
- X
- /*
- X * configure parts we need (maxfreq) and export our abstraction (ksb)
- X */
- #define MAXGROUPNAME 32 /* size for a group name */
- X
- typedef struct MEnode {
- X int iuid;
- X int igid;
- X int imode;
- X char chstrip, chtype;
- } ME_ELEMENT;
- X
- X
- #if HAVE_PROTO
- extern int GenCk(int, char **);
- extern int MECompare(ME_ELEMENT *, ME_ELEMENT *);
- extern int MECopy(ME_ELEMENT *, ME_ELEMENT *);
- #else
- extern int GenCk();
- extern int MECompare();
- extern int MECopy();
- #endif
- Purdue
- chmod 0444 instck/gen.h ||
- echo 'restore of instck/gen.h failed'
- Wc_c="`wc -c < 'instck/gen.h'`"
- test 1520 -eq "$Wc_c" ||
- echo 'instck/gen.h: original size 1520, current size' "$Wc_c"
- fi
- # ============= instck/README ==============
- if test -f 'instck/README' -a X"$1" != X"-c"; then
- echo 'x - skipping instck/README (File already exists)'
- else
- echo 'x - extracting instck/README (Text)'
- sed 's/^X//' << 'Purdue' > 'instck/README' &&
- # $Id: README,v 7.2 90/11/28 09:30:56 ksb Exp $
- X
- Instck is a member of the install family of sys admin tools.
- X
- Instck has 3 main functions:
- X
- X 1/ cleaning up after aborted or broken installs (wrong link count)
- X
- X 2/ generating checklist files for install
- X
- X 3/ processing a checklist to find errors in the current system
- X
- X
- When install or purge notifies the admin that a link count is wrong she
- may run instck (as directed by install). For example if install tells
- you that the link count is wrong for /usr/bin/OLD/cu, one might run:
- X instck -iS /usr/bin/OLD
- X
- which would prompt with something like:
- X instck: linking ../tip to ../cu (cwd=/usr/bin/OLD)
- X instck: rm -f ../tip {was link into OLD} [nfhqy] y
- X instck: ln ../cu ../tip [nfhqy] y
- X
- These commands repair the problem. Instck can not always find the link,
- but it will suggest stronger commands (like find(1)) when it fails.
- X
- X
- Instck will generate a checklist file for install: try
- X instck -SG /bin/ /lib/
- X
- retry with combinations of -v and -l and -L if you like.
- X
- X
- Instck checks the currently installed products against install's check
- list (/usr/local/etc/install.cf) and reports bad modes/owners/groups.
- Instck can be run from crontab as often as purge(1l) is, possibly not
- at the same time. (Instck should take very little time to run.)
- X
- kayessbee
- Purdue
- chmod 0444 instck/README ||
- echo 'restore of instck/README failed'
- Wc_c="`wc -c < 'instck/README'`"
- test 1307 -eq "$Wc_c" ||
- echo 'instck/README: original size 1307, current size' "$Wc_c"
- fi
- # ============= purge/purge.m ==============
- if test ! -d 'purge'; then
- echo 'x - creating directory purge'
- mkdir 'purge'
- fi
- if test -f 'purge/purge.m' -a X"$1" != X"-c"; then
- echo 'x - skipping purge/purge.m (File already exists)'
- else
- echo 'x - extracting purge/purge.m (Text)'
- sed 's/^X//' << 'Purdue' > 'purge/purge.m' &&
- # command line options for purge(8L)
- # $Compile: ${mkcmd-mkcmd} -n main std_help.m %f
- # $Id: purge.m,v 3.1 90/11/26 12:26:54 ksb Exp $
- X
- X
- after {
- X named "Version"
- X update "InitAll();if (%rVn) {exit(%n());}"
- }
- X
- from '"configure.h"'
- from '"install.h"'
- X
- every {
- X from '"purge.h"'
- X named "Which"
- X parameter "dirs"
- X help "dirs to purge"
- }
- X
- # this puts the []'s on dirs for us,
- # of course we could 'Scan("/");' here if we were not so conservative
- zero {
- X update "exit(0);"
- }
- X
- exit {
- X named 'Done'
- X update '%n();'
- }
- X
- # we don't do this because it is never what we want,
- # we really want the last stable version --
- # we don't know how to find that.
- #boolean '1' {
- # named 'f1Copy'
- # init '0'
- # help "always keep one copy as a backup"
- #}
- X
- boolean 'A' {
- X named "fAnyOwner"
- X help "purge for all users"
- }
- X
- function 'u' {
- X parameter "user"
- X named "AddHer"
- X update "(void)%n(%a);"
- X help "OLD directories may be owned by this user"
- }
- X
- boolean 'v' {
- X named "fVerbose"
- X help "be verbose"
- }
- X
- boolean 'n' {
- X named "fExec"
- X init '1'
- X update "%n = !%i;%rvn = !%rvi;"
- X help "do not really execute commands"
- }
- X
- integer 'd' {
- X verify named "iDays"
- X parameter "days"
- X init '14'
- X help "days to keep backup files (default %i)"
- }
- X
- boolean 'V' {
- X named "fVersion"
- X init "0"
- X help "show version information"
- }
- X
- boolean 'S' {
- X named "fSuperUser"
- X init "0"
- X help "run as if we were the superuser"
- }
- Purdue
- chmod 0444 purge/purge.m ||
- echo 'restore of purge/purge.m failed'
- Wc_c="`wc -c < 'purge/purge.m'`"
- test 1367 -eq "$Wc_c" ||
- echo 'purge/purge.m: original size 1367, current size' "$Wc_c"
- fi
- # ============= purge/purge.h ==============
- if test -f 'purge/purge.h' -a X"$1" != X"-c"; then
- echo 'x - skipping purge/purge.h (File already exists)'
- else
- echo 'x - extracting purge/purge.h (Text)'
- sed 's/^X//' << 'Purdue' > 'purge/purge.h' &&
- /*
- X * $Id: purge.h,v 3.2 90/10/02 21:19:47 ksb Exp $
- X *
- X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
- X * 47907. All rights reserved.
- X *
- X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
- X *
- X * This software is not subject to any license of the American Telephone
- X * and Telegraph Company or the Regents of the University of California.
- X *
- X * Permission is granted to anyone to use this software for any purpose on
- X * any computer system, and to alter it and redistribute it freely, subject
- X * to the following restrictions:
- X *
- X * 1. Neither the authors nor Purdue University are responsible for any
- X * consequences of the use of this software.
- X *
- X * 2. The origin of this software must not be misrepresented, either by
- X * explicit claim or by omission. Credit to the authors and Purdue
- X * University must appear in documentation and sources.
- X *
- X * 3. Altered versions must be plainly marked as such, and must not be
- X * misrepresented as being the original software.
- X *
- X * 4. This notice may not be removed or altered.
- X */
- X
- extern void InitAll();
- extern int AddHer();
- extern void Which(), Done();
- Purdue
- chmod 0444 purge/purge.h ||
- echo 'restore of purge/purge.h failed'
- Wc_c="`wc -c < 'purge/purge.h'`"
- test 1148 -eq "$Wc_c" ||
- echo 'purge/purge.h: original size 1148, current size' "$Wc_c"
- fi
- # ============= install.d/dir.h ==============
- if test ! -d 'install.d'; then
- echo 'x - creating directory install.d'
- mkdir 'install.d'
- fi
- if test -f 'install.d/dir.h' -a X"$1" != X"-c"; then
- echo 'x - skipping install.d/dir.h (File already exists)'
- else
- echo 'x - extracting install.d/dir.h (Text)'
- sed 's/^X//' << 'Purdue' > 'install.d/dir.h' &&
- /*
- X * $Id: dir.h,v 7.0 90/09/17 09:41:42 ksb Exp $
- X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
- X * 47907. All rights reserved.
- X *
- X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
- X *
- X * This software is not subject to any license of the American Telephone
- X * and Telegraph Company or the Regents of the University of California.
- X *
- X * Permission is granted to anyone to use this software for any purpose on
- X * any computer system, and to alter it and redistribute it freely, subject
- X * to the following restrictions:
- X *
- X * 1. Neither the authors nor Purdue University are responsible for any
- X * consequences of the use of this software.
- X *
- X * 2. The origin of this software must not be misrepresented, either by
- X * explicit claim or by omission. Credit to the authors and Purdue
- X * University must appear in documentation and sources.
- X *
- X * 3. Altered versions must be plainly marked as such, and must not be
- X * misrepresented as being the original software.
- X *
- X * 4. This notice may not be removed or altered.
- X */
- X
- #if HAVE_PROTO
- extern int DirInstall(char *, char *, char *, char *, char *, char *, char *, char *, int);
- #else
- extern int DirInstall();
- #endif
- X
- extern char acLs[];
- extern char acLsDirArgs[];
- Purdue
- chmod 0444 install.d/dir.h ||
- echo 'restore of install.d/dir.h failed'
- Wc_c="`wc -c < 'install.d/dir.h'`"
- test 1262 -eq "$Wc_c" ||
- echo 'install.d/dir.h: original size 1262, current size' "$Wc_c"
- fi
- # ============= install.d/file.h ==============
- if test -f 'install.d/file.h' -a X"$1" != X"-c"; then
- echo 'x - skipping install.d/file.h (File already exists)'
- else
- echo 'x - extracting install.d/file.h (Text)'
- sed 's/^X//' << 'Purdue' > 'install.d/file.h' &&
- /*
- X * $Id: file.h,v 7.0 90/09/17 09:41:48 ksb Exp $
- X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
- X * 47907. All rights reserved.
- X *
- X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
- X *
- X * This software is not subject to any license of the American Telephone
- X * and Telegraph Company or the Regents of the University of California.
- X *
- X * Permission is granted to anyone to use this software for any purpose on
- X * any computer system, and to alter it and redistribute it freely, subject
- X * to the following restrictions:
- X *
- X * 1. Neither the authors nor Purdue University are responsible for any
- X * consequences of the use of this software.
- X *
- X * 2. The origin of this software must not be misrepresented, either by
- X * explicit claim or by omission. Credit to the authors and Purdue
- X * University must appear in documentation and sources.
- X *
- X * 3. Altered versions must be plainly marked as such, and must not be
- X * misrepresented as being the original software.
- X *
- X * 4. This notice may not be removed or altered.
- X */
- X
- #if HAVE_PROTO
- extern void MkOld(char *);
- extern int DoBackup(int, char *, char *, char *);
- extern void MakeNames(char *, char *, char *, char *);
- extern int DoLinks(struct stat *, char *, char *, int, struct passwd *, struct group *);
- extern int LaunchLinks(struct stat *, char *, char *, char *, int, struct passwd *, struct group *);
- extern int Install(char *, char *, char *, char *);
- #else
- extern void MkOld();
- extern int DoBackup();
- extern void MakeNames();
- extern int DoLinks();
- extern int LaunchLinks();
- extern int Install();
- #endif
- Purdue
- chmod 0444 install.d/file.h ||
- echo 'restore of install.d/file.h failed'
- Wc_c="`wc -c < 'install.d/file.h'`"
- test 1611 -eq "$Wc_c" ||
- echo 'install.d/file.h: original size 1611, current size' "$Wc_c"
- fi
- # ============= instck/maxfreq.h ==============
- if test -f 'instck/maxfreq.h' -a X"$1" != X"-c"; then
- echo 'x - skipping instck/maxfreq.h (File already exists)'
- else
- echo 'x - extracting instck/maxfreq.h (Text)'
- sed 's/^X//' << 'Purdue' > 'instck/maxfreq.h' &&
- /*
- X * manage a data structure that keeps the modes of a list of values
- X * $Id: maxfreq.h,v 7.2 90/11/28 09:09:59 ksb Exp $
- X *
- X * Assumptions:
- X * there aren't many different values (usually less than 16)
- X * long chains of the same number are common
- X */
- X
- /*
- X * test configuration
- X */
- #ifdef TEST
- #define MAXBUF 100
- X
- typedef union MEnode {
- X char ac[MAXBUF];
- } ME_ELEMENT;
- X
- extern int MECopy();
- extern int MECompare();
- extern char *progname;
- extern int main();
- #endif /* TEST */
- X
- /*
- X * this is the data structure used for keeping the max frequency
- X *
- X * The algorithm to maintain it is O(n^2) / K; we try to keep K large
- X * by predicting that the input contains long repeating sequences of
- X * the same key.
- X */
- typedef struct MFnode {
- X struct MFnode *pMFlower;/* list of nodes with lower freq's */
- X struct MFnode *pMFequal;/* list of nodes with equal freq's */
- X ME_ELEMENT ME;
- X int icount;
- } MAXFREQ;
- #define nilMF ((MAXFREQ *)0)
- X
- extern ME_ELEMENT *MFIncrement();
- extern void MFFree();
- extern int MFCheckMax(), MFScan();
- Purdue
- chmod 0444 instck/maxfreq.h ||
- echo 'restore of instck/maxfreq.h failed'
- Wc_c="`wc -c < 'instck/maxfreq.h'`"
- test 1018 -eq "$Wc_c" ||
- echo 'instck/maxfreq.h: original size 1018, current size' "$Wc_c"
- fi
- # ============= purge/filedup.h ==============
- if test -f 'purge/filedup.h' -a X"$1" != X"-c"; then
- echo 'x - skipping purge/filedup.h (File already exists)'
- else
- echo 'x - extracting purge/filedup.h (Text)'
- sed 's/^X//' << 'Purdue' > 'purge/filedup.h' &&
- /*
- X * $Id: filedup.h,v 3.0 90/09/17 11:38:21 ksb Exp $
- X * routines to keep track of dup files (hard links) (ksb)
- X */
- typedef struct AE {
- X dev_t mydev;
- X ino_t myino;
- X char *pcname;
- } AE_ELEMENT;
- #define nilAE ((AE_ELEMENT *)0)
- X
- /*
- X * Indices for AVsbpAVchild tag
- X */
- #define AV_LCHILD 0
- #define AV_RCHILD 1
- X
- /*
- X * Balance factors (can be used to select child to traverse too)
- X */
- #define AV_BAL_LEFT AV_LCHILD
- #define AV_BAL_CENTER -1
- #define AV_BAL_RIGHT AV_RCHILD
- X
- typedef unsigned AVCARDINAL; /* short/normal/long unsigned */
- X
- typedef struct AVnode {
- X struct AVnode *AVsbpAVchild[2]; /* AVL children */
- X short int AVbtipped; /* AVL balance factor */
- X AE_ELEMENT AE_data;
- } AVL;
- #define nilAV ((AVL *)0)
- extern void AVInit();
- X
- typedef AVL *FILEDUPS;
- extern char *FDAdd();
- #define FDScan AVScan
- #define FDInit AVInit
- Purdue
- chmod 0444 purge/filedup.h ||
- echo 'restore of purge/filedup.h failed'
- Wc_c="`wc -c < 'purge/filedup.h'`"
- test 825 -eq "$Wc_c" ||
- echo 'purge/filedup.h: original size 825, current size' "$Wc_c"
- fi
- exit 0
-
- exit 0 # Just in case...
-