home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume24 / pucc-install / part07 < prev    next >
Text File  |  1991-03-19  |  17KB  |  552 lines

  1. Subject:  v24i069:  Purdue software product installation system, Part07/07
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: c2bfe58b ad7997c1 be537abf 72ed87e3
  5.  
  6. Submitted-by: Kevin Braunsdorf <ksb@cc.purdue.edu>
  7. Posting-number: Volume 24, Issue 69
  8. Archive-name: pucc-install/part07
  9.  
  10. #!/bin/sh
  11. # This is part 07 of pucc-1b
  12. # ============= instck/path.h ==============
  13. if test ! -d 'instck'; then
  14.     echo 'x - creating directory instck'
  15.     mkdir 'instck'
  16. fi
  17. if test -f 'instck/path.h' -a X"$1" != X"-c"; then
  18.     echo 'x - skipping instck/path.h (File already exists)'
  19. else
  20. echo 'x - extracting instck/path.h (Text)'
  21. sed 's/^X//' << 'Purdue' > 'instck/path.h' &&
  22. /*
  23. X * $Id: path.h,v 7.1 90/09/17 10:25:43 ksb Exp $
  24. X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
  25. X * 47907.  All rights reserved.
  26. X *
  27. X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
  28. X *
  29. X * This software is not subject to any license of the American Telephone
  30. X * and Telegraph Company or the Regents of the University of California.
  31. X *
  32. X * Permission is granted to anyone to use this software for any purpose on
  33. X * any computer system, and to alter it and redistribute it freely, subject
  34. X * to the following restrictions:
  35. X *
  36. X * 1. Neither the authors nor Purdue University are responsible for any
  37. X *    consequences of the use of this software.
  38. X *
  39. X * 2. The origin of this software must not be misrepresented, either by
  40. X *    explicit claim or by omission.  Credit to the authors and Purdue
  41. X *    University must appear in documentation and sources.
  42. X *
  43. X * 3. Altered versions must be plainly marked as such, and must not be
  44. X *    misrepresented as being the original software.
  45. X *
  46. X * 4. This notice may not be removed or altered.
  47. X */
  48. X
  49. /*
  50. X * we assume that the user has somehow defined a typedef for PATH_DATA...
  51. X */
  52. typedef struct CMnode {
  53. X    struct CMnode *pCMsibling;
  54. X    struct CMnode *pCMchild;
  55. X    char *pccomp;
  56. X    PATH_DATA user_data;
  57. X    short fprint;
  58. } COMPONENT;
  59. #define nilCM    ((COMPONENT *) 0)
  60. #define newCM()    ((COMPONENT *) malloc(sizeof(COMPONENT)))
  61. X
  62. extern int chSep;
  63. X
  64. #if HAVE_PROTO
  65. extern int ApplyPath(COMPONENT *, int (*)());
  66. extern PATH_DATA *AddPath(COMPONENT **, char *);
  67. #else
  68. extern int ApplyPath();
  69. extern PATH_DATA *AddPath();
  70. #endif
  71. Purdue
  72. chmod 0444 instck/path.h ||
  73. echo 'restore of instck/path.h failed'
  74. Wc_c="`wc -c < 'instck/path.h'`"
  75. test 1580 -eq "$Wc_c" ||
  76.     echo 'instck/path.h: original size 1580, current size' "$Wc_c"
  77. fi
  78. # ============= instck/gen.h ==============
  79. if test -f 'instck/gen.h' -a X"$1" != X"-c"; then
  80.     echo 'x - skipping instck/gen.h (File already exists)'
  81. else
  82. echo 'x - extracting instck/gen.h (Text)'
  83. sed 's/^X//' << 'Purdue' > 'instck/gen.h' &&
  84. /*
  85. X * $Id: gen.h,v 7.3 90/11/28 13:08:24 ksb Exp $
  86. X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
  87. X * 47907.  All rights reserved.
  88. X *
  89. X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
  90. X *
  91. X * This software is not subject to any license of the American Telephone
  92. X * and Telegraph Company or the Regents of the University of California.
  93. X *
  94. X * Permission is granted to anyone to use this software for any purpose on
  95. X * any computer system, and to alter it and redistribute it freely, subject
  96. X * to the following restrictions:
  97. X *
  98. X * 1. Neither the authors nor Purdue University are responsible for any
  99. X *    consequences of the use of this software.
  100. X *
  101. X * 2. The origin of this software must not be misrepresented, either by
  102. X *    explicit claim or by omission.  Credit to the authors and Purdue
  103. X *    University must appear in documentation and sources.
  104. X *
  105. X * 3. Altered versions must be plainly marked as such, and must not be
  106. X *    misrepresented as being the original software.
  107. X *
  108. X * 4. This notice may not be removed or altered.
  109. X */
  110. X
  111. /*
  112. X * configure parts we need (maxfreq) and export our abstraction        (ksb)
  113. X */
  114. #define MAXGROUPNAME    32    /* size for a group name        */
  115. X
  116. typedef struct MEnode {
  117. X    int iuid;
  118. X    int igid;
  119. X    int imode;
  120. X    char chstrip, chtype;
  121. } ME_ELEMENT;
  122. X
  123. X
  124. #if HAVE_PROTO
  125. extern int GenCk(int, char **);
  126. extern int MECompare(ME_ELEMENT *, ME_ELEMENT *);
  127. extern int MECopy(ME_ELEMENT *, ME_ELEMENT *);
  128. #else
  129. extern int GenCk();
  130. extern int MECompare();
  131. extern int MECopy();
  132. #endif
  133. Purdue
  134. chmod 0444 instck/gen.h ||
  135. echo 'restore of instck/gen.h failed'
  136. Wc_c="`wc -c < 'instck/gen.h'`"
  137. test 1520 -eq "$Wc_c" ||
  138.     echo 'instck/gen.h: original size 1520, current size' "$Wc_c"
  139. fi
  140. # ============= instck/README ==============
  141. if test -f 'instck/README' -a X"$1" != X"-c"; then
  142.     echo 'x - skipping instck/README (File already exists)'
  143. else
  144. echo 'x - extracting instck/README (Text)'
  145. sed 's/^X//' << 'Purdue' > 'instck/README' &&
  146. # $Id: README,v 7.2 90/11/28 09:30:56 ksb Exp $
  147. X
  148. Instck is a member of the install family of sys admin tools.
  149. X
  150. Instck has 3 main functions:
  151. X
  152. X    1/ cleaning up after aborted or broken installs (wrong link count)
  153. X
  154. X    2/ generating checklist files for install
  155. X
  156. X    3/ processing a checklist to find errors in the current system
  157. X
  158. X
  159. When install or purge notifies the admin that a link count is wrong she
  160. may run instck (as directed by install).  For example if install tells
  161. you that the link count is wrong for /usr/bin/OLD/cu, one might run:
  162. X    instck -iS /usr/bin/OLD
  163. X
  164. which would prompt with something like:
  165. X    instck: linking ../tip to ../cu (cwd=/usr/bin/OLD)
  166. X    instck: rm -f ../tip {was link into OLD} [nfhqy] y
  167. X    instck: ln ../cu ../tip [nfhqy] y
  168. X
  169. These commands repair the problem.  Instck can not always find the link,
  170. but it will suggest stronger commands (like find(1)) when it fails.
  171. X
  172. X
  173. Instck will generate a checklist file for install: try
  174. X    instck -SG /bin/ /lib/
  175. X
  176. retry with combinations of -v and -l and -L if you like.
  177. X
  178. X
  179. Instck checks the currently installed products against install's check
  180. list (/usr/local/etc/install.cf) and reports bad modes/owners/groups.
  181. Instck can be run from crontab as often as purge(1l) is, possibly not
  182. at the same time.  (Instck should take very little time to run.)
  183. X
  184. kayessbee
  185. Purdue
  186. chmod 0444 instck/README ||
  187. echo 'restore of instck/README failed'
  188. Wc_c="`wc -c < 'instck/README'`"
  189. test 1307 -eq "$Wc_c" ||
  190.     echo 'instck/README: original size 1307, current size' "$Wc_c"
  191. fi
  192. # ============= purge/purge.m ==============
  193. if test ! -d 'purge'; then
  194.     echo 'x - creating directory purge'
  195.     mkdir 'purge'
  196. fi
  197. if test -f 'purge/purge.m' -a X"$1" != X"-c"; then
  198.     echo 'x - skipping purge/purge.m (File already exists)'
  199. else
  200. echo 'x - extracting purge/purge.m (Text)'
  201. sed 's/^X//' << 'Purdue' > 'purge/purge.m' &&
  202. # command line options for purge(8L)
  203. # $Compile: ${mkcmd-mkcmd} -n main std_help.m %f
  204. # $Id: purge.m,v 3.1 90/11/26 12:26:54 ksb Exp $
  205. X
  206. X
  207. after {
  208. X    named "Version"
  209. X    update "InitAll();if (%rVn) {exit(%n());}"
  210. }
  211. X
  212. from '"configure.h"'
  213. from '"install.h"'
  214. X
  215. every {
  216. X    from '"purge.h"'
  217. X    named "Which"
  218. X    parameter "dirs"
  219. X    help "dirs to purge"
  220. }
  221. X
  222. # this puts the []'s on dirs for us,
  223. # of course we could 'Scan("/");' here if we were not so conservative
  224. zero {
  225. X    update "exit(0);"
  226. }
  227. X
  228. exit {
  229. X    named 'Done'
  230. X    update '%n();'
  231. }
  232. X
  233. # we don't do this because it is never what we want,
  234. # we really want the last stable version --
  235. # we don't know how to find that.
  236. #boolean '1' {
  237. #    named 'f1Copy'
  238. #    init '0'
  239. #    help "always keep one copy as a backup"
  240. #}
  241. X
  242. boolean 'A' {
  243. X    named "fAnyOwner"
  244. X    help "purge for all users"
  245. }
  246. X
  247. function 'u' {
  248. X    parameter "user"
  249. X    named "AddHer"
  250. X    update "(void)%n(%a);"
  251. X    help "OLD directories may be owned by this user"
  252. }
  253. X
  254. boolean 'v' {
  255. X    named "fVerbose"
  256. X    help "be verbose"
  257. }
  258. X
  259. boolean 'n' {
  260. X    named "fExec"
  261. X    init '1'
  262. X    update "%n = !%i;%rvn = !%rvi;"
  263. X    help "do not really execute commands"
  264. }
  265. X
  266. integer 'd' {
  267. X    verify named "iDays"
  268. X    parameter "days"
  269. X    init '14'
  270. X    help "days to keep backup files (default %i)"
  271. }
  272. X
  273. boolean 'V' {
  274. X    named "fVersion"
  275. X    init "0"
  276. X    help "show version information"
  277. }
  278. X
  279. boolean 'S' {
  280. X    named "fSuperUser"
  281. X    init "0"
  282. X    help "run as if we were the superuser"
  283. }
  284. Purdue
  285. chmod 0444 purge/purge.m ||
  286. echo 'restore of purge/purge.m failed'
  287. Wc_c="`wc -c < 'purge/purge.m'`"
  288. test 1367 -eq "$Wc_c" ||
  289.     echo 'purge/purge.m: original size 1367, current size' "$Wc_c"
  290. fi
  291. # ============= purge/purge.h ==============
  292. if test -f 'purge/purge.h' -a X"$1" != X"-c"; then
  293.     echo 'x - skipping purge/purge.h (File already exists)'
  294. else
  295. echo 'x - extracting purge/purge.h (Text)'
  296. sed 's/^X//' << 'Purdue' > 'purge/purge.h' &&
  297. /*
  298. X * $Id: purge.h,v 3.2 90/10/02 21:19:47 ksb Exp $
  299. X * 
  300. X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
  301. X * 47907.  All rights reserved.
  302. X *
  303. X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
  304. X *
  305. X * This software is not subject to any license of the American Telephone
  306. X * and Telegraph Company or the Regents of the University of California.
  307. X *
  308. X * Permission is granted to anyone to use this software for any purpose on
  309. X * any computer system, and to alter it and redistribute it freely, subject
  310. X * to the following restrictions:
  311. X *
  312. X * 1. Neither the authors nor Purdue University are responsible for any
  313. X *    consequences of the use of this software.
  314. X *
  315. X * 2. The origin of this software must not be misrepresented, either by
  316. X *    explicit claim or by omission.  Credit to the authors and Purdue
  317. X *    University must appear in documentation and sources.
  318. X *
  319. X * 3. Altered versions must be plainly marked as such, and must not be
  320. X *    misrepresented as being the original software.
  321. X *
  322. X * 4. This notice may not be removed or altered.
  323. X */
  324. X
  325. extern void InitAll();
  326. extern int AddHer();
  327. extern void Which(), Done();
  328. Purdue
  329. chmod 0444 purge/purge.h ||
  330. echo 'restore of purge/purge.h failed'
  331. Wc_c="`wc -c < 'purge/purge.h'`"
  332. test 1148 -eq "$Wc_c" ||
  333.     echo 'purge/purge.h: original size 1148, current size' "$Wc_c"
  334. fi
  335. # ============= install.d/dir.h ==============
  336. if test ! -d 'install.d'; then
  337.     echo 'x - creating directory install.d'
  338.     mkdir 'install.d'
  339. fi
  340. if test -f 'install.d/dir.h' -a X"$1" != X"-c"; then
  341.     echo 'x - skipping install.d/dir.h (File already exists)'
  342. else
  343. echo 'x - extracting install.d/dir.h (Text)'
  344. sed 's/^X//' << 'Purdue' > 'install.d/dir.h' &&
  345. /*
  346. X * $Id: dir.h,v 7.0 90/09/17 09:41:42 ksb Exp $
  347. X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
  348. X * 47907.  All rights reserved.
  349. X *
  350. X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
  351. X *
  352. X * This software is not subject to any license of the American Telephone
  353. X * and Telegraph Company or the Regents of the University of California.
  354. X *
  355. X * Permission is granted to anyone to use this software for any purpose on
  356. X * any computer system, and to alter it and redistribute it freely, subject
  357. X * to the following restrictions:
  358. X *
  359. X * 1. Neither the authors nor Purdue University are responsible for any
  360. X *    consequences of the use of this software.
  361. X *
  362. X * 2. The origin of this software must not be misrepresented, either by
  363. X *    explicit claim or by omission.  Credit to the authors and Purdue
  364. X *    University must appear in documentation and sources.
  365. X *
  366. X * 3. Altered versions must be plainly marked as such, and must not be
  367. X *    misrepresented as being the original software.
  368. X *
  369. X * 4. This notice may not be removed or altered.
  370. X */
  371. X
  372. #if HAVE_PROTO
  373. extern int DirInstall(char *, char *, char *, char *, char *, char *, char *, char *, int);
  374. #else
  375. extern int DirInstall();
  376. #endif
  377. X
  378. extern char acLs[];
  379. extern char acLsDirArgs[];
  380. Purdue
  381. chmod 0444 install.d/dir.h ||
  382. echo 'restore of install.d/dir.h failed'
  383. Wc_c="`wc -c < 'install.d/dir.h'`"
  384. test 1262 -eq "$Wc_c" ||
  385.     echo 'install.d/dir.h: original size 1262, current size' "$Wc_c"
  386. fi
  387. # ============= install.d/file.h ==============
  388. if test -f 'install.d/file.h' -a X"$1" != X"-c"; then
  389.     echo 'x - skipping install.d/file.h (File already exists)'
  390. else
  391. echo 'x - extracting install.d/file.h (Text)'
  392. sed 's/^X//' << 'Purdue' > 'install.d/file.h' &&
  393. /*
  394. X * $Id: file.h,v 7.0 90/09/17 09:41:48 ksb Exp $
  395. X * Copyright 1990 Purdue Research Foundation, West Lafayette, Indiana
  396. X * 47907.  All rights reserved.
  397. X *
  398. X * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
  399. X *
  400. X * This software is not subject to any license of the American Telephone
  401. X * and Telegraph Company or the Regents of the University of California.
  402. X *
  403. X * Permission is granted to anyone to use this software for any purpose on
  404. X * any computer system, and to alter it and redistribute it freely, subject
  405. X * to the following restrictions:
  406. X *
  407. X * 1. Neither the authors nor Purdue University are responsible for any
  408. X *    consequences of the use of this software.
  409. X *
  410. X * 2. The origin of this software must not be misrepresented, either by
  411. X *    explicit claim or by omission.  Credit to the authors and Purdue
  412. X *    University must appear in documentation and sources.
  413. X *
  414. X * 3. Altered versions must be plainly marked as such, and must not be
  415. X *    misrepresented as being the original software.
  416. X *
  417. X * 4. This notice may not be removed or altered.
  418. X */
  419. X
  420. #if HAVE_PROTO
  421. extern void MkOld(char *);
  422. extern int DoBackup(int, char *, char *, char *);
  423. extern void MakeNames(char *, char *, char *, char *);
  424. extern int DoLinks(struct stat *, char *, char *, int, struct passwd *, struct group *);
  425. extern int LaunchLinks(struct stat *, char *, char *, char *, int, struct passwd *, struct group *);
  426. extern int Install(char *, char *, char *, char *);
  427. #else
  428. extern void MkOld();
  429. extern int DoBackup();
  430. extern void MakeNames();
  431. extern int DoLinks();
  432. extern int LaunchLinks();
  433. extern int Install();
  434. #endif
  435. Purdue
  436. chmod 0444 install.d/file.h ||
  437. echo 'restore of install.d/file.h failed'
  438. Wc_c="`wc -c < 'install.d/file.h'`"
  439. test 1611 -eq "$Wc_c" ||
  440.     echo 'install.d/file.h: original size 1611, current size' "$Wc_c"
  441. fi
  442. # ============= instck/maxfreq.h ==============
  443. if test -f 'instck/maxfreq.h' -a X"$1" != X"-c"; then
  444.     echo 'x - skipping instck/maxfreq.h (File already exists)'
  445. else
  446. echo 'x - extracting instck/maxfreq.h (Text)'
  447. sed 's/^X//' << 'Purdue' > 'instck/maxfreq.h' &&
  448. /*
  449. X * manage a data structure that keeps the modes of a list of values
  450. X * $Id: maxfreq.h,v 7.2 90/11/28 09:09:59 ksb Exp $
  451. X *
  452. X * Assumptions:
  453. X *    there aren't many different values (usually less than 16)
  454. X *    long chains of the same number are common
  455. X */
  456. X
  457. /*
  458. X * test configuration
  459. X */
  460. #ifdef TEST
  461. #define MAXBUF    100
  462. X
  463. typedef union MEnode {
  464. X    char ac[MAXBUF];
  465. } ME_ELEMENT;
  466. X
  467. extern int MECopy();
  468. extern int MECompare();
  469. extern char *progname;
  470. extern int main();
  471. #endif /* TEST    */
  472. X
  473. /*
  474. X * this is the data structure used for keeping the max frequency
  475. X *
  476. X * The algorithm to maintain it is O(n^2) / K; we try to keep K large
  477. X * by predicting that the input contains long repeating sequences of
  478. X * the same key.
  479. X */
  480. typedef struct MFnode {
  481. X    struct MFnode *pMFlower;/* list of nodes with lower freq's    */
  482. X    struct MFnode *pMFequal;/* list of nodes with equal freq's    */
  483. X    ME_ELEMENT ME;
  484. X    int icount;
  485. } MAXFREQ;
  486. #define nilMF    ((MAXFREQ *)0)
  487. X
  488. extern ME_ELEMENT *MFIncrement();
  489. extern void MFFree();
  490. extern int MFCheckMax(), MFScan();
  491. Purdue
  492. chmod 0444 instck/maxfreq.h ||
  493. echo 'restore of instck/maxfreq.h failed'
  494. Wc_c="`wc -c < 'instck/maxfreq.h'`"
  495. test 1018 -eq "$Wc_c" ||
  496.     echo 'instck/maxfreq.h: original size 1018, current size' "$Wc_c"
  497. fi
  498. # ============= purge/filedup.h ==============
  499. if test -f 'purge/filedup.h' -a X"$1" != X"-c"; then
  500.     echo 'x - skipping purge/filedup.h (File already exists)'
  501. else
  502. echo 'x - extracting purge/filedup.h (Text)'
  503. sed 's/^X//' << 'Purdue' > 'purge/filedup.h' &&
  504. /*
  505. X * $Id: filedup.h,v 3.0 90/09/17 11:38:21 ksb Exp $
  506. X * routines to keep track of dup files (hard links)            (ksb)
  507. X */
  508. typedef struct AE {
  509. X    dev_t mydev;
  510. X    ino_t myino;
  511. X    char *pcname;
  512. } AE_ELEMENT;
  513. #define nilAE    ((AE_ELEMENT *)0)
  514. X
  515. /*
  516. X * Indices for AVsbpAVchild tag
  517. X */
  518. #define AV_LCHILD    0
  519. #define AV_RCHILD    1
  520. X
  521. /*
  522. X * Balance factors (can be used to select child to traverse too)
  523. X */
  524. #define AV_BAL_LEFT    AV_LCHILD
  525. #define AV_BAL_CENTER    -1
  526. #define AV_BAL_RIGHT    AV_RCHILD
  527. X
  528. typedef unsigned AVCARDINAL;        /* short/normal/long unsigned     */
  529. X
  530. typedef struct AVnode {
  531. X    struct AVnode *AVsbpAVchild[2];    /* AVL children            */
  532. X    short int AVbtipped;        /* AVL balance factor        */
  533. X    AE_ELEMENT AE_data;
  534. } AVL;
  535. #define nilAV    ((AVL *)0)
  536. extern void AVInit();
  537. X
  538. typedef AVL *FILEDUPS;
  539. extern char *FDAdd();
  540. #define FDScan    AVScan
  541. #define FDInit    AVInit
  542. Purdue
  543. chmod 0444 purge/filedup.h ||
  544. echo 'restore of purge/filedup.h failed'
  545. Wc_c="`wc -c < 'purge/filedup.h'`"
  546. test 825 -eq "$Wc_c" ||
  547.     echo 'purge/filedup.h: original size 825, current size' "$Wc_c"
  548. fi
  549. exit 0
  550.  
  551. exit 0 # Just in case...
  552.