home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume38 / lude / part08 < prev    next >
Encoding:
Text File  |  1993-07-11  |  66.0 KB  |  2,368 lines

  1. Newsgroups: comp.sources.misc
  2. From: laplante@crim.ca (Pierre Laplante)
  3. Subject: v38i040:  lude - A Distributed Software Library, Part08/12
  4. Message-ID: <1993Jul11.224709.16721@sparky.imd.sterling.com>
  5. X-Md4-Signature: 776e355bc8e150376f7cc5afae121340
  6. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sun, 11 Jul 1993 22:47:09 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: laplante@crim.ca (Pierre Laplante)
  12. Posting-number: Volume 38, Issue 40
  13. Archive-name: lude/part08
  14. Environment: UNIX
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm
  21. #   lude-1.1/src/orig/configure lude-1.1/src/orig/html/diri_eng.UU
  22. #   lude-1.1/src/orig/src/ludeadm
  23. # Wrapped by kent@sparky on Sun Jul 11 15:49:15 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 8 (of 12)."'
  27. if test -f 'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'\"
  29. else
  30.   echo shar: Extracting \"'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'\" \(22260 characters\)
  31.   sed "s/^X//" >'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm' <<'END_OF_FILE'
  32. X#!/usr/local/bin/perl
  33. X
  34. X# ludeadm - Project lude.
  35. X# Copyright (C) 1991, 1992  Pierre Laplante
  36. X# Copyright (C) 1992,1993 Stephane Boucher, Ecole Polytechnique de Montreal.
  37. X#
  38. X# This program is free software; you can redistribute it and/or modify
  39. X# it under the terms of the GNU General Public License as published by
  40. X# the Free Software Foundation; either version 1, or (at your option)
  41. X# any later version.
  42. X#
  43. X# This program is distributed in the hope that it will be useful,
  44. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  45. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  46. X# GNU General Public License for more details.
  47. X#
  48. X# You should have received a copy of the GNU General Public License
  49. X# along with this program; if not, write to the Free Software
  50. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  51. X
  52. X$FULL_VERSION=
  53. X    "-- ludeadm --\n" .
  54. X    "This is part of LUDE (Logitheque Universitaire Distribuee et Extensible)\n\n";
  55. X
  56. X$FULL_VERSION.= '$Id: ludeadm,v 1.4 1993/03/17 14:56:49 sbo Exp $' ."\n";
  57. X
  58. X$VERSION='1.1';
  59. X
  60. X#-----------------------------------------------------------------------
  61. X#
  62. X#    Globals definitions
  63. X#
  64. X
  65. X$PL_INCDIR="/usr/local/soft/lude-1.1/run/crim/sun4.1_sparc/include/lude";
  66. X$LANG_PATH="/usr/local/soft/lude-1.1/run/crim/sun4.1_sparc/lib/lude/lang:../lang";
  67. X$LUDE_MODIF_FILE_TMPL="/usr/local/soft/lude-1.1/run/crim/sun4.1_sparc/lib/lude/LUDE-MODIF.tmpl";
  68. X$LUDE_CLASS_FILE_TMPL="/usr/local/soft/lude-1.1/run/crim/sun4.1_sparc/lib/lude/LUDE-CLASS.tmpl";
  69. X$IAFA_FILE_TMPL="/usr/local/soft/lude-1.1/run/crim/sun4.1_sparc/lib/lude/IAFA-PACKAGES.tmpl";
  70. X
  71. X
  72. X#-----------------------------------------------------------------------
  73. X#
  74. X#    Main program
  75. X#
  76. X
  77. Xmain: {
  78. X    local($exitval)=0;        # Success by default
  79. X    local($cmdsToDo);
  80. X
  81. X    unshift(@INC, split(/:/, $PL_INCDIR));
  82. X
  83. X    require('config.pl');
  84. X
  85. X    # Load and initialise the language support immediatly so
  86. X    # that the messages are available the soonest possible.
  87. X    # If an error occure in this phase, the execution is 
  88. X    # immediatly aborted.
  89. X    require('ludelang.pl');
  90. X    &InitLang($CONF_LANG_DEFAULT, $LANG_PATH, 'ludemisc', @ARGV);
  91. X    &InitLang($CONF_LANG_DEFAULT, $LANG_PATH, 'ludeadm', @ARGV);
  92. X
  93. X    require('ludemisc');
  94. X    require('ludeadminc');
  95. X    require('BldRegexpMinRqr.pl');
  96. X    require('fileutil.pl');
  97. X
  98. X    if (! &VerifySystem) {
  99. X    $exitval=1;
  100. X    }
  101. X    elsif (($cmdsToDo=&Initialisation) < 0) {
  102. X    $exitval=2;
  103. X    }
  104. X    # If any command(s) left to be executed
  105. X    elsif ($cmdsToDo > 0) {
  106. X    if (! &ExecCommands) {
  107. X        $exitval=3;
  108. X    }
  109. X    }
  110. X
  111. X    exit $exitval;
  112. X}
  113. X
  114. X
  115. X#-----------------------------------------------------------------------
  116. X# Description  : Create the directories structure for the given
  117. X#                location/soft/mod/class. If a base tree is not
  118. X#                already present, one is created.
  119. X# 
  120. X# Parameters   : $server - server location to perform the action.
  121. X#                          if eq '/', then $SOFT_DIR is used.
  122. X#                $soft   - software on which to perform the action.
  123. X#                $mod    - modification  ...
  124. X#                $class  - class  ...
  125. X#
  126. X# Returns      : 1 on success
  127. X#                0 if any errors
  128. X#
  129. Xsub Create {
  130. X    if (scalar(@_)!=4) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  131. X    local($server, $soft, $mod, $class)=@_;
  132. X    local($path);
  133. X    local($retval)=1;        # success by default
  134. X
  135. X    $path=($server ne '/') ? "$SERVER_DIR/$server/$soft" : "$SOFT_DIR/$soft";
  136. X
  137. X    #
  138. X    # Unlink the sections if it is a link
  139. X    #
  140. X    for $section ('run', 'src') {
  141. X      if (-l "$path/$section") {
  142. X    if (&VerboseRetShow($WARN_CMD, "unlink $path/$section")) {
  143. X      # Showing, so do nothing
  144. X    }
  145. X    elsif (! unlink("$path/$section")) {
  146. X      &NFError($ERR_UNLINK, "$path/$section");
  147. X      $retval=0;
  148. X    }
  149. X      }
  150. X    }
  151. X
  152. X    #
  153. X    # Create the directory Hierarchy
  154. X    #
  155. X    if ($retval) {        # If still no error
  156. X      for $d ("$path",
  157. X          "$path/src", "$path/src/orig", "$path/src/$mod", 
  158. X          "$path/run", "$path/run/share",
  159. X          "$path/run/$mod", "$path/run/$mod/share", 
  160. X          "$path/run/$mod/$class", 
  161. X          "$path/install", "$path/install/share",
  162. X          "$path/install/$mod", "$path/install/$mod/share", 
  163. X          "$path/install/$mod/$class") { 
  164. X    if (! -d $d) {
  165. X      if (&VerboseRetShow($WARN_CMD, "mkdir $d")) {
  166. X        # Showing, so do nothing
  167. X      }
  168. X      elsif (! mkdir($d, 0755)) {
  169. X        &NFError($ERR_MKDIR, "$d"); 
  170. X        $retval=0;
  171. X      }
  172. X    }
  173. X      }
  174. X    }
  175. X
  176. X    if ($retval) {        # if still no error
  177. X
  178. X      # Test for the presence of a LUDE file template
  179. X      stat("$IAFA_FILE_TMPL");
  180. X      if (! -e _) {        # Template does not exist
  181. X    &NFError($ERR_FILE, $IAFA_FILE_TMPL);
  182. X    $retval=0;
  183. X      }
  184. X      elsif (! -r _) {        # Template is not readable
  185. X    &NFError($ERR_NO_R_PERM, $IAFA_FILE_TMPL);
  186. X    $retval=0;
  187. X      }
  188. X      else {            # Still no error
  189. X    # Adding IAFA templates if none is present
  190. X    if (! -e "$path/install/$IAFA_FILE") {    
  191. X      if (&VerboseRetShow($WARN_CMD,
  192. X                  "cp $IAFA_FILE_TMPL $path/install/$IAFA_FILE")) {
  193. X        # Showing, so do nothing
  194. X      }
  195. X      else {
  196. X        if (! &CopyFile($IAFA_FILE_TMPL, "$path/install/$IAFA_FILE")) {
  197. X          $retval=0;    # Error while copying
  198. X        }
  199. X      }
  200. X    }
  201. X      }
  202. X
  203. X      # Test for the presence of a LUDE_CLASS file template
  204. X      stat("$LUDE_CLASS_FILE_TMPL");
  205. X      if (! -e _) {        # Template does not exist
  206. X    &NFError($ERR_FILE, $LUDE_CLASS_FILE_TMPL);
  207. X    $retval=0;
  208. X      }
  209. X      elsif (! -r _) {        # Template is not readable
  210. X    &NFError($ERR_NO_R_PERM, $LUDE_CLASS_FILE_TMPL);
  211. X    $retval=0;
  212. X      }
  213. X      else {            # Still no error
  214. X    # Adding LUDE templates if none is present
  215. X    # The file is named in such way that it is locked
  216. X    if (! -e "$path/install/$LUDE_FILE") {    
  217. X      if (&VerboseRetShow($WARN_CMD,
  218. X                  "cp $LUDE_CLASS_FILE_TMPL $path/install/$mod/$class/$LUDE_FILE.lock")) {
  219. X        # Showing, so do nothing
  220. X      }
  221. X      else {
  222. X        if (! &CopyFile($LUDE_CLASS_FILE_TMPL, "$path/install/$mod/$class/$LUDE_FILE.lock")) {
  223. X          $retval=0;    # Error while copying
  224. X        }
  225. X      }
  226. X    }
  227. X      }
  228. X
  229. X      # Test for the presence of a LUDE_MODIF file template
  230. X      stat("$LUDE_MODIF_FILE_TMPL");
  231. X      if (! -e _) {        # Template does not exist
  232. X    &NFError($ERR_FILE, $LUDE_MODIF_FILE_TMPL);
  233. X    $retval=0;
  234. X      }
  235. X      elsif (! -r _) {        # Template is not readable
  236. X    &NFError($ERR_NO_R_PERM, $LUDE_MODIF_FILE_TMPL);
  237. X    $retval=0;
  238. X      }
  239. X      else {            # Still no error
  240. X    # Adding LUDE templates if none is present
  241. X    if (! -e "$path/install/$mod/$LUDE_FILE") {    
  242. X      if (&VerboseRetShow($WARN_CMD,
  243. X                  "cp $LUDE_MODIF_FILE_TMPL $path/install/$mod/$LUDE_FILE")) {
  244. X        # Showing, so do nothing
  245. X      }
  246. X      else {
  247. X        if (! &CopyFile($LUDE_MODIF_FILE_TMPL, "$path/install/$mod/$LUDE_FILE")) {
  248. X          $retval=0;    # Error while copying
  249. X        }
  250. X      }
  251. X    }
  252. X      }
  253. X    }
  254. X
  255. X    return $retval;
  256. X}
  257. X
  258. X#-----------------------------------------------------------------------
  259. X# Description  : Lock a soft/mod/class so that others can't
  260. X#                install it.
  261. X# 
  262. X# Parameters   : $server - server location to perform the action.
  263. X#                          if eq '/', then $SOFT_DIR is used.
  264. X#                $soft   - software on which to perform the action.
  265. X#                $mod    - modification  ...
  266. X#                $class  - class  ...
  267. X#
  268. X# Returns      : 1 on success
  269. X#                0 if any errors
  270. X#
  271. Xsub Lock {
  272. X    if (scalar(@_)!=4) { &Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__)); }
  273. X    local($server, $soft, $mod, $class)=@_;
  274. X    local($path, $lockfile);
  275. X    local($retval)=1;        # success by default
  276. X
  277. X    $path=($server ne'/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  278. X
  279. X    $lockfile="$path/$soft/install/$mod/$class/$LUDE_FILE";
  280. X    
  281. X    if (-e "$lockfile") {
  282. X      if (-l "$path/$soft/install") {
  283. X    &NFError($ERR_CANT_LOCK_BECAUSE_SYMLINK, "$path/$soft/install");
  284. X    $retval=0;
  285. X      }
  286. X      else {
  287. X    if (&VerboseRetShow($WARN_CMD, "rename $lockfile $lockfile.lock")) {
  288. X      # Showing, so do nothing
  289. X    }
  290. X    else {
  291. X      if (! rename($lockfile, "$lockfile.lock")) {
  292. X        &NFError($ERR_REN, "$lockfile");
  293. X        $retval=0;
  294. X      }
  295. X    }
  296. X      }
  297. X    }
  298. X    else {
  299. X      # Lock file is not there. Can't lock the software.
  300. X      &NFError($ERR_CANT_LOCK_BECAUSE_NO_LOCK_FILE,
  301. X           "$lockfile");
  302. X      $retval=0;
  303. X    }
  304. X      
  305. X
  306. X    return $retval;
  307. X}
  308. X
  309. X
  310. X#-----------------------------------------------------------------------
  311. X# Description  : Release a soft/mod/class so that others can
  312. X#                Install it.
  313. X# 
  314. X# Parameters   : $server - server location to perform the action.
  315. X#                          if eq '/', then $SOFT_DIR is used.
  316. X#                $soft   - software on which to perform the action.
  317. X#                $mod    - modification  ...
  318. X#                $class  - class  ...
  319. X#
  320. X# Returns      : 1 on success
  321. X#                0 if any errors
  322. X#
  323. Xsub Release {
  324. X    if (scalar(@_)!=4){&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  325. X    local($server, $soft, $mod, $class)=@_;
  326. X    local($path, $lockdir, $lockfile);
  327. X    local($retval)=1;        # Success by default
  328. X
  329. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  330. X    $lockdir="$path/$soft/install/$mod/$class";
  331. X    $lockfile="$lockdir/$LUDE_FILE";
  332. X    
  333. X    if (-e "$lockfile") {
  334. X    # The unlock file is there, meaning that the software is
  335. X    # already released! (confusing... the name of the variables
  336. X    # will have to be changed one day).
  337. X    }
  338. X    elsif (! -e "$lockfile.lock") {
  339. X      # The lock file is absent, therefore it is an error
  340. X      &NFError($ERR_CANT_RELEASE_BECAUSE_NO_LOCK_FILE,
  341. X           "$lockfile.lock");
  342. X      $retval=0;
  343. X    }
  344. X    elsif (-l "$path/$soft/install") {
  345. X      &NFError($ERR_CANT_RELEASE_BECAUSE_SYMLINK, "$path/$soft/install");
  346. X      $retval=0;
  347. X    }
  348. X    elsif (! -w "$lockdir") {
  349. X    &NFError($ERR_NO_W_PERM, "$lockdir");
  350. X    $retval=0;
  351. X    }
  352. X    else {            # Everything is in order
  353. X    if (&VerboseRetShow($WARN_CMD, "rename $lockfile.lock $lockfile")) {
  354. X        # Showing, so do nothing
  355. X    }
  356. X    else {
  357. X        local(*F);
  358. X        if (! open(F, ">$lockfile")) {
  359. X        &NFError($ERR_OPEN, "$lockfile");
  360. X        $retval=0;
  361. X        }
  362. X        else {
  363. X        close(F);
  364. X        }
  365. X    }
  366. X    }
  367. X    return $retval;
  368. X}
  369. X
  370. X
  371. X#-----------------------------------------------------------------------
  372. X# Description  : do a Mount tfs of .../src/mod on .../src/orig
  373. X# 
  374. X# Parameters   : $server - server location to perform the action.
  375. X#                          if eq '/', then $SOFT_DIR is used.
  376. X#                $soft   - software on which to perform the action.
  377. X#                $mod    - modification  ...
  378. X#
  379. X# Returns      : 1 on success
  380. X#                0 if any errors
  381. X#
  382. Xsub Mount_tfs {
  383. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  384. X    local($server, $soft, $mod)=@_;
  385. X    local($path);
  386. X    local($retval)=1;        # Success by default
  387. X
  388. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";    
  389. X    $path.= "/$soft/src";
  390. X
  391. X    if (-l $path) {
  392. X      &NFError($ERR_CANT_MOUNT_TFS_BECAUSE_SYMLINK, $path);
  393. X      $retval=0;
  394. X    }
  395. X    elsif (&RunCmd("$PROG_MOUNT_TFS $path/$mod $path/orig") != 0) {
  396. X    # An error occured
  397. X    $retval=0;
  398. X    }
  399. X
  400. X    return $retval;
  401. X}
  402. X
  403. X#-----------------------------------------------------------------------
  404. X# Description  : do a UMount tfs of .../src/orig
  405. X# 
  406. X# Parameters   : $server - server location to perform the action.
  407. X#                          if eq '/', then $SOFT_DIR is used.
  408. X#                $soft   - software on which to perform the action.
  409. X#                $mod    - modification  ...
  410. X#
  411. X# Returns      : 1 on success
  412. X#                0 if any errors
  413. X#
  414. Xsub Umount_tfs {
  415. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  416. X    local($server, $soft, $mod)=@_;
  417. X    local($path);
  418. X    local($retval)=1;
  419. X
  420. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  421. X    $path.="/$soft/src";    
  422. X
  423. X    if (-l $path) {
  424. X      &NFError($ERR_CANT_UMOUNT_TFS_BECAUSE_SYMLINK, $path);
  425. X      $retval=0;
  426. X    }
  427. X    if (&RunCmd("$PROG_UMOUNT_TFS $path/orig") != 0) {
  428. X    # An error occured
  429. X    $retval=0;
  430. X    }
  431. X
  432. X    return $retval;
  433. X}
  434. X
  435. X#-----------------------------------------------------------
  436. X# Description : Check to make sure that $soft/src is not a
  437. X#               symlink. 
  438. X#               Initiate the duplication of 
  439. X#               $server/$soft/src/orig in 
  440. X#               $server/$soft/src/$mod
  441. X#
  442. X# Parameters  : $server - specify the server where to 
  443. X#                         perform the duplication
  444. X#               $soft   - Specify the software to duplicate
  445. X#               $mod    - specify the software's modification
  446. X#                         to duplicate
  447. X#
  448. X# Returns     : 1 on success
  449. X#               0 on error
  450. X#
  451. Xsub Duplicate {
  452. X  if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  453. X  local($server, $soft, $mod)=@_;
  454. X  local($retval)=1;        # Success by default
  455. X  
  456. X  local($dir)=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  457. X
  458. X  if (-l "$dir/$soft/src") {
  459. X    &NFError($ERR_CANT_DUPLICATE_BECAUSE_SYMLINK, "$dir/$soft/src");
  460. X    $retval=0;
  461. X  }
  462. X  else {
  463. X    local($origTree)="$dir/$soft/src/orig";
  464. X    local($dupTree) ="$dir/$soft/src/$mod";
  465. X
  466. X    if (! &DupTree($origTree, $dupTree, '')) {
  467. X      $retval=0;        # Error occured
  468. X    }
  469. X  }
  470. X
  471. X  return $retval;
  472. X}
  473. X
  474. X#-----------------------------------------------------------
  475. X# Description : Check to make sure that $soft/src is not a
  476. X#               symlink. 
  477. X#               Initiate the unduplication of 
  478. X#               $server/$soft/src/orig in 
  479. X#               $server/$soft/src/$mod
  480. X#
  481. X# Parameters  : $server - specify the server where to 
  482. X#                         perform the unduplication
  483. X#               $soft   - Specify the software to unduplicate
  484. X#               $mod    - specify the software's modification
  485. X#                         to unduplicate
  486. X#
  487. X# Returns     : 1 on success
  488. X#               0 on error
  489. X#
  490. Xsub Unduplicate {
  491. X  if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  492. X  local($server, $soft, $mod)=@_;
  493. X  local($retval)=1;        # Success by default
  494. X  
  495. X  local($dir)=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  496. X
  497. X  if (-l "$dir/$soft/src") {
  498. X    &NFError($ERR_CANT_UNDUPLICATE_BECAUSE_SYMLINK, "$dir/$soft/src");
  499. X    $retval=0;
  500. X  }
  501. X  else {
  502. X    local($origTree)="$dir/$soft/src/orig";
  503. X    local($undupTree) ="$dir/$soft/src/$mod";
  504. X
  505. X    if (! &UnDupTree($origTree, $undupTree, '')) {
  506. X      $retval=0;        # Error occured
  507. X    }
  508. X  }
  509. X
  510. X  return $retval;
  511. X}
  512. X
  513. X#-----------------------------------------------------------------------
  514. X# Description  : Duplicate the content of origTree in dupTree, with
  515. X#                the following rules:
  516. X#                - If the file is present in both tree, and
  517. X#                  If the original file is more recent that the dupFile,
  518. X#                  then the original file replaces the diff File.
  519. X#                  (the time checked is the mtime i.e. last-modified)
  520. X#                - If the file is only present in the original tree, it
  521. X#                  is copied in the diff tree.
  522. X#                (file in the present context refers to links, directory or
  523. X#                 regular files)      
  524. X# 
  525. X# Parameters   : $origTree - root directory of tree of files that will be
  526. X#                            be duplicated. (must be an absolute path)
  527. X#                $dupTree  - root directory where to place the duplicated
  528. X#                            files (must be an absolute path)
  529. X#
  530. X# Returns      : 1 on success
  531. X#                0 if any errors
  532. X#
  533. Xsub DupTree {
  534. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  535. X    local($origTree, $dupTree, $suffix)=@_;
  536. X    local($retval)=1;        # Success by default
  537. X    local(@dupTreeStat, @origTreeStat);
  538. X
  539. X    if ($suffix ne '') {
  540. X    $origTree.="/$suffix";
  541. X    $dupTree.="/$suffix";
  542. X    }
  543. X    
  544. X    @origTreeStat=lstat($origTree);
  545. X    if ($origTree =~ m!^(([/.])|(\.\.))?$!) {
  546. X    # '', '.', '..' or '/' are incorrect value for $origTree
  547. X    &NFError($ERR_VALUE_DIR, $origTree);
  548. X    $retval=0;
  549. X    }
  550. X    elsif ($dupTree =~ m!^(([/.])|(\.\.))?$!) {
  551. X    # '', '.', '..' or '/' are incorrect value for $dupTree
  552. X    &NFError($ERR_VALUE_DIR, $dupTree);
  553. X    $retval=0;
  554. X    }
  555. X    elsif (! -e _) {
  556. X    # origTree does not exist
  557. X    &NFError($ERR_DIR, $origTree);
  558. X    $retval=0;
  559. X    }
  560. X    elsif (! -d _) {
  561. X    # Oups, should be a directory
  562. X    &NFError($ERR_DIR_TYPE_EXPECTED, $origTree);
  563. X    $retval=0;
  564. X    }
  565. X    elsif (! -r _) {
  566. X    # Directory is not readable
  567. X    &NFError($ERR_READ_DIR, $origTree);
  568. X    $retval=0;
  569. X    }
  570. X    else {            # So far so good
  571. X    
  572. X    # Let's do some test on $dupTree now
  573. X    @dupTreeStat=lstat($dupTree);
  574. X
  575. X    if (! -e _) {
  576. X        # The dupTree directory does not exist, so
  577. X        # simply recursively copy origTree in dupTree
  578. X        # and everything is all done.
  579. X
  580. X        # Permissions of the original directory
  581. X        local($origTreePerm)=$origTreeStat[2+$[];
  582. X
  583. X        # Create the directory and set the permission to the same
  584. X        # permissions of origTree
  585. X        if (&VerboseRetShow($WARN_CMD, "mkdir $dupTree")) {
  586. X        # Showing, so do nothing
  587. X        }
  588. X        elsif (! mkdir($dupTree, $origTreePerm)) {
  589. X        &NFError($ERR_MKDIR, $dupTree, $!);
  590. X        $retval=0;
  591. X        }
  592. X        
  593. X        if ($retval) {    # If still no error
  594. X        # Check to see if any files in $origTree ...
  595. X        local(*DIR, $numOfFiles);
  596. X        opendir(DIR, $origTree);
  597. X        $numOfFiles=grep(!/^\.{1,2}$/, readdir(DIR));
  598. X        closedir(DIR);
  599. X        if ($numOfFiles>0) { # i.e. if an files other than . and ..
  600. X            local($cmd)="(cd $origTree; $PROG_TAR cf - *) | (cd $dupTree; $PROG_TAR -xpf -)";
  601. X        
  602. X            if (&RunCmd($cmd) != 0) {
  603. X            # An error occured while executing the command
  604. X            $retval=0;
  605. X            }
  606. X        }
  607. X        }
  608. X    }
  609. X    elsif (! -d _) {
  610. X        # dupTree is not a directory
  611. X        &NFError($ERR_DIR_TYPE_EXPECTED, $dupTree);
  612. X        $retval=0;
  613. X    }
  614. X    elsif (! -r _) {
  615. X        # Directory is not readable
  616. X        &NFError($ERR_READ_DIR, $dupTree);
  617. X        $retval=0;
  618. X    }
  619. X    elsif (! -w _) {
  620. X        # Directory is not writable
  621. X        &NFError($ERR_WRITE_DIR, $dupTree);
  622. X        $retval=0;
  623. X    }
  624. X    else {            # So far so good
  625. X        local(@filesToCopy)=();
  626. X        local(@files);
  627. X        local($origFileMTime, $dupFileMTime);
  628. X
  629. X        local(*DIR);
  630. X        opendir(DIR, $origTree);
  631. X        @files=grep(!/^\.{1,2}$/, readdir(DIR));
  632. X        closedir(DIR);
  633. X
  634. X        foreach $file (@files) {
  635. X        $dupFileMTime=(lstat("$dupTree/$file"))[9+$[];
  636. X        # Warning! stat on origTree/file must be last,
  637. X        # because we will use _ for speed
  638. X        $origFileMTime=(lstat("$origTree/$file"))[9+$[];
  639. X
  640. X        if (-d _) {
  641. X            if (! &DupTree($origTree, $dupTree, $file)) {
  642. X            $retval=0; # An error occured
  643. X            }
  644. X        }
  645. X        # If the file does not exist in dupTree or
  646. X        # if the last-modified time of the file in origTree
  647. X        # is more recent than the last-modified time of
  648. X        # the file in dupTree, add the file to the list
  649. X        # of files to copy.
  650. X        elsif (! -e "$dupTree/$file" ||
  651. X               $origFileMTime > $dupFileMTime) {
  652. X            push(@filesToCopy, $file);
  653. X        }    
  654. X        }
  655. X
  656. X        # Now copy the files
  657. X        # (This will most probably need to be optimized)
  658. X        local($cmd)="(cd $origTree; $PROG_TAR cf - %s) | (cd $dupTree; $PROG_TAR -xpf -)";
  659. X
  660. X        # Copy each file, one by one
  661. X        foreach $file (@filesToCopy) {
  662. X        if (&RunCmd(sprintf($cmd, $file)) != 0) {
  663. X            $retval=0;    # An error occured
  664. X        }
  665. X        }
  666. X    }
  667. X    }
  668. X    return $retval;
  669. X}
  670. X
  671. X#-----------------------------------------------------------------------
  672. X# Description  : 
  673. X# 
  674. X# Parameters   : 
  675. X#                
  676. X# Returns      : 1 on success
  677. X#                0 if any errors
  678. X#
  679. Xsub UnDupTree {
  680. X    if (scalar(@_)!=3){&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  681. X    local($origTree, $dupTree, $suffix)=@_;
  682. X    local($retval)=1;        # Success by default
  683. X    local(@origTreeStat, @dupTreeStat);
  684. X
  685. X    if ($suffix ne '') {
  686. X    $origTree.="/$suffix";
  687. X    $dupTree.="/$suffix";
  688. X    }
  689. X
  690. X    @origTreeStat=stat($origTree);
  691. X    if (! -e _) {
  692. X    # origTree does not exist
  693. X    &NFError($ERR_DIR, $origTree);
  694. X    $retval=0;
  695. X    }
  696. X    elsif (! -d _) {
  697. X    # Oups, should be a directory
  698. X    &NFError($ERR_DIR_TYPE_EXPECTED, $origTree);
  699. X    $retval=0;
  700. X    }
  701. X    elsif (! -r _) {
  702. X    # Directory is not readable
  703. X    &NFError($ERR_READ_DIR, $origTree);
  704. X    $retval=0;
  705. X    }
  706. X    else {            # So far so good
  707. X    # Let's do some test on $dupTree now
  708. X    @dupTreeStat=stat($dupTree);
  709. X
  710. X    if (! -e _) {
  711. X        # The dupTree directory does not exist, so everything
  712. X        # is fine. Nothing to do.
  713. X    }
  714. X    elsif (! -r _) {
  715. X        # Directory is not readable
  716. X        &NFError($ERR_READ_DIR, $dupTree);
  717. X        $retval=0;
  718. X    }
  719. X    elsif (! -w _) {
  720. X        # Directory is not writable
  721. X        &NFError($ERR_WRITE_DIR, $dupTree);
  722. X        $retval=0;
  723. X    }
  724. X    else {            # So far so good
  725. X        local(@origFileStat, @dupFileStat);
  726. X        local(@files);
  727. X
  728. X        local(*DIR);
  729. X        opendir(DIR, $dupTree);
  730. X        @files=grep(!/^\.{1,2}$/, readdir(DIR));
  731. X        closedir(DIR);
  732. X
  733. X        foreach $file (@files) {
  734. X        @dupFileStat=lstat("$dupTree/$file");
  735. X        @origFileStat=lstat("$origTree/$file");
  736. X
  737. X        # if file exists in origTree and file mode is the same
  738. X        # in origTree and dupTree.
  739. X        if (-e _ && $dupFileStat[2+$[] == $origFileStat[2+$[]) {
  740. X            if (-d _) {
  741. X            if (! &UnDupTree($origTree, $dupTree, $file)) {
  742. X                $retval=0; # An error occured
  743. X            }
  744. X            else {
  745. X                # Remove the directory if it is empty.
  746. X                local($numOfFiles);
  747. X                local(*dir);
  748. X                opendir(dir, "$dupTree/$file");
  749. X                $numOfFiles=grep(!/^\.{1,2}$/, readdir(dir));
  750. X                closedir(dir);
  751. X                if ($numOfFiles == 0) {
  752. X                if (&VerboseRetShow($WARN_CMD, "rmdir $dupTree/$file")) {
  753. X                    # Showing, so do nothing.
  754. X                }
  755. X                else {
  756. X                    if (! rmdir("$dupTree/$file")) {
  757. X                    # rmdir failed
  758. X                    &NFError($ERR_RMDIR, "$dupTree/$file", $!);
  759. X                    $retval=0;
  760. X                    }
  761. X                }
  762. X                }                    
  763. X            }
  764. X            }
  765. X            elsif (-f _) {
  766. X            # Compare the two files
  767. X            if (system("$PROG_CMP -s $origTree/$file $dupTree/$file")/256 == 0) {
  768. X                # Files are identical. Remove the file in $dupTree.
  769. X                if (&VerboseRetShow($WARN_CMD, "unlink $dupTree/$file")) {
  770. X                # Showing, so do nothing.
  771. X                }
  772. X                else {
  773. X                if (unlink("$dupTree/$file") != 1) {
  774. X                    # Unlink failed
  775. X                    &NFError($ERR_UNLINK, "$dupTree/$file");
  776. X                    $retval=0;
  777. X                }
  778. X                }
  779. X            }
  780. X            }
  781. X            else {    # -l, -p, -S, -b, -c
  782. X            # Leave the files as is
  783. X            }
  784. X        }
  785. X        }
  786. X    }
  787. X    }
  788. X
  789. X    return $retval;
  790. X}
  791. X
  792. X#     ;;; Local Variables: ***
  793. X#     ;;; mode:perl ***
  794. X#     ;;; End: ***
  795. END_OF_FILE
  796.   if test 22260 -ne `wc -c <'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'`; then
  797.     echo shar: \"'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'\" unpacked with wrong size!
  798.   fi
  799.   chmod +x 'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'
  800.   # end of 'lude-1.1/run/crim/sun4.1_sparc/bin/ludeadm'
  801. fi
  802. if test -f 'lude-1.1/src/orig/configure' -a "${1}" != "-c" ; then 
  803.   echo shar: Will not clobber existing file \"'lude-1.1/src/orig/configure'\"
  804. else
  805.   echo shar: Extracting \"'lude-1.1/src/orig/configure'\" \(16069 characters\)
  806.   sed "s/^X//" >'lude-1.1/src/orig/configure' <<'END_OF_FILE'
  807. X
  808. XPATH=${PATH}:/usr/etc:/usr/lib:/usr/local/bin
  809. X
  810. X#!/bin/sh
  811. X# Guess values for system-dependent variables and create Makefiles.
  812. X# Generated automatically using autoconf.
  813. X# Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  814. X
  815. X# This program is free software; you can redistribute it and/or modify
  816. X# it under the terms of the GNU General Public License as published by
  817. X# the Free Software Foundation; either version 2, or (at your option)
  818. X# any later version.
  819. X
  820. X# This program is distributed in the hope that it will be useful,
  821. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  822. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  823. X# GNU General Public License for more details.
  824. X
  825. X# You should have received a copy of the GNU General Public License
  826. X# along with this program; if not, write to the Free Software
  827. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  828. X
  829. X# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  830. X#        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  831. X# Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  832. X
  833. Xtrap 'rm -f conftest* core; exit 1' 1 3 15
  834. X
  835. Xfor arg
  836. Xdo
  837. X  # Handle --exec_prefix with a space before the argument.
  838. X  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  839. X  # Handle --host with a space before the argument.
  840. X  elif test x$next_host = xyes; then next_host=
  841. X  # Handle --prefix with a space before the argument.
  842. X  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  843. X  # Handle --srcdir with a space before the argument.
  844. X  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  845. X  else
  846. X    case $arg in
  847. X     -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  848. X    exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  849. X     -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  850. X    next_exec_prefix=yes ;;
  851. X
  852. X     -gas | --gas | --ga | --g) ;;
  853. X
  854. X     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  855. X     -host | --host | --hos | --ho | --h)
  856. X    next_host=yes ;;
  857. X
  858. X     -nfp | --nfp | --nf) ;;
  859. X
  860. X     -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  861. X        no_create=1 ;;
  862. X
  863. X     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  864. X    prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  865. X     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  866. X    next_prefix=yes ;;
  867. X
  868. X     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  869. X    srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  870. X     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  871. X    next_srcdir=yes ;;
  872. X
  873. X     -with-* | --with-*) ;;
  874. X
  875. X     *) ;;
  876. X    esac
  877. X  fi
  878. Xdone
  879. X
  880. Xrm -f conftest*
  881. Xcompile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  882. X
  883. X# A filename unique to this package, relative to the directory that
  884. X# configure is in, which we can look for to find out if srcdir is correct.
  885. Xunique_file=lude.dir
  886. X
  887. X# Find the source files, if location was not specified.
  888. Xif test -z "$srcdir"; then
  889. X  srcdirdefaulted=yes
  890. X  # Try the directory containing this script, then `..'.
  891. X  prog=$0
  892. X  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  893. X  test "X$confdir" = "X$prog" && confdir=.
  894. X  srcdir=$confdir
  895. X  if test ! -r $srcdir/$unique_file; then
  896. X    srcdir=..
  897. X  fi
  898. Xfi
  899. Xif test ! -r $srcdir/$unique_file; then
  900. X  if test x$srcdirdefaulted = xyes; then
  901. X    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  902. X  else
  903. X    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  904. X  fi
  905. X  exit 1
  906. Xfi
  907. X# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  908. X# But we can't avoid them for `..', to make subdirectories work.
  909. Xcase $srcdir in
  910. X  .|/*|~*) ;;
  911. X  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  912. Xesac
  913. X
  914. X
  915. Xfor p in cat
  916. Xdo
  917. Xif test -z "$CAT"; then
  918. X  echo checking for $p
  919. X  saveifs="$IFS"; IFS="${IFS}:"
  920. X  for dir in $PATH; do
  921. X    test -z "$dir" && dir=.
  922. X    if test -f $dir/$p; then
  923. X      CAT="$p"
  924. X      break
  925. X    fi
  926. X  done
  927. X  IFS="$saveifs"
  928. Xfi
  929. Xtest -z "$CAT" && CAT=""
  930. X
  931. Xtest -n "$CAT" && break
  932. Xdone
  933. X
  934. Xfor p in chmod
  935. Xdo
  936. Xif test -z "$CHMOD"; then
  937. X  echo checking for $p
  938. X  saveifs="$IFS"; IFS="${IFS}:"
  939. X  for dir in $PATH; do
  940. X    test -z "$dir" && dir=.
  941. X    if test -f $dir/$p; then
  942. X      CHMOD="$p"
  943. X      break
  944. X    fi
  945. X  done
  946. X  IFS="$saveifs"
  947. Xfi
  948. Xtest -z "$CHMOD" && CHMOD=""
  949. X
  950. Xtest -n "$CHMOD" && break
  951. Xdone
  952. X
  953. Xfor p in compress gzip
  954. Xdo
  955. Xif test -z "$COMPRESS"; then
  956. X  echo checking for $p
  957. X  saveifs="$IFS"; IFS="${IFS}:"
  958. X  for dir in $PATH; do
  959. X    test -z "$dir" && dir=.
  960. X    if test -f $dir/$p; then
  961. X      COMPRESS="$p"
  962. X      break
  963. X    fi
  964. X  done
  965. X  IFS="$saveifs"
  966. Xfi
  967. Xtest -z "$COMPRESS" && COMPRESS=""
  968. X
  969. Xtest -n "$COMPRESS" && break
  970. Xdone
  971. X
  972. Xfor p in cp
  973. Xdo
  974. Xif test -z "$CP"; then
  975. X  echo checking for $p
  976. X  saveifs="$IFS"; IFS="${IFS}:"
  977. X  for dir in $PATH; do
  978. X    test -z "$dir" && dir=.
  979. X    if test -f $dir/$p; then
  980. X      CP="$p"
  981. X      break
  982. X    fi
  983. X  done
  984. X  IFS="$saveifs"
  985. Xfi
  986. Xtest -z "$CP" && CP=""
  987. X
  988. Xtest -n "$CP" && break
  989. Xdone
  990. X
  991. Xfor p in echo
  992. Xdo
  993. Xif test -z "$ECHO"; then
  994. X  echo checking for $p
  995. X  saveifs="$IFS"; IFS="${IFS}:"
  996. X  for dir in $PATH; do
  997. X    test -z "$dir" && dir=.
  998. X    if test -f $dir/$p; then
  999. X      ECHO="$p"
  1000. X      break
  1001. X    fi
  1002. X  done
  1003. X  IFS="$saveifs"
  1004. Xfi
  1005. Xtest -z "$ECHO" && ECHO=""
  1006. X
  1007. Xtest -n "$ECHO" && break
  1008. Xdone
  1009. X
  1010. Xfor p in emacs xemacs lemacs
  1011. Xdo
  1012. Xif test -z "$EMACS"; then
  1013. X  echo checking for $p
  1014. X  saveifs="$IFS"; IFS="${IFS}:"
  1015. X  for dir in $PATH; do
  1016. X    test -z "$dir" && dir=.
  1017. X    if test -f $dir/$p; then
  1018. X      EMACS="$p"
  1019. X      break
  1020. X    fi
  1021. X  done
  1022. X  IFS="$saveifs"
  1023. Xfi
  1024. Xtest -z "$EMACS" && EMACS=""
  1025. X
  1026. Xtest -n "$EMACS" && break
  1027. Xdone
  1028. X
  1029. Xfor p in gnumake gmake make pmake
  1030. Xdo
  1031. Xif test -z "$MAKE"; then
  1032. X  echo checking for $p
  1033. X  saveifs="$IFS"; IFS="${IFS}:"
  1034. X  for dir in $PATH; do
  1035. X    test -z "$dir" && dir=.
  1036. X    if test -f $dir/$p; then
  1037. X      MAKE="$p"
  1038. X      break
  1039. X    fi
  1040. X  done
  1041. X  IFS="$saveifs"
  1042. Xfi
  1043. Xtest -z "$MAKE" && MAKE=""
  1044. X
  1045. Xtest -n "$MAKE" && break
  1046. Xdone
  1047. X
  1048. Xfor p in mkdir
  1049. Xdo
  1050. Xif test -z "$MKDIR"; then
  1051. X  echo checking for $p
  1052. X  saveifs="$IFS"; IFS="${IFS}:"
  1053. X  for dir in $PATH; do
  1054. X    test -z "$dir" && dir=.
  1055. X    if test -f $dir/$p; then
  1056. X      MKDIR="$p"
  1057. X      break
  1058. X    fi
  1059. X  done
  1060. X  IFS="$saveifs"
  1061. Xfi
  1062. Xtest -z "$MKDIR" && MKDIR=""
  1063. X
  1064. Xtest -n "$MKDIR" && break
  1065. Xdone
  1066. X
  1067. Xfor p in mv
  1068. Xdo
  1069. Xif test -z "$MV"; then
  1070. X  echo checking for $p
  1071. X  saveifs="$IFS"; IFS="${IFS}:"
  1072. X  for dir in $PATH; do
  1073. X    test -z "$dir" && dir=.
  1074. X    if test -f $dir/$p; then
  1075. X      MV="$p"
  1076. X      break
  1077. X    fi
  1078. X  done
  1079. X  IFS="$saveifs"
  1080. Xfi
  1081. Xtest -z "$MV" && MV=""
  1082. X
  1083. Xtest -n "$MV" && break
  1084. Xdone
  1085. X
  1086. Xfor p in sed
  1087. Xdo
  1088. Xif test -z "$SED"; then
  1089. X  echo checking for $p
  1090. X  saveifs="$IFS"; IFS="${IFS}:"
  1091. X  for dir in $PATH; do
  1092. X    test -z "$dir" && dir=.
  1093. X    if test -f $dir/$p; then
  1094. X      SED="$p"
  1095. X      break
  1096. X    fi
  1097. X  done
  1098. X  IFS="$saveifs"
  1099. Xfi
  1100. Xtest -z "$SED" && SED=""
  1101. X
  1102. Xtest -n "$SED" && break
  1103. Xdone
  1104. X
  1105. Xfor p in sh bash ksh
  1106. Xdo
  1107. Xif test -z "$SH"; then
  1108. X  echo checking for $p
  1109. X  saveifs="$IFS"; IFS="${IFS}:"
  1110. X  for dir in $PATH; do
  1111. X    test -z "$dir" && dir=.
  1112. X    if test -f $dir/$p; then
  1113. X      SH="$p"
  1114. X      break
  1115. X    fi
  1116. X  done
  1117. X  IFS="$saveifs"
  1118. Xfi
  1119. Xtest -z "$SH" && SH=""
  1120. X
  1121. Xtest -n "$SH" && break
  1122. Xdone
  1123. X
  1124. X
  1125. Xfor p in gnutar gtar tar
  1126. Xdo
  1127. Xif test -z "$PROG_TAR"; then
  1128. X  echo checking for $p
  1129. X  saveifs="$IFS"; IFS="${IFS}:"
  1130. X  for dir in $PATH; do
  1131. X    test -z "$dir" && dir=.
  1132. X    if test -f $dir/$p; then
  1133. X      PROG_TAR="$p"
  1134. X      break
  1135. X    fi
  1136. X  done
  1137. X  IFS="$saveifs"
  1138. Xfi
  1139. Xtest -z "$PROG_TAR" && PROG_TAR=""
  1140. X
  1141. Xtest -n "$PROG_TAR" && break
  1142. Xdone
  1143. X
  1144. Xif test -z "$PROG_TAR"; then
  1145. X    echo " prog tar not found. aborting ..."
  1146. X    exit 1;
  1147. Xfi
  1148. X
  1149. Xfor p in cmp
  1150. Xdo
  1151. Xif test -z "$PROG_CMP"; then
  1152. X  echo checking for $p
  1153. X  saveifs="$IFS"; IFS="${IFS}:"
  1154. X  for dir in $PATH; do
  1155. X    test -z "$dir" && dir=.
  1156. X    if test -f $dir/$p; then
  1157. X      PROG_CMP="$p"
  1158. X      break
  1159. X    fi
  1160. X  done
  1161. X  IFS="$saveifs"
  1162. Xfi
  1163. Xtest -z "$PROG_CMP" && PROG_CMP=""
  1164. X
  1165. Xtest -n "$PROG_CMP" && break
  1166. Xdone
  1167. X
  1168. Xif test -z "$PROG_CMP"; then
  1169. X    echo You do not seem to have an equivalent to cmp. aborting...
  1170. X    exit 1
  1171. Xelse 
  1172. X    if $PROG_CMP Makefile.in Makefile.in; then
  1173. X        if $PROG_CMP Makefile.in COPYING >& /dev/null; then
  1174. X            echo $PROG_CMP does not work as expected. aborting...
  1175. X            exit 1
  1176. X        else
  1177. X            echo $PROG_CMP works as expected
  1178. X        fi
  1179. X    else
  1180. X        echo $PROG_CMP does not work as expected. aborting...
  1181. X        exit 1
  1182. X    fi
  1183. Xfi
  1184. X
  1185. Xfor p in mount_tfs
  1186. Xdo
  1187. Xif test -z "$PROG_MOUNT_TFS"; then
  1188. X  echo checking for $p
  1189. X  saveifs="$IFS"; IFS="${IFS}:"
  1190. X  for dir in $PATH; do
  1191. X    test -z "$dir" && dir=.
  1192. X    if test -f $dir/$p; then
  1193. X      PROG_MOUNT_TFS="$p"
  1194. X      break
  1195. X    fi
  1196. X  done
  1197. X  IFS="$saveifs"
  1198. Xfi
  1199. Xtest -z "$PROG_MOUNT_TFS" && PROG_MOUNT_TFS=""
  1200. X
  1201. Xtest -n "$PROG_MOUNT_TFS" && break
  1202. Xdone
  1203. X
  1204. Xfor p in umount_tfs
  1205. Xdo
  1206. Xif test -z "$PROG_UMOUNT_TFS"; then
  1207. X  echo checking for $p
  1208. X  saveifs="$IFS"; IFS="${IFS}:"
  1209. X  for dir in $PATH; do
  1210. X    test -z "$dir" && dir=.
  1211. X    if test -f $dir/$p; then
  1212. X      PROG_UMOUNT_TFS="$p"
  1213. X      break
  1214. X    fi
  1215. X  done
  1216. X  IFS="$saveifs"
  1217. Xfi
  1218. Xtest -z "$PROG_UMOUNT_TFS" && PROG_UMOUNT_TFS=""
  1219. X
  1220. Xtest -n "$PROG_UMOUNT_TFS" && break
  1221. Xdone
  1222. X
  1223. XCONF_HAVE_TFS=0;
  1224. Xif test -z "$PROG_MOUNT_TFS"; then
  1225. X    echo "TFS doesn't seem to be supported on your system, but it's ok."
  1226. Xelse
  1227. X    CONF_HAVE_TFS=1;
  1228. X    echo "TFS seems to be supported on your system."
  1229. Xfi
  1230. X
  1231. X
  1232. Xfor p in hostname uname
  1233. Xdo
  1234. Xif test -z "$PROG_HOSTNAME"; then
  1235. X  echo checking for $p
  1236. X  saveifs="$IFS"; IFS="${IFS}:"
  1237. X  for dir in $PATH; do
  1238. X    test -z "$dir" && dir=.
  1239. X    if test -f $dir/$p; then
  1240. X      PROG_HOSTNAME="$p"
  1241. X      break
  1242. X    fi
  1243. X  done
  1244. X  IFS="$saveifs"
  1245. Xfi
  1246. Xtest -z "$PROG_HOSTNAME" && PROG_HOSTNAME=""
  1247. X
  1248. Xtest -n "$PROG_HOSTNAME" && break
  1249. Xdone
  1250. X
  1251. XCONF_HAVE_HOSTNAME=0;
  1252. Xif test -z "$PROG_HOSTNAME"; then
  1253. X    echo "No way to identify the hostname"
  1254. Xelse
  1255. X    DEFS="$DEFS -DCONF_HAVE_HOSTNAME=1"
  1256. X    case "$PROG_HOSTNAME" in
  1257. X    hostname) 
  1258. X        CONF_HAVE_HOSTNAME=1;  
  1259. X        ;;
  1260. X    uname) 
  1261. X         CONF_HAVE_HOSTNAME=1;
  1262. X        PROG_HOSTNAME='uname -n';
  1263. X        ;;
  1264. X    *)        ;; 
  1265. X    esac
  1266. Xfi
  1267. X
  1268. X
  1269. X
  1270. Xfor p in domainname
  1271. Xdo
  1272. Xif test -z "$PROG_DOMAINNAME"; then
  1273. X  echo checking for $p
  1274. X  saveifs="$IFS"; IFS="${IFS}:"
  1275. X  for dir in $PATH; do
  1276. X    test -z "$dir" && dir=.
  1277. X    if test -f $dir/$p; then
  1278. X      PROG_DOMAINNAME="$p"
  1279. X      break
  1280. X    fi
  1281. X  done
  1282. X  IFS="$saveifs"
  1283. Xfi
  1284. Xtest -z "$PROG_DOMAINNAME" && PROG_DOMAINNAME=""
  1285. X
  1286. Xtest -n "$PROG_DOMAINNAME" && break
  1287. Xdone
  1288. X
  1289. XCONF_HAVE_DOMAINNAME=0;
  1290. Xif test -z "$PROG_DOMAINNAME"; then
  1291. X    echo "No way to identify the domain name"
  1292. Xelse
  1293. X    case "$PROG_DOMAINNAME" in
  1294. X    domainname)
  1295. X        CONF_HAVE_DOMAINNAME=1;
  1296. X        ;;
  1297. X    *)      ;;
  1298. X    esac
  1299. Xfi
  1300. X
  1301. X
  1302. X
  1303. Xfor p in catman makewhatis
  1304. Xdo
  1305. Xif test -z "$PROG_MAKEWHATIS"; then
  1306. X  echo checking for $p
  1307. X  saveifs="$IFS"; IFS="${IFS}:"
  1308. X  for dir in $PATH; do
  1309. X    test -z "$dir" && dir=.
  1310. X    if test -f $dir/$p; then
  1311. X      PROG_MAKEWHATIS="$p"
  1312. X      break
  1313. X    fi
  1314. X  done
  1315. X  IFS="$saveifs"
  1316. Xfi
  1317. Xtest -z "$PROG_MAKEWHATIS" && PROG_MAKEWHATIS=""
  1318. X
  1319. Xtest -n "$PROG_MAKEWHATIS" && break
  1320. Xdone
  1321. X
  1322. Xcase "$PROG_MAKEWHATIS" in
  1323. Xcatman) PROG_MAKEWHATIS='catman -w -M'
  1324. X    ;;
  1325. X*makewhatis)
  1326. X    ;;
  1327. X*)    echo 'Did not find the application to rebuild the whatis database.'
  1328. X    exit 1
  1329. X    ;;
  1330. Xesac
  1331. X
  1332. X
  1333. Xecho
  1334. Xecho 'What is the path for you system manpaths?'
  1335. Xecho 'This should not have local man (typicaly in /usr/local/man)'
  1336. Xecho 'This should be a ':' seperated list [/usr/man]:'
  1337. Xread CONF_SYS_MAN_PATH
  1338. Xif test -z "$CONF_SYS_MAN_PATH"; then
  1339. X    CONF_SYS_MAN_PATH='/usr/man'
  1340. Xfi
  1341. Xecho
  1342. X
  1343. X
  1344. Xecho checking for symlink
  1345. Xecho "
  1346. Xmain() { exit(0); } t() { 
  1347. X/* Override any gcc2 internal prototype to avoid an error.  */
  1348. Xextern char symlink(); symlink(); }" > conftest.c
  1349. Xif eval $compile; then
  1350. X  echo  Your system seems to support symbolic links. 
  1351. Xelse
  1352. X  echo  Your system does not seem to support symbolic links.
  1353. X  echo That is bad because you need it. Aborting...
  1354. X  exit 1; 
  1355. Xfi
  1356. Xrm -f conftest*
  1357. X
  1358. X
  1359. Xecho
  1360. Xecho 'What is the class of the current machine?:'
  1361. Xread FIRST_CLASS
  1362. Xecho
  1363. X
  1364. X
  1365. X
  1366. Xecho
  1367. Xecho 'What are the other classes that the current machine'
  1368. Xecho 'can be identified with? (list of classes seprated'
  1369. Xecho 'with blanks):'
  1370. Xread OTHER_CLASSES
  1371. Xecho
  1372. X
  1373. X
  1374. Xecho
  1375. Xecho 'What is the location where lude should be installed?'
  1376. Xecho '(the path should be of the form:'
  1377. Xecho '  /usr/local/soft/lude-someversion/run/somemod/somclass):'
  1378. Xread PREFIX
  1379. Xecho
  1380. X
  1381. X
  1382. Xecho
  1383. Xecho 'What language do you want to be the default?'
  1384. Xecho 'Possible choices are francais or english'
  1385. Xecho '(francais|english) [english]'
  1386. Xread CONF_LANG_DEFAULT
  1387. Xif test -z "$CONF_LANG_DEFAULT"; then
  1388. X    CONF_LANG_DEFAULT='english'
  1389. Xfi
  1390. Xcase "$CONF_LANG_DEFAULT" in
  1391. Xfrancais) CONF_LANG_DEFAULT_ABREV='fra'
  1392. X    ;;
  1393. Xenglish)  CONF_LANG_DEFAULT_ABREV='eng'
  1394. X    ;;
  1395. Xesac
  1396. Xecho
  1397. X
  1398. X
  1399. X
  1400. Xecho
  1401. Xecho 'What language(s) of the documentation do you want?'
  1402. Xecho 'Possible choices are fra for version francaise, and'
  1403. Xecho 'eng for english version. You can specify one or more'
  1404. Xecho 'seperated with blanks ( fra | eng ) [fra eng]'
  1405. Xread LANG_INFO
  1406. Xif test -z "$LANG_INFO"; then
  1407. X    LANG_INFO='fra eng'
  1408. Xfi
  1409. Xecho
  1410. X
  1411. X
  1412. XVERSION=`cat lude-version`
  1413. X
  1414. X
  1415. Xif test -n "$prefix"; then
  1416. X  test -z "$exec_prefix" && exec_prefix='$(prefix)'
  1417. X  prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  1418. Xfi
  1419. Xif test -n "$exec_prefix"; then
  1420. X  prsub="$prsub
  1421. Xs%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  1422. Xfi
  1423. X
  1424. Xtrap 'rm -f config.status; exit 1' 1 3 15
  1425. Xecho creating config.status
  1426. Xrm -f config.status
  1427. Xcat <<EOF > config.status
  1428. X#!/bin/sh
  1429. X# Generated automatically by configure.
  1430. X# Run this file to recreate the current configuration.
  1431. X# This directory was configured as follows,
  1432. X# on host `(hostname || uname -n) 2>/dev/null`:
  1433. X#
  1434. X# $0 $*
  1435. X
  1436. Xcase "\$1" in
  1437. X  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1438. X  exec /bin/sh $0 $* ;;
  1439. Xesac
  1440. X
  1441. Xtrap 'rm -f Makefile src/Makefile src/config.pl info/Makefile lang/Makefile html/Makefile; exit 1' 1 3 15
  1442. XCAT='$CAT'
  1443. XCHMOD='$CHMOD'
  1444. XCOMPRESS='$COMPRESS'
  1445. XCP='$CP'
  1446. XECHO='$ECHO'
  1447. XEMACS='$EMACS'
  1448. XMAKE='$MAKE'
  1449. XMKDIR='$MKDIR'
  1450. XMV='$MV'
  1451. XSED='$SED'
  1452. XSH='$SH'
  1453. XPROG_TAR='$PROG_TAR'
  1454. XPROG_CMP='$PROG_CMP'
  1455. XPROG_MOUNT_TFS='$PROG_MOUNT_TFS'
  1456. XPROG_UMOUNT_TFS='$PROG_UMOUNT_TFS'
  1457. XCONF_HAVE_TFS='$CONF_HAVE_TFS'
  1458. XPROG_HOSTNAME='$PROG_HOSTNAME'
  1459. XCONF_HAVE_HOSTNAME='$CONF_HAVE_HOSTNAME'
  1460. XPROG_DOMAINNAME='$PROG_DOMAINNAME'
  1461. XPROG_DOMAINAME='$PROG_DOMAINAME'
  1462. XCONF_HAVE_DOMAINNAME='$CONF_HAVE_DOMAINNAME'
  1463. XPROG_MAKEWHATIS='$PROG_MAKEWHATIS'
  1464. XCONF_SYS_MAN_PATH='$CONF_SYS_MAN_PATH'
  1465. XFIRST_CLASS='$FIRST_CLASS'
  1466. XOTHER_CLASSES='$OTHER_CLASSES'
  1467. XPREFIX='$PREFIX'
  1468. XCONF_LANG_DEFAULT='$CONF_LANG_DEFAULT'
  1469. XCONF_LANG_DEFAULT_ABREV='$CONF_LANG_DEFAULT_ABREV'
  1470. XLANG_INFO='$LANG_INFO'
  1471. XVERSION='$VERSION'
  1472. XLIBS='$LIBS'
  1473. Xsrcdir='$srcdir'
  1474. XDEFS='$DEFS'
  1475. Xprefix='$prefix'
  1476. Xexec_prefix='$exec_prefix'
  1477. Xprsub='$prsub'
  1478. XEOF
  1479. Xcat <<\EOF >> config.status
  1480. X
  1481. Xtop_srcdir=$srcdir
  1482. Xfor file in Makefile src/Makefile src/config.pl info/Makefile lang/Makefile html/Makefile; do
  1483. X  srcdir=$top_srcdir
  1484. X  # Remove last slash and all that follows it.  Not all systems have dirname.
  1485. X  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1486. X  if test "$dir" != "$file"; then
  1487. X    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1488. X    test ! -d $dir && mkdir $dir
  1489. X  fi
  1490. X  echo creating $file
  1491. X  rm -f $file
  1492. X  echo "# Generated automatically from `basename $file`.in by configure." > $file
  1493. X  sed -e "
  1494. X$prsub
  1495. Xs%@CAT@%$CAT%g
  1496. Xs%@CHMOD@%$CHMOD%g
  1497. Xs%@COMPRESS@%$COMPRESS%g
  1498. Xs%@CP@%$CP%g
  1499. Xs%@ECHO@%$ECHO%g
  1500. Xs%@EMACS@%$EMACS%g
  1501. Xs%@MAKE@%$MAKE%g
  1502. Xs%@MKDIR@%$MKDIR%g
  1503. Xs%@MV@%$MV%g
  1504. Xs%@SED@%$SED%g
  1505. Xs%@SH@%$SH%g
  1506. Xs%@PROG_TAR@%$PROG_TAR%g
  1507. Xs%@PROG_CMP@%$PROG_CMP%g
  1508. Xs%@PROG_MOUNT_TFS@%$PROG_MOUNT_TFS%g
  1509. Xs%@PROG_UMOUNT_TFS@%$PROG_UMOUNT_TFS%g
  1510. Xs%@CONF_HAVE_TFS@%$CONF_HAVE_TFS%g
  1511. Xs%@PROG_HOSTNAME@%$PROG_HOSTNAME%g
  1512. Xs%@CONF_HAVE_HOSTNAME@%$CONF_HAVE_HOSTNAME%g
  1513. Xs%@PROG_DOMAINNAME@%$PROG_DOMAINNAME%g
  1514. Xs%@PROG_DOMAINAME@%$PROG_DOMAINAME%g
  1515. Xs%@CONF_HAVE_DOMAINNAME@%$CONF_HAVE_DOMAINNAME%g
  1516. Xs%@PROG_MAKEWHATIS@%$PROG_MAKEWHATIS%g
  1517. Xs%@CONF_SYS_MAN_PATH@%$CONF_SYS_MAN_PATH%g
  1518. Xs%@FIRST_CLASS@%$FIRST_CLASS%g
  1519. Xs%@OTHER_CLASSES@%$OTHER_CLASSES%g
  1520. Xs%@PREFIX@%$PREFIX%g
  1521. Xs%@CONF_LANG_DEFAULT@%$CONF_LANG_DEFAULT%g
  1522. Xs%@CONF_LANG_DEFAULT_ABREV@%$CONF_LANG_DEFAULT_ABREV%g
  1523. Xs%@LANG_INFO@%$LANG_INFO%g
  1524. Xs%@VERSION@%$VERSION%g
  1525. Xs%@LIBS@%$LIBS%g
  1526. Xs%@srcdir@%$srcdir%g
  1527. Xs%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
  1528. Xdone
  1529. X
  1530. XEOF
  1531. Xchmod +x config.status
  1532. Xtest -n "$no_create" || ./config.status
  1533. X
  1534. END_OF_FILE
  1535.   if test 16069 -ne `wc -c <'lude-1.1/src/orig/configure'`; then
  1536.     echo shar: \"'lude-1.1/src/orig/configure'\" unpacked with wrong size!
  1537.   fi
  1538.   chmod +x 'lude-1.1/src/orig/configure'
  1539.   # end of 'lude-1.1/src/orig/configure'
  1540. fi
  1541. if test -f 'lude-1.1/src/orig/html/diri_eng.UU' -a "${1}" != "-c" ; then 
  1542.   echo shar: Will not clobber existing file \"'lude-1.1/src/orig/html/diri_eng.UU'\"
  1543. else
  1544.   echo shar: Extracting \"'lude-1.1/src/orig/html/diri_eng.UU'\" \(822 characters\)
  1545.   sed "s/^X//" >'lude-1.1/src/orig/html/diri_eng.UU' <<'END_OF_FILE'
  1546. Xbegin 644 lude-1.1/src/orig/html/diri_eng.top
  1547. XM+2HM(%1E>'0@+2HM"E1H:7,@:7,@=&AE(&9I;&4@+BXN+VEN9F\O9&ER+"!W
  1548. XM:&EC:"!C;VYT86EN<R!T:&4@=&]P;6]S="!N;V1E(&]F('1H90I);F9O(&AI
  1549. XM97)A<F-H>2X@(%1H92!F:7)S="!T:6UE('EO=2!I;G9O:V4@26YF;R!Y;W4@
  1550. XM<W1A<G0@;V9F"FQO;VMI;F<@870@=&AA="!N;V1E+"!W:&EC:"!I<R H9&ER
  1551. XM*51O<"X*'PI&:6QE.B!D:7(L"4YO9&4Z(%1O< H@(%1H:7,@*'1H92!$:7)E
  1552. XM8W1O<GD@;F]D92D@9VEV97,@82!M96YU(&]F(&UA:F]R('1O<&EC<RX@"B @
  1553. XM5'EP:6YG(")D(B!R971U<FYS(&AE<F4L(")Q(B!E>&ET<RP@(C\B(&QI<W1S
  1554. XM(&%L;"!)3D9/(&-O;6UA;F1S+" B:"(@"B @9VEV97,@82!P<FEM97(@9F]R
  1555. XM(&9I<G-T+71I;65R<RP@(FU497AI;F9O/%)E='5R;CXB('9I<VET<R!497AI
  1556. XM;F9O('1O<&EC+ H@(&5T8RX*(" M+2T@4$Q%05-%($%$1"!$3T-5345.5$%4
  1557. XM24].(%1/(%1(25,@5%)%12X@*%-E92!)3D9/('1O<&EC(&9I<G-T+BD@+2TM
  1558. XM"@HJ($UE;G4Z(%1H92!L:7-T(&]F(&UA:F]R('1O<&EC<R!B96=I;G,@;VX@
  1559. X0=&AE(&YE>'0@;&EN92X*"G-T
  1560. Xend
  1561. END_OF_FILE
  1562.   if test 822 -ne `wc -c <'lude-1.1/src/orig/html/diri_eng.UU'`; then
  1563.     echo shar: \"'lude-1.1/src/orig/html/diri_eng.UU'\" unpacked with wrong size!
  1564.   else
  1565.     echo shar: Uudecoding \"'lude-1.1/src/orig/html/diri_eng.top'\" \(556 characters\)
  1566.      cat lude-1.1/src/orig/html/diri_eng.UU | uudecode
  1567.      if test 556 -ne `wc -c <'lude-1.1/src/orig/html/diri_eng.top'`; then
  1568.        shar: \"'FILENAME'\" uudecoded with wrong size!
  1569.     else
  1570.       rm lude-1.1/src/orig/html/diri_eng.UU
  1571.     fi
  1572.   fi
  1573.   # end of 'lude-1.1/src/orig/html/diri_eng.UU'
  1574. fi
  1575. if test -f 'lude-1.1/src/orig/src/ludeadm' -a "${1}" != "-c" ; then 
  1576.   echo shar: Will not clobber existing file \"'lude-1.1/src/orig/src/ludeadm'\"
  1577. else
  1578.   echo shar: Extracting \"'lude-1.1/src/orig/src/ludeadm'\" \(22013 characters\)
  1579.   sed "s/^X//" >'lude-1.1/src/orig/src/ludeadm' <<'END_OF_FILE'
  1580. X#!/usr/local/bin/perl
  1581. X
  1582. X# ludeadm - Project lude.
  1583. X# Copyright (C) 1991, 1992  Pierre Laplante
  1584. X# Copyright (C) 1992,1993 Stephane Boucher, Ecole Polytechnique de Montreal.
  1585. X#
  1586. X# This program is free software; you can redistribute it and/or modify
  1587. X# it under the terms of the GNU General Public License as published by
  1588. X# the Free Software Foundation; either version 1, or (at your option)
  1589. X# any later version.
  1590. X#
  1591. X# This program is distributed in the hope that it will be useful,
  1592. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1593. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1594. X# GNU General Public License for more details.
  1595. X#
  1596. X# You should have received a copy of the GNU General Public License
  1597. X# along with this program; if not, write to the Free Software
  1598. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1599. X
  1600. X$FULL_VERSION=
  1601. X    "-- ludeadm --\n" .
  1602. X    "This is part of LUDE (Logitheque Universitaire Distribuee et Extensible)\n\n";
  1603. X
  1604. X$FULL_VERSION.= '$Id: ludeadm,v 1.4 1993/03/17 14:56:49 sbo Exp $' ."\n";
  1605. X
  1606. X$VERSION='%VERSION%';
  1607. X
  1608. X#-----------------------------------------------------------------------
  1609. X#
  1610. X#    Globals definitions
  1611. X#
  1612. X
  1613. X$PL_INCDIR="%PL_INCDIR%";
  1614. X$LANG_PATH="%LANG_PATH%:../lang";
  1615. X$LUDE_MODIF_FILE_TMPL="%LUDE_MODIF_FILE_TMPL%";
  1616. X$LUDE_CLASS_FILE_TMPL="%LUDE_CLASS_FILE_TMPL%";
  1617. X$IAFA_FILE_TMPL="%IAFA_FILE_TMPL%";
  1618. X
  1619. X
  1620. X#-----------------------------------------------------------------------
  1621. X#
  1622. X#    Main program
  1623. X#
  1624. X
  1625. Xmain: {
  1626. X    local($exitval)=0;        # Success by default
  1627. X    local($cmdsToDo);
  1628. X
  1629. X    unshift(@INC, split(/:/, $PL_INCDIR));
  1630. X
  1631. X    require('config.pl');
  1632. X
  1633. X    # Load and initialise the language support immediatly so
  1634. X    # that the messages are available the soonest possible.
  1635. X    # If an error occure in this phase, the execution is 
  1636. X    # immediatly aborted.
  1637. X    require('ludelang.pl');
  1638. X    &InitLang($CONF_LANG_DEFAULT, $LANG_PATH, 'ludemisc', @ARGV);
  1639. X    &InitLang($CONF_LANG_DEFAULT, $LANG_PATH, 'ludeadm', @ARGV);
  1640. X
  1641. X    require('ludemisc');
  1642. X    require('ludeadminc');
  1643. X    require('BldRegexpMinRqr.pl');
  1644. X    require('fileutil.pl');
  1645. X
  1646. X    if (! &VerifySystem) {
  1647. X    $exitval=1;
  1648. X    }
  1649. X    elsif (($cmdsToDo=&Initialisation) < 0) {
  1650. X    $exitval=2;
  1651. X    }
  1652. X    # If any command(s) left to be executed
  1653. X    elsif ($cmdsToDo > 0) {
  1654. X    if (! &ExecCommands) {
  1655. X        $exitval=3;
  1656. X    }
  1657. X    }
  1658. X
  1659. X    exit $exitval;
  1660. X}
  1661. X
  1662. X
  1663. X#-----------------------------------------------------------------------
  1664. X# Description  : Create the directories structure for the given
  1665. X#                location/soft/mod/class. If a base tree is not
  1666. X#                already present, one is created.
  1667. X# 
  1668. X# Parameters   : $server - server location to perform the action.
  1669. X#                          if eq '/', then $SOFT_DIR is used.
  1670. X#                $soft   - software on which to perform the action.
  1671. X#                $mod    - modification  ...
  1672. X#                $class  - class  ...
  1673. X#
  1674. X# Returns      : 1 on success
  1675. X#                0 if any errors
  1676. X#
  1677. Xsub Create {
  1678. X    if (scalar(@_)!=4) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  1679. X    local($server, $soft, $mod, $class)=@_;
  1680. X    local($path);
  1681. X    local($retval)=1;        # success by default
  1682. X
  1683. X    $path=($server ne '/') ? "$SERVER_DIR/$server/$soft" : "$SOFT_DIR/$soft";
  1684. X
  1685. X    #
  1686. X    # Unlink the sections if it is a link
  1687. X    #
  1688. X    for $section ('run', 'src') {
  1689. X      if (-l "$path/$section") {
  1690. X    if (&VerboseRetShow($WARN_CMD, "unlink $path/$section")) {
  1691. X      # Showing, so do nothing
  1692. X    }
  1693. X    elsif (! unlink("$path/$section")) {
  1694. X      &NFError($ERR_UNLINK, "$path/$section");
  1695. X      $retval=0;
  1696. X    }
  1697. X      }
  1698. X    }
  1699. X
  1700. X    #
  1701. X    # Create the directory Hierarchy
  1702. X    #
  1703. X    if ($retval) {        # If still no error
  1704. X      for $d ("$path",
  1705. X          "$path/src", "$path/src/orig", "$path/src/$mod", 
  1706. X          "$path/run", "$path/run/share",
  1707. X          "$path/run/$mod", "$path/run/$mod/share", 
  1708. X          "$path/run/$mod/$class", 
  1709. X          "$path/install", "$path/install/share",
  1710. X          "$path/install/$mod", "$path/install/$mod/share", 
  1711. X          "$path/install/$mod/$class") { 
  1712. X    if (! -d $d) {
  1713. X      if (&VerboseRetShow($WARN_CMD, "mkdir $d")) {
  1714. X        # Showing, so do nothing
  1715. X      }
  1716. X      elsif (! mkdir($d, 0755)) {
  1717. X        &NFError($ERR_MKDIR, "$d"); 
  1718. X        $retval=0;
  1719. X      }
  1720. X    }
  1721. X      }
  1722. X    }
  1723. X
  1724. X    if ($retval) {        # if still no error
  1725. X
  1726. X      # Test for the presence of a LUDE file template
  1727. X      stat("$IAFA_FILE_TMPL");
  1728. X      if (! -e _) {        # Template does not exist
  1729. X    &NFError($ERR_FILE, $IAFA_FILE_TMPL);
  1730. X    $retval=0;
  1731. X      }
  1732. X      elsif (! -r _) {        # Template is not readable
  1733. X    &NFError($ERR_NO_R_PERM, $IAFA_FILE_TMPL);
  1734. X    $retval=0;
  1735. X      }
  1736. X      else {            # Still no error
  1737. X    # Adding IAFA templates if none is present
  1738. X    if (! -e "$path/install/$IAFA_FILE") {    
  1739. X      if (&VerboseRetShow($WARN_CMD,
  1740. X                  "cp $IAFA_FILE_TMPL $path/install/$IAFA_FILE")) {
  1741. X        # Showing, so do nothing
  1742. X      }
  1743. X      else {
  1744. X        if (! &CopyFile($IAFA_FILE_TMPL, "$path/install/$IAFA_FILE")) {
  1745. X          $retval=0;    # Error while copying
  1746. X        }
  1747. X      }
  1748. X    }
  1749. X      }
  1750. X
  1751. X      # Test for the presence of a LUDE_CLASS file template
  1752. X      stat("$LUDE_CLASS_FILE_TMPL");
  1753. X      if (! -e _) {        # Template does not exist
  1754. X    &NFError($ERR_FILE, $LUDE_CLASS_FILE_TMPL);
  1755. X    $retval=0;
  1756. X      }
  1757. X      elsif (! -r _) {        # Template is not readable
  1758. X    &NFError($ERR_NO_R_PERM, $LUDE_CLASS_FILE_TMPL);
  1759. X    $retval=0;
  1760. X      }
  1761. X      else {            # Still no error
  1762. X    # Adding LUDE templates if none is present
  1763. X    # The file is named in such way that it is locked
  1764. X    if (! -e "$path/install/$LUDE_FILE") {    
  1765. X      if (&VerboseRetShow($WARN_CMD,
  1766. X                  "cp $LUDE_CLASS_FILE_TMPL $path/install/$mod/$class/$LUDE_FILE.lock")) {
  1767. X        # Showing, so do nothing
  1768. X      }
  1769. X      else {
  1770. X        if (! &CopyFile($LUDE_CLASS_FILE_TMPL, "$path/install/$mod/$class/$LUDE_FILE.lock")) {
  1771. X          $retval=0;    # Error while copying
  1772. X        }
  1773. X      }
  1774. X    }
  1775. X      }
  1776. X
  1777. X      # Test for the presence of a LUDE_MODIF file template
  1778. X      stat("$LUDE_MODIF_FILE_TMPL");
  1779. X      if (! -e _) {        # Template does not exist
  1780. X    &NFError($ERR_FILE, $LUDE_MODIF_FILE_TMPL);
  1781. X    $retval=0;
  1782. X      }
  1783. X      elsif (! -r _) {        # Template is not readable
  1784. X    &NFError($ERR_NO_R_PERM, $LUDE_MODIF_FILE_TMPL);
  1785. X    $retval=0;
  1786. X      }
  1787. X      else {            # Still no error
  1788. X    # Adding LUDE templates if none is present
  1789. X    if (! -e "$path/install/$mod/$LUDE_FILE") {    
  1790. X      if (&VerboseRetShow($WARN_CMD,
  1791. X                  "cp $LUDE_MODIF_FILE_TMPL $path/install/$mod/$LUDE_FILE")) {
  1792. X        # Showing, so do nothing
  1793. X      }
  1794. X      else {
  1795. X        if (! &CopyFile($LUDE_MODIF_FILE_TMPL, "$path/install/$mod/$LUDE_FILE")) {
  1796. X          $retval=0;    # Error while copying
  1797. X        }
  1798. X      }
  1799. X    }
  1800. X      }
  1801. X    }
  1802. X
  1803. X    return $retval;
  1804. X}
  1805. X
  1806. X#-----------------------------------------------------------------------
  1807. X# Description  : Lock a soft/mod/class so that others can't
  1808. X#                install it.
  1809. X# 
  1810. X# Parameters   : $server - server location to perform the action.
  1811. X#                          if eq '/', then $SOFT_DIR is used.
  1812. X#                $soft   - software on which to perform the action.
  1813. X#                $mod    - modification  ...
  1814. X#                $class  - class  ...
  1815. X#
  1816. X# Returns      : 1 on success
  1817. X#                0 if any errors
  1818. X#
  1819. Xsub Lock {
  1820. X    if (scalar(@_)!=4) { &Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__)); }
  1821. X    local($server, $soft, $mod, $class)=@_;
  1822. X    local($path, $lockfile);
  1823. X    local($retval)=1;        # success by default
  1824. X
  1825. X    $path=($server ne'/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  1826. X
  1827. X    $lockfile="$path/$soft/install/$mod/$class/$LUDE_FILE";
  1828. X    
  1829. X    if (-e "$lockfile") {
  1830. X      if (-l "$path/$soft/install") {
  1831. X    &NFError($ERR_CANT_LOCK_BECAUSE_SYMLINK, "$path/$soft/install");
  1832. X    $retval=0;
  1833. X      }
  1834. X      else {
  1835. X    if (&VerboseRetShow($WARN_CMD, "rename $lockfile $lockfile.lock")) {
  1836. X      # Showing, so do nothing
  1837. X    }
  1838. X    else {
  1839. X      if (! rename($lockfile, "$lockfile.lock")) {
  1840. X        &NFError($ERR_REN, "$lockfile");
  1841. X        $retval=0;
  1842. X      }
  1843. X    }
  1844. X      }
  1845. X    }
  1846. X    else {
  1847. X      # Lock file is not there. Can't lock the software.
  1848. X      &NFError($ERR_CANT_LOCK_BECAUSE_NO_LOCK_FILE,
  1849. X           "$lockfile");
  1850. X      $retval=0;
  1851. X    }
  1852. X      
  1853. X
  1854. X    return $retval;
  1855. X}
  1856. X
  1857. X
  1858. X#-----------------------------------------------------------------------
  1859. X# Description  : Release a soft/mod/class so that others can
  1860. X#                Install it.
  1861. X# 
  1862. X# Parameters   : $server - server location to perform the action.
  1863. X#                          if eq '/', then $SOFT_DIR is used.
  1864. X#                $soft   - software on which to perform the action.
  1865. X#                $mod    - modification  ...
  1866. X#                $class  - class  ...
  1867. X#
  1868. X# Returns      : 1 on success
  1869. X#                0 if any errors
  1870. X#
  1871. Xsub Release {
  1872. X    if (scalar(@_)!=4){&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  1873. X    local($server, $soft, $mod, $class)=@_;
  1874. X    local($path, $lockdir, $lockfile);
  1875. X    local($retval)=1;        # Success by default
  1876. X
  1877. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  1878. X    $lockdir="$path/$soft/install/$mod/$class";
  1879. X    $lockfile="$lockdir/$LUDE_FILE";
  1880. X    
  1881. X    if (-e "$lockfile") {
  1882. X    # The unlock file is there, meaning that the software is
  1883. X    # already released! (confusing... the name of the variables
  1884. X    # will have to be changed one day).
  1885. X    }
  1886. X    elsif (! -e "$lockfile.lock") {
  1887. X      # The lock file is absent, therefore it is an error
  1888. X      &NFError($ERR_CANT_RELEASE_BECAUSE_NO_LOCK_FILE,
  1889. X           "$lockfile.lock");
  1890. X      $retval=0;
  1891. X    }
  1892. X    elsif (-l "$path/$soft/install") {
  1893. X      &NFError($ERR_CANT_RELEASE_BECAUSE_SYMLINK, "$path/$soft/install");
  1894. X      $retval=0;
  1895. X    }
  1896. X    elsif (! -w "$lockdir") {
  1897. X    &NFError($ERR_NO_W_PERM, "$lockdir");
  1898. X    $retval=0;
  1899. X    }
  1900. X    else {            # Everything is in order
  1901. X    if (&VerboseRetShow($WARN_CMD, "rename $lockfile.lock $lockfile")) {
  1902. X        # Showing, so do nothing
  1903. X    }
  1904. X    else {
  1905. X        local(*F);
  1906. X        if (! open(F, ">$lockfile")) {
  1907. X        &NFError($ERR_OPEN, "$lockfile");
  1908. X        $retval=0;
  1909. X        }
  1910. X        else {
  1911. X        close(F);
  1912. X        }
  1913. X    }
  1914. X    }
  1915. X    return $retval;
  1916. X}
  1917. X
  1918. X
  1919. X#-----------------------------------------------------------------------
  1920. X# Description  : do a Mount tfs of .../src/mod on .../src/orig
  1921. X# 
  1922. X# Parameters   : $server - server location to perform the action.
  1923. X#                          if eq '/', then $SOFT_DIR is used.
  1924. X#                $soft   - software on which to perform the action.
  1925. X#                $mod    - modification  ...
  1926. X#
  1927. X# Returns      : 1 on success
  1928. X#                0 if any errors
  1929. X#
  1930. Xsub Mount_tfs {
  1931. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  1932. X    local($server, $soft, $mod)=@_;
  1933. X    local($path);
  1934. X    local($retval)=1;        # Success by default
  1935. X
  1936. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";    
  1937. X    $path.= "/$soft/src";
  1938. X
  1939. X    if (-l $path) {
  1940. X      &NFError($ERR_CANT_MOUNT_TFS_BECAUSE_SYMLINK, $path);
  1941. X      $retval=0;
  1942. X    }
  1943. X    elsif (&RunCmd("$PROG_MOUNT_TFS $path/$mod $path/orig") != 0) {
  1944. X    # An error occured
  1945. X    $retval=0;
  1946. X    }
  1947. X
  1948. X    return $retval;
  1949. X}
  1950. X
  1951. X#-----------------------------------------------------------------------
  1952. X# Description  : do a UMount tfs of .../src/orig
  1953. X# 
  1954. X# Parameters   : $server - server location to perform the action.
  1955. X#                          if eq '/', then $SOFT_DIR is used.
  1956. X#                $soft   - software on which to perform the action.
  1957. X#                $mod    - modification  ...
  1958. X#
  1959. X# Returns      : 1 on success
  1960. X#                0 if any errors
  1961. X#
  1962. Xsub Umount_tfs {
  1963. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  1964. X    local($server, $soft, $mod)=@_;
  1965. X    local($path);
  1966. X    local($retval)=1;
  1967. X
  1968. X    $path=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  1969. X    $path.="/$soft/src";    
  1970. X
  1971. X    if (-l $path) {
  1972. X      &NFError($ERR_CANT_UMOUNT_TFS_BECAUSE_SYMLINK, $path);
  1973. X      $retval=0;
  1974. X    }
  1975. X    if (&RunCmd("$PROG_UMOUNT_TFS $path/orig") != 0) {
  1976. X    # An error occured
  1977. X    $retval=0;
  1978. X    }
  1979. X
  1980. X    return $retval;
  1981. X}
  1982. X
  1983. X#-----------------------------------------------------------
  1984. X# Description : Check to make sure that $soft/src is not a
  1985. X#               symlink. 
  1986. X#               Initiate the duplication of 
  1987. X#               $server/$soft/src/orig in 
  1988. X#               $server/$soft/src/$mod
  1989. X#
  1990. X# Parameters  : $server - specify the server where to 
  1991. X#                         perform the duplication
  1992. X#               $soft   - Specify the software to duplicate
  1993. X#               $mod    - specify the software's modification
  1994. X#                         to duplicate
  1995. X#
  1996. X# Returns     : 1 on success
  1997. X#               0 on error
  1998. X#
  1999. Xsub Duplicate {
  2000. X  if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  2001. X  local($server, $soft, $mod)=@_;
  2002. X  local($retval)=1;        # Success by default
  2003. X  
  2004. X  local($dir)=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  2005. X
  2006. X  if (-l "$dir/$soft/src") {
  2007. X    &NFError($ERR_CANT_DUPLICATE_BECAUSE_SYMLINK, "$dir/$soft/src");
  2008. X    $retval=0;
  2009. X  }
  2010. X  else {
  2011. X    local($origTree)="$dir/$soft/src/orig";
  2012. X    local($dupTree) ="$dir/$soft/src/$mod";
  2013. X
  2014. X    if (! &DupTree($origTree, $dupTree, '')) {
  2015. X      $retval=0;        # Error occured
  2016. X    }
  2017. X  }
  2018. X
  2019. X  return $retval;
  2020. X}
  2021. X
  2022. X#-----------------------------------------------------------
  2023. X# Description : Check to make sure that $soft/src is not a
  2024. X#               symlink. 
  2025. X#               Initiate the unduplication of 
  2026. X#               $server/$soft/src/orig in 
  2027. X#               $server/$soft/src/$mod
  2028. X#
  2029. X# Parameters  : $server - specify the server where to 
  2030. X#                         perform the unduplication
  2031. X#               $soft   - Specify the software to unduplicate
  2032. X#               $mod    - specify the software's modification
  2033. X#                         to unduplicate
  2034. X#
  2035. X# Returns     : 1 on success
  2036. X#               0 on error
  2037. X#
  2038. Xsub Unduplicate {
  2039. X  if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  2040. X  local($server, $soft, $mod)=@_;
  2041. X  local($retval)=1;        # Success by default
  2042. X  
  2043. X  local($dir)=($server ne '/') ? "$SERVER_DIR/$server" : "$SOFT_DIR";
  2044. X
  2045. X  if (-l "$dir/$soft/src") {
  2046. X    &NFError($ERR_CANT_UNDUPLICATE_BECAUSE_SYMLINK, "$dir/$soft/src");
  2047. X    $retval=0;
  2048. X  }
  2049. X  else {
  2050. X    local($origTree)="$dir/$soft/src/orig";
  2051. X    local($undupTree) ="$dir/$soft/src/$mod";
  2052. X
  2053. X    if (! &UnDupTree($origTree, $undupTree, '')) {
  2054. X      $retval=0;        # Error occured
  2055. X    }
  2056. X  }
  2057. X
  2058. X  return $retval;
  2059. X}
  2060. X
  2061. X#-----------------------------------------------------------------------
  2062. X# Description  : Duplicate the content of origTree in dupTree, with
  2063. X#                the following rules:
  2064. X#                - If the file is present in both tree, and
  2065. X#                  If the original file is more recent that the dupFile,
  2066. X#                  then the original file replaces the diff File.
  2067. X#                  (the time checked is the mtime i.e. last-modified)
  2068. X#                - If the file is only present in the original tree, it
  2069. X#                  is copied in the diff tree.
  2070. X#                (file in the present context refers to links, directory or
  2071. X#                 regular files)      
  2072. X# 
  2073. X# Parameters   : $origTree - root directory of tree of files that will be
  2074. X#                            be duplicated. (must be an absolute path)
  2075. X#                $dupTree  - root directory where to place the duplicated
  2076. X#                            files (must be an absolute path)
  2077. X#
  2078. X# Returns      : 1 on success
  2079. X#                0 if any errors
  2080. X#
  2081. Xsub DupTree {
  2082. X    if (scalar(@_)!=3) {&Error($ERR_INTERNAL,sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  2083. X    local($origTree, $dupTree, $suffix)=@_;
  2084. X    local($retval)=1;        # Success by default
  2085. X    local(@dupTreeStat, @origTreeStat);
  2086. X
  2087. X    if ($suffix ne '') {
  2088. X    $origTree.="/$suffix";
  2089. X    $dupTree.="/$suffix";
  2090. X    }
  2091. X    
  2092. X    @origTreeStat=lstat($origTree);
  2093. X    if ($origTree =~ m!^(([/.])|(\.\.))?$!) {
  2094. X    # '', '.', '..' or '/' are incorrect value for $origTree
  2095. X    &NFError($ERR_VALUE_DIR, $origTree);
  2096. X    $retval=0;
  2097. X    }
  2098. X    elsif ($dupTree =~ m!^(([/.])|(\.\.))?$!) {
  2099. X    # '', '.', '..' or '/' are incorrect value for $dupTree
  2100. X    &NFError($ERR_VALUE_DIR, $dupTree);
  2101. X    $retval=0;
  2102. X    }
  2103. X    elsif (! -e _) {
  2104. X    # origTree does not exist
  2105. X    &NFError($ERR_DIR, $origTree);
  2106. X    $retval=0;
  2107. X    }
  2108. X    elsif (! -d _) {
  2109. X    # Oups, should be a directory
  2110. X    &NFError($ERR_DIR_TYPE_EXPECTED, $origTree);
  2111. X    $retval=0;
  2112. X    }
  2113. X    elsif (! -r _) {
  2114. X    # Directory is not readable
  2115. X    &NFError($ERR_READ_DIR, $origTree);
  2116. X    $retval=0;
  2117. X    }
  2118. X    else {            # So far so good
  2119. X    
  2120. X    # Let's do some test on $dupTree now
  2121. X    @dupTreeStat=lstat($dupTree);
  2122. X
  2123. X    if (! -e _) {
  2124. X        # The dupTree directory does not exist, so
  2125. X        # simply recursively copy origTree in dupTree
  2126. X        # and everything is all done.
  2127. X
  2128. X        # Permissions of the original directory
  2129. X        local($origTreePerm)=$origTreeStat[2+$[];
  2130. X
  2131. X        # Create the directory and set the permission to the same
  2132. X        # permissions of origTree
  2133. X        if (&VerboseRetShow($WARN_CMD, "mkdir $dupTree")) {
  2134. X        # Showing, so do nothing
  2135. X        }
  2136. X        elsif (! mkdir($dupTree, $origTreePerm)) {
  2137. X        &NFError($ERR_MKDIR, $dupTree, $!);
  2138. X        $retval=0;
  2139. X        }
  2140. X        
  2141. X        if ($retval) {    # If still no error
  2142. X        # Check to see if any files in $origTree ...
  2143. X        local(*DIR, $numOfFiles);
  2144. X        opendir(DIR, $origTree);
  2145. X        $numOfFiles=grep(!/^\.{1,2}$/, readdir(DIR));
  2146. X        closedir(DIR);
  2147. X        if ($numOfFiles>0) { # i.e. if an files other than . and ..
  2148. X            local($cmd)="(cd $origTree; $PROG_TAR cf - *) | (cd $dupTree; $PROG_TAR -xpf -)";
  2149. X        
  2150. X            if (&RunCmd($cmd) != 0) {
  2151. X            # An error occured while executing the command
  2152. X            $retval=0;
  2153. X            }
  2154. X        }
  2155. X        }
  2156. X    }
  2157. X    elsif (! -d _) {
  2158. X        # dupTree is not a directory
  2159. X        &NFError($ERR_DIR_TYPE_EXPECTED, $dupTree);
  2160. X        $retval=0;
  2161. X    }
  2162. X    elsif (! -r _) {
  2163. X        # Directory is not readable
  2164. X        &NFError($ERR_READ_DIR, $dupTree);
  2165. X        $retval=0;
  2166. X    }
  2167. X    elsif (! -w _) {
  2168. X        # Directory is not writable
  2169. X        &NFError($ERR_WRITE_DIR, $dupTree);
  2170. X        $retval=0;
  2171. X    }
  2172. X    else {            # So far so good
  2173. X        local(@filesToCopy)=();
  2174. X        local(@files);
  2175. X        local($origFileMTime, $dupFileMTime);
  2176. X
  2177. X        local(*DIR);
  2178. X        opendir(DIR, $origTree);
  2179. X        @files=grep(!/^\.{1,2}$/, readdir(DIR));
  2180. X        closedir(DIR);
  2181. X
  2182. X        foreach $file (@files) {
  2183. X        $dupFileMTime=(lstat("$dupTree/$file"))[9+$[];
  2184. X        # Warning! stat on origTree/file must be last,
  2185. X        # because we will use _ for speed
  2186. X        $origFileMTime=(lstat("$origTree/$file"))[9+$[];
  2187. X
  2188. X        if (-d _) {
  2189. X            if (! &DupTree($origTree, $dupTree, $file)) {
  2190. X            $retval=0; # An error occured
  2191. X            }
  2192. X        }
  2193. X        # If the file does not exist in dupTree or
  2194. X        # if the last-modified time of the file in origTree
  2195. X        # is more recent than the last-modified time of
  2196. X        # the file in dupTree, add the file to the list
  2197. X        # of files to copy.
  2198. X        elsif (! -e "$dupTree/$file" ||
  2199. X               $origFileMTime > $dupFileMTime) {
  2200. X            push(@filesToCopy, $file);
  2201. X        }    
  2202. X        }
  2203. X
  2204. X        # Now copy the files
  2205. X        # (This will most probably need to be optimized)
  2206. X        local($cmd)="(cd $origTree; $PROG_TAR cf - %s) | (cd $dupTree; $PROG_TAR -xpf -)";
  2207. X
  2208. X        # Copy each file, one by one
  2209. X        foreach $file (@filesToCopy) {
  2210. X        if (&RunCmd(sprintf($cmd, $file)) != 0) {
  2211. X            $retval=0;    # An error occured
  2212. X        }
  2213. X        }
  2214. X    }
  2215. X    }
  2216. X    return $retval;
  2217. X}
  2218. X
  2219. X#-----------------------------------------------------------------------
  2220. X# Description  : 
  2221. X# 
  2222. X# Parameters   : 
  2223. X#                
  2224. X# Returns      : 1 on success
  2225. X#                0 if any errors
  2226. X#
  2227. Xsub UnDupTree {
  2228. X    if (scalar(@_)!=3){&Error($ERR_INTERNAL, sprintf("(%d), %s:%d", scalar(@_), __FILE__, __LINE__));}
  2229. X    local($origTree, $dupTree, $suffix)=@_;
  2230. X    local($retval)=1;        # Success by default
  2231. X    local(@origTreeStat, @dupTreeStat);
  2232. X
  2233. X    if ($suffix ne '') {
  2234. X    $origTree.="/$suffix";
  2235. X    $dupTree.="/$suffix";
  2236. X    }
  2237. X
  2238. X    @origTreeStat=stat($origTree);
  2239. X    if (! -e _) {
  2240. X    # origTree does not exist
  2241. X    &NFError($ERR_DIR, $origTree);
  2242. X    $retval=0;
  2243. X    }
  2244. X    elsif (! -d _) {
  2245. X    # Oups, should be a directory
  2246. X    &NFError($ERR_DIR_TYPE_EXPECTED, $origTree);
  2247. X    $retval=0;
  2248. X    }
  2249. X    elsif (! -r _) {
  2250. X    # Directory is not readable
  2251. X    &NFError($ERR_READ_DIR, $origTree);
  2252. X    $retval=0;
  2253. X    }
  2254. X    else {            # So far so good
  2255. X    # Let's do some test on $dupTree now
  2256. X    @dupTreeStat=stat($dupTree);
  2257. X
  2258. X    if (! -e _) {
  2259. X        # The dupTree directory does not exist, so everything
  2260. X        # is fine. Nothing to do.
  2261. X    }
  2262. X    elsif (! -r _) {
  2263. X        # Directory is not readable
  2264. X        &NFError($ERR_READ_DIR, $dupTree);
  2265. X        $retval=0;
  2266. X    }
  2267. X    elsif (! -w _) {
  2268. X        # Directory is not writable
  2269. X        &NFError($ERR_WRITE_DIR, $dupTree);
  2270. X        $retval=0;
  2271. X    }
  2272. X    else {            # So far so good
  2273. X        local(@origFileStat, @dupFileStat);
  2274. X        local(@files);
  2275. X
  2276. X        local(*DIR);
  2277. X        opendir(DIR, $dupTree);
  2278. X        @files=grep(!/^\.{1,2}$/, readdir(DIR));
  2279. X        closedir(DIR);
  2280. X
  2281. X        foreach $file (@files) {
  2282. X        @dupFileStat=lstat("$dupTree/$file");
  2283. X        @origFileStat=lstat("$origTree/$file");
  2284. X
  2285. X        # if file exists in origTree and file mode is the same
  2286. X        # in origTree and dupTree.
  2287. X        if (-e _ && $dupFileStat[2+$[] == $origFileStat[2+$[]) {
  2288. X            if (-d _) {
  2289. X            if (! &UnDupTree($origTree, $dupTree, $file)) {
  2290. X                $retval=0; # An error occured
  2291. X            }
  2292. X            else {
  2293. X                # Remove the directory if it is empty.
  2294. X                local($numOfFiles);
  2295. X                local(*dir);
  2296. X                opendir(dir, "$dupTree/$file");
  2297. X                $numOfFiles=grep(!/^\.{1,2}$/, readdir(dir));
  2298. X                closedir(dir);
  2299. X                if ($numOfFiles == 0) {
  2300. X                if (&VerboseRetShow($WARN_CMD, "rmdir $dupTree/$file")) {
  2301. X                    # Showing, so do nothing.
  2302. X                }
  2303. X                else {
  2304. X                    if (! rmdir("$dupTree/$file")) {
  2305. X                    # rmdir failed
  2306. X                    &NFError($ERR_RMDIR, "$dupTree/$file", $!);
  2307. X                    $retval=0;
  2308. X                    }
  2309. X                }
  2310. X                }                    
  2311. X            }
  2312. X            }
  2313. X            elsif (-f _) {
  2314. X            # Compare the two files
  2315. X            if (system("$PROG_CMP -s $origTree/$file $dupTree/$file")/256 == 0) {
  2316. X                # Files are identical. Remove the file in $dupTree.
  2317. X                if (&VerboseRetShow($WARN_CMD, "unlink $dupTree/$file")) {
  2318. X                # Showing, so do nothing.
  2319. X                }
  2320. X                else {
  2321. X                if (unlink("$dupTree/$file") != 1) {
  2322. X                    # Unlink failed
  2323. X                    &NFError($ERR_UNLINK, "$dupTree/$file");
  2324. X                    $retval=0;
  2325. X                }
  2326. X                }
  2327. X            }
  2328. X            }
  2329. X            else {    # -l, -p, -S, -b, -c
  2330. X            # Leave the files as is
  2331. X            }
  2332. X        }
  2333. X        }
  2334. X    }
  2335. X    }
  2336. X
  2337. X    return $retval;
  2338. X}
  2339. X
  2340. X#     ;;; Local Variables: ***
  2341. X#     ;;; mode:perl ***
  2342. X#     ;;; End: ***
  2343. END_OF_FILE
  2344.   if test 22013 -ne `wc -c <'lude-1.1/src/orig/src/ludeadm'`; then
  2345.     echo shar: \"'lude-1.1/src/orig/src/ludeadm'\" unpacked with wrong size!
  2346.   fi
  2347.   chmod +x 'lude-1.1/src/orig/src/ludeadm'
  2348.   # end of 'lude-1.1/src/orig/src/ludeadm'
  2349. fi
  2350. echo shar: End of archive 8 \(of 12\).
  2351. cp /dev/null ark8isdone
  2352. MISSING=""
  2353. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  2354.     if test ! -f ark${I}isdone ; then
  2355.     MISSING="${MISSING} ${I}"
  2356.     fi
  2357. done
  2358. if test "${MISSING}" = "" ; then
  2359.     echo You have unpacked all 12 archives.
  2360.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2361. else
  2362.     echo You still must unpack the following archives:
  2363.     echo "        " ${MISSING}
  2364. fi
  2365. exit 0
  2366. exit 0 # Just in case...
  2367.