2 require "pwd.pl" || die "Required pwd.pl not found";
4 # This perl script automatically generates the idb file
11 $curdir = $ENV{"PWD"};
13 if ($PKG eq "samba_irix") {
14 open(BOOKS
,"IDB.books") || die "Unable to open IDB.books file\n";
15 @books = sort idbsort
<BOOKS
>;
19 # We don't want the files listed in .cvsignore in the source tree
20 open(IGNORES
,"$SRCDIR/source/.cvsignore") || die "Unable to open .cvsignore file\n";
28 # We don't want the files listed in .cvsignore in the source/include tree
29 open(IGNORES
,"$SRCDIR/source/include/.cvsignore") || die "Unable to open include/.cvsignore file\n";
36 # get the names of all the binary files to be installed
37 open(MAKEFILE
,"$SRCDIR/source/Makefile") || die "Unable to open Makefile\n";
38 while (not eof(MAKEFILE
)) {
41 last if /^# object file lists/ ;
50 if (/^SBIN_PROGS/) { @sbinprogs = get_line
($_); }
51 if (/^BIN_PROGS1/) { @binprogs1 = get_line
($_); }
52 if (/^BIN_PROGS2/) { @binprogs2 = get_line
($_); }
53 if (/^BIN_PROGS3/) { @binprogs3 = get_line
($_); }
54 if (/^BIN_PROGS/) { @binprogs = get_line
($_); }
55 if (/^SCRIPTS/) { @scripts = get_line
($_); }
56 if (/^TORTURE_PROGS/) { @tortureprogs = get_line
($_); }
57 if (/^SHLIBS/) { @shlibs = get_line
($_); }
61 # add my local files to the list of binaries to install
62 @bins = sort byfilename
(@sbinprogs,@binprogs,@binprogs1,@binprogs2,@binprogs3,@scripts,("sambalp","smbprint"));
64 @nsswitch = sort byfilename
(@shlibs);
66 # install the swat files
67 chdir "$SRCDIR/source";
68 system("chmod +x ./script/installswat.sh");
69 system("./script/installswat.sh ../packaging/SGI/swat ./ ../packaging/SGI/swat/using_samba");
70 system("cp -f ../swat/README ../packaging/SGI/swat");
73 # get a complete list of all files in the tree
78 # the files installed in docs include all the original files in docs plus all
79 # the "*.doc" files from the source tree
80 @docs = sort bynextdir
grep (!/CVS/ & (/^source\/.*\
.doc
$/ | /^docs\
/\w/),@allfiles);
81 @docs = grep(!/htmldocs/ & !/manpages/, @docs);
82 @docs = grep(!/docbook/, @docs);
84 @libfiles = sort byfilename
(grep (/^source\/codepages\
/\w/,@allfiles),("packaging/SGI/smb.conf","source/bin/libsmbclient.a","source/bin/libsmbclient.so"));
86 @swatfiles = sort grep(/^packaging\/SGI\
/swat/, @allfiles);
87 @catman = sort grep(/^packaging\/SGI\
/catman/ & !/\/$/, @allfiles);
88 @catman = sort bydirnum
@catman;
90 # strip out all the generated directories and the "*.o" files from the source
92 @allfiles = grep(!/^.*\.o$/ & !/^.*\.po$/ & !/^.*\.po32$/ & !/^.*\.so$/ & !/^source\/bin
/ & !/^packaging\
/SGI\/bins
/ & !/^packaging\
/SGI\
/catman/ & !/^packaging\/SGI\
/html/ & !/^packaging\/SGI\
/codepages/ & !/^packaging\/SGI\
/swat/, @allfiles);
94 open(IDB
,"> $curdir/$PKG.idb") || die "Unable to open $PKG.idb for output\n";
96 print IDB
"f 0644 root sys etc/config/samba $SRCPFX/packaging/SGI/samba.config $PKG.sw.base config(update)\n";
97 print IDB
"f 0644 root sys etc/config/winbind $SRCPFX/packaging/SGI/winbindd.config $PKG.sw.base config(update)\n";
98 print IDB
"f 0755 root sys etc/init.d/samba $SRCPFX/packaging/SGI/samba.rc $PKG.sw.base\n";
99 print IDB
"f 0755 root sys etc/init.d/winbind $SRCPFX/packaging/SGI/winbindd.rc $PKG.sw.base\n";
100 print IDB
"l 0000 root sys etc/rc0.d/K36winbind $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/winbind)\n";
101 print IDB
"l 0000 root sys etc/rc0.d/K37samba $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/samba)\n";
102 print IDB
"l 0000 root sys etc/rc2.d/S81samba $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/samba)\n";
103 print IDB
"l 0000 root sys etc/rc2.d/S82winbind $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/winbind)\n";
105 if ($PKG eq "samba_irix") {
106 print IDB
"d 0755 root sys usr/relnotes/samba_irix $SRCPFX/packaging/SGI $PKG.man.relnotes\n";
107 print IDB
"f 0644 root sys usr/relnotes/samba_irix/TC relnotes/TC $PKG.man.relnotes\n";
108 print IDB
"f 0644 root sys usr/relnotes/samba_irix/ch1.z relnotes/ch1.z $PKG.man.relnotes\n";
109 print IDB
"f 0644 root sys usr/relnotes/samba_irix/ch2.z relnotes/ch2.z $PKG.man.relnotes\n";
110 print IDB
"f 0644 root sys usr/relnotes/samba_irix/ch3.z relnotes/ch3.z $PKG.man.relnotes\n";
113 @copyfile = grep (/^COPY/,@allfiles);
114 print IDB
"d 0755 root sys usr/relnotes/samba $SRCPFX/packaging/SGI $PKG.man.relnotes\n";
115 print IDB
"f 0644 root sys usr/relnotes/samba/@copyfile[0] $SRCPFX/@copyfile[0] $PKG.man.relnotes\n";
116 print IDB
"f 0644 root sys usr/relnotes/samba/legal_notice.html $SRCPFX/packaging/SGI/legal_notice.html $PKG.man.relnotes\n";
117 print IDB
"f 0644 root sys usr/relnotes/samba/samba-relnotes.html $SRCPFX/packaging/SGI/relnotes.html $PKG.man.relnotes\n";
120 print IDB
"d 0755 root sys usr/samba $SRCPFX/packaging/SGI $PKG.sw.base\n";
122 print IDB
"d 0755 root sys usr/samba/bin $SRCPFX/packaging/SGI $PKG.sw.base\n";
124 $nextfile = shift @bins;
125 ($filename = $nextfile) =~ s/^.*\///;;
127 if (index($nextfile,'$')) {
128 if ($filename eq "smbpasswd") {
129 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n";
131 elsif ($filename eq "swat") {
132 print IDB
"f 4755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base preop(\"chroot \$rbase /etc/init.d/samba stop\") exitop(\"chroot \$rbase /usr/samba/scripts/startswat.sh\") removeop(\"chroot \$rbase /sbin/cp /etc/inetd.conf /etc/inetd.conf.O ; chroot \$rbase /sbin/sed -e '/^swat/D' -e '/^#SWAT/D' /etc/inetd.conf.O >/etc/inetd.conf; /etc/killall -HUP inetd || true\")\n";
134 elsif ($filename eq "sambalp") {
135 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/packaging/SGI/$filename $PKG.sw.base \n";
137 elsif ($filename eq "smbprint") {
138 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/packaging/SGI/$filename $PKG.sw.base\n";
140 elsif ($filename eq "smbd") {
141 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n";
142 if (-e
"$SRCDIR/source/$nextfile.noquota") {
143 print IDB
"f 0755 root sys usr/samba/bin/$filename.noquota $SRCPFX/source/$nextfile.noquota $PKG.sw.base \n";
145 if (-e
"$SRCDIR/source/$nextfile.profile") {
146 print IDB
"f 0755 root sys usr/samba/bin/$filename.profile $SRCPFX/source/$nextfile.profile $PKG.sw.base \n";
149 elsif ($filename eq "nmbd") {
150 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n";
151 if (-e
"$SRCDIR/source/$nextfile.profile") {
152 print IDB
"f 0755 root sys usr/samba/bin/$filename.profile $SRCPFX/source/$nextfile.profile $PKG.sw.base \n";
156 print IDB
"f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n";
161 print IDB
"d 0755 root sys usr/samba/docs $SRCPFX/docs $PKG.man.doc\n";
163 $nextfile = shift @docs;
164 ($junk,$file) = split(/\//,$nextfile,2);
165 if (grep(/\/$/,$nextfile)) {
167 $nextfile =~ s/\/$//;
168 print IDB
"d 0755 root sys usr/samba/docs/$file $SRCPFX/$nextfile $PKG.man.doc\n";
171 print IDB
"f 0644 root sys usr/samba/docs/$file $SRCPFX/$nextfile $PKG.man.doc\n";
175 print IDB
"d 0755 root sys usr/samba/include $SRCPFX/packaging/SGI $PKG.sw.base\n";
176 print IDB
"f 0644 root sys usr/samba/include/libsmbclient.h $SRCPFX/source/include/libsmbclient.h $PKG.sw.base\n";
178 print IDB
"d 0755 root sys usr/samba/lib $SRCPFX/packaging/SGI $PKG.sw.base\n";
180 $nextfile = shift @libfiles;
181 ($file = $nextfile) =~ s/.*\///;
182 if ($file eq "smb.conf") {
183 print IDB
"f 0644 root sys usr/samba/lib/$file $SRCPFX/$nextfile $PKG.sw.base config(suggest)\n";
185 print IDB
"f 0644 root sys usr/samba/lib/$file $SRCPFX/$nextfile $PKG.sw.base nostrip \n";
189 print IDB
"d 0755 lp sys usr/samba/printer $SRCPFX/packaging/SGI $PKG.sw.base\n";
190 print IDB
"d 0755 lp sys usr/samba/printer/W32ALPHA $SRCPFX/packaging/SGI $PKG.sw.base\n";
191 print IDB
"d 0755 lp sys usr/samba/printer/W32MIPS $SRCPFX/packaging/SGI $PKG.sw.base\n";
192 print IDB
"d 0755 lp sys usr/samba/printer/W32PPC $SRCPFX/packaging/SGI $PKG.sw.base\n";
193 print IDB
"d 0755 lp sys usr/samba/printer/W32X86 $SRCPFX/packaging/SGI $PKG.sw.base\n";
194 print IDB
"d 0755 lp sys usr/samba/printer/WIN40 $SRCPFX/packaging/SGI $PKG.sw.base\n";
196 print IDB
"d 0644 root sys usr/samba/private $SRCPFX/packaging/SGI $PKG.sw.base\n";
197 print IDB
"f 0600 root sys usr/samba/private/smbpasswd $SRCPFX/packaging/SGI/smbpasswd $PKG.sw.base config(suggest)\n";
199 print IDB
"d 0755 root sys usr/samba/scripts $SRCPFX/packaging/SGI $PKG.src.samba\n";
200 print IDB
"f 0755 root sys usr/samba/scripts/inetd.sh $SRCPFX/packaging/SGI/inetd.sh $PKG.sw.base\n";
201 print IDB
"f 0755 root sys usr/samba/scripts/inst.msg $SRCPFX/packaging/SGI/inst.msg $PKG.sw.base exitop(\"chroot \$rbase /usr/samba/scripts/inst.msg\")\n";
202 print IDB
"f 0755 root sys usr/samba/scripts/mkprintcap.sh $SRCPFX/packaging/SGI/mkprintcap.sh $PKG.sw.base\n";
203 print IDB
"f 0755 root sys usr/samba/scripts/removeswat.sh $SRCPFX/packaging/SGI/removeswat.sh $PKG.sw.base\n";
204 print IDB
"f 0755 root sys usr/samba/scripts/startswat.sh $SRCPFX/packaging/SGI/startswat.sh $PKG.sw.base\n";
206 print IDB
"d 0755 root sys usr/samba/src $SRCPFX/packaging/SGI $PKG.src.samba\n";
207 @sorted = sort(@allfiles);
209 $nextfile = shift @sorted;
210 ($file = $nextfile) =~ s/^.*\///;
211 next if grep(/packaging\/SGI
/& (/Makefile
/ | /samba\
.spec
/ | /samba\
.idb
/),$nextfile);
212 next if grep(/source/,$nextfile) && ($ignores{$file});
213 next if ($nextfile eq "CVS");
214 if (grep(/\/$/,$nextfile)) {
215 $nextfile =~ s/\/$//;
216 print IDB
"d 0755 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n";
219 if (grep((/\.sh$/ | /configure$/ | /configure\.developer/ | /config\.guess/ | /config\.sub/ | /\.pl$/ | /mkman$/ | /pcp\/Install
/ | /pcp\
/Remove/),$nextfile)) {
220 print IDB
"f 0755 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n";
223 print IDB
"f 0644 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n";
228 print IDB
"d 0755 root sys usr/samba/swat $SRCPFX/packaging/SGI/swat $PKG.sw.base\n";
230 $nextfile = shift @swatfiles;
231 ($file = $nextfile) =~ s/^packaging\/SGI\/swat\
///;
233 if (grep(/\/$/,$file)) {
235 print IDB
"d 0755 root sys usr/samba/swat/$file $SRCPFX/packaging/SGI/swat/$file $PKG.sw.base\n";
238 print IDB
"f 0444 root sys usr/samba/swat/$file $SRCPFX/packaging/SGI/swat/$file $PKG.sw.base\n";
242 print IDB
"d 0755 root sys usr/samba/var $SRCPFX/packaging/SGI $PKG.sw.base\n";
243 print IDB
"d 0755 root sys usr/samba/var/locks $SRCPFX/packaging/SGI $PKG.sw.base\n";
245 if ($PKG eq "samba_irix") {
247 $nextfile = shift @books;
252 print IDB
"d 0755 root sys usr/share/catman/u_man $SRCPFX/packaging/SGI $PKG.man.manpages\n";
255 $nextfile = shift @catman;
256 ($file = $nextfile) =~ s/^packaging\/SGI\/catman\
///;
257 ($dirnum = $file) =~ s/^[\D]*//;
259 if ($dirnum ne $olddirnum) {
260 print IDB
"d 0755 root sys usr/share/catman/u_man/cat$dirnum $SRCPFX/packaging/SGI $PKG.man.manpages\n";
261 $olddirnum = $dirnum;
263 print IDB
"f 0664 root sys usr/share/catman/u_man/cat$dirnum/$file $SRCPFX/$nextfile $PKG.man.manpages\n";
267 print IDB
"d 0755 root sys var/ns/lib $SRCPFX/packaging/SGI $PKG.sw.base\n";
269 $nextfile = shift @nsswitch;
270 next if $nextfile eq 'libsmbclient';
271 ($filename = $nextfile) =~ s/^.*\///;
272 $filename =~ s/libnss/libns/;
273 print IDB
"f 0644 root sys var/ns/lib/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n";
277 print IDB
"d 01777 lp sys var/spool/samba $SRCPFX/packaging/SGI $PKG.sw.base\n";
280 print "\n\n$PKG.idb file has been created\n";
283 local($dir, $nlink) = @_;
284 local($dev,$ino,$mode,$subcount);
286 ($dev,$ino,$mode,$nlink) = stat('.') unless $nlink;
288 opendir(DIR
,'.') || die "Can't open current directory";
289 local(@filenames) = sort readdir(DIR
);
292 if ($nlink ==2) { # This dir has no subdirectories.
296 $this = substr($dir,2)."/$_";
297 push(@allfiles,$this);
301 $subcount = $nlink -2;
306 ($dev,$ino,$mode,$nlink) = lstat($_);
308 $this = substr($name,2);
310 push(@allfiles,$this);
311 next if $subcount == 0; # seen all the subdirs?
315 chdir $_ || die "Can't cd to $name";
316 &dodir
($name,$nlink);
324 ($f0,$f1) = split(/\//,$a,2);
325 ($f0,$f2) = split(/\//,$b,2);
330 ($f0,$f1) = split(/.*\//,$a,2);
331 if ($f1 eq "") { $f1 = $f0 };
332 ($f0,$f2) = split(/.*\//,$b,2);
333 if ($f2 eq "") { $f2 = $f0 };
338 ($f1 = $a) =~ s/^.*\///;
339 ($f2 = $b) =~ s/^.*\///;
340 ($dir1 = $a) =~ s/^[\D]*//;
341 ($dir2 = $b) =~ s/^[\D]*//;
342 if (!($dir1 <=> $dir2)) {
351 ($f0,$f1,$f2,$f3) = split(/ /,$a,4);
352 ($f0,$f1,$f2,$f4) = split(/ /,$b,4);
360 while (($cont = index($line,"\\")) > 0) {
364 substr($line,$cont,1) = $_;
366 $line =~ s/\$\(srcdir\)//g;
367 $line =~ s/\$\(builddir\)//g;
368 $line =~ s/\$\(\S*\)\s*//g;
369 $line =~ s/\s\s*/ /g;
370 @line = split(' ',$line);