chiark / gitweb /
autotitle builds and installs. Various fixes.
authorian <ian>
Wed, 18 Jul 2001 22:08:41 +0000 (22:08 +0000)
committerian <ian>
Wed, 18 Jul 2001 22:08:41 +0000 (22:08 +0000)
13 files changed:
autotitle/Makefile
autotitle/autotitle [deleted file]
autotitle/autotitleaix [deleted file]
autotitle/cusmake [deleted file]
autotitle/linuxcompile [deleted file]
autotitle/ursacompile [deleted file]
config
execute [new file with mode: 0755]
files/_.configs_setenvir
gpt
perms
process
showresult [new file with mode: 0644]

index 028636a6c0ef6994947613d1a7db13c1b3992303..209d7a7afed93c9f37e0a300a69837bf75f512f1 100644 (file)
@@ -1,21 +1,21 @@
-XLIB= -L/usr/local/X11R5/lib -lX11
+INSTALLDIR=    $(HOME)/bin
+INSTALLED=     $(INSTALLDIR)/autotitle
+X11=           /usr/X11R6
 
-installed= $(HOME)/bin/$(ARCH)/autotitle
+CPPFLAGS=      $(OPTIONS) -I$(X11)/include
+CFLAGS=                $(OPTIMISE)
+OPTIMISE=      -O2
+OPTIONS=       -DNOXTERM
+XLIB=          -L$(X11)/lib -lX11
 
-default:       autotitle$(ARCH)
+default:       autotitle
 
-install:       $(installed)
+install:       $(INSTALLED)
 
-$(installed):  autotitle$(ARCH)
-               strip autotitle$(ARCH)
-               rm -f $(HOME)/bin/$(ARCH)/autotitle
-               ln `pwd`/autotitle$(ARCH) $(HOME)/bin/$(ARCH)/autotitle
+$(INSTALLED):  autotitle
+               rm -f $@
+               ln autotitle $@
 
-autotitlesun4: autotitle.c Makefile
-               gcc -traditional -O -o autotitlesun4  autotitle.c $(XLIB) -DNOXTERM
-
-autotitlesun3: autotitle.c Makefile
-               gcc -traditional -O -o autotitlesun3  autotitle.c $(XLIB) -DNOXTERM
-
-autotitlemips: autotitle.c Makefile
-               cc -O -o autotitlemips  autotitle.c $(XLIB) -DNOXTERM
+autotitle:     autotitle.c Makefile
+               $(CC) $(CFLAGS) $(CPPFLAGS) autotitle.c -o $@ $(XLIB)
+               strip autotitle
diff --git a/autotitle/autotitle b/autotitle/autotitle
deleted file mode 100755 (executable)
index 8d51ae9..0000000
Binary files a/autotitle/autotitle and /dev/null differ
diff --git a/autotitle/autotitleaix b/autotitle/autotitleaix
deleted file mode 100755 (executable)
index 67faa6c..0000000
Binary files a/autotitle/autotitleaix and /dev/null differ
diff --git a/autotitle/cusmake b/autotitle/cusmake
deleted file mode 100644 (file)
index 0ae96e9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-gcc -traditional -O -o autotitlesun4  autotitle.c -I/applic/X11R5/include -L/applic/X11R5/lib -lX11 -DNOXTERM
diff --git a/autotitle/linuxcompile b/autotitle/linuxcompile
deleted file mode 100644 (file)
index 7619d6b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
diff --git a/autotitle/ursacompile b/autotitle/ursacompile
deleted file mode 100644 (file)
index e821133..0000000
+++ /dev/null
@@ -1 +0,0 @@
-cc -o autotitle autotitle.c -I/opt/X11R5/include -L/opt/X11R5/lib -R/opt/X11R5/lib -lX11 -lsocket -lnsl -DNOXTERM
diff --git a/config b/config
index 9014c2a694a1afd423d4647db8bd8d00b2723675..6c6b6c69f1852436c88d33e58d2364c00c2d4d76 100644 (file)
--- a/config
+++ b/config
@@ -1,2 +1,16 @@
 @@-
-chomp($hostname= `uname -n`); $? and die;
+chomp($hostname= `uname -n`); $? and die 'uname $?';
+($hostname)=(gethostbyname $hostname) or die "hostname $hostname ?";
+
+chomp($s= `uname`); $? and die 'platform $?';
+if ($s =~ m/^Linux$/) {
+    chomp($_= `uname -m`); $? and die 'platform $?';
+    if (m/^i\d86/) {
+       $platform= 'linux-i386';
+    } else {
+       die '$_ ?';
+    }
+}
+
+$ncipher= $hostname =~ m/\.ncipher\.com$/ 
+    || $hostname =~ m/\.ncipherusa\.com$/;
diff --git a/execute b/execute
new file mode 100755 (executable)
index 0000000..9e16614
--- /dev/null
+++ b/execute
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -x
+make -C autotitle
+make -C autotitle install INSTALLDIR=$HOME/personal/@@$platform@@/bin
index c46fa93a06f1e31dba51f364f9b2681c18a3aac8..d85148cf17490e9f855ba9b031ef9d5e5fbd4ba8 100755 (executable)
@@ -1,8 +1,10 @@
 #!/bin/sh
 # Set up the environment:
 
-PATH=$HOME/personal/linux-i386/bin:$HOME/public/linux-i386/bin
+PATH=$HOME/personal/@@$platform@@/bin
+@@?$ncipher?@@@@#
 PATH=$PATH:$HOME/personal/linux-i386/crypto/scripts
+@@;@@#
 PATH=$PATH:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin
 PATH=$PATH:/opt/bin:/usr/bin/X11
 
diff --git a/gpt b/gpt
index c50443ad910460820896cf4758290a40d896ce07..f16320caa464853689ee842154c95949592222ac 100755 (executable)
--- a/gpt
+++ b/gpt
@@ -19,7 +19,7 @@ use IO::File;
 
 open DEBUG, ">/dev/null" or die "gpt: /dev/null: $!\n";
 
-while (@main::ARGV =~ m/^-/) {
+while ($main::ARGV[0] =~ m/^-/) {
     $_= shift @main::ARGV;
     next if m/^--$/;
     while (m/^-./) {
@@ -41,15 +41,19 @@ if (!@main::ARGV) {
 } else {
     for ($i=0; $i<@main::ARGV; $i++) {
        $lno= '<arg#'.($i+1).'>';
-       $value= $main::ARGV[$i];
-       $fh= new IO::File $value,'r' or err("cannot open file \`$value': $!");
-       process_fh($fh,$value);
-       $fh->close or err("gpt: cannot close file \`$value': $!");
+       process_file($main::ARGV[$i]);
     }
 }
 close STDOUT or die "gpt: close stdout: $!\n";
 exit 0;
 
+sub process_file ($) {
+    my ($value) = @_;
+    $fh= new IO::File $value,'r' or err("cannot open file \`$value': $!");
+    process_fh($fh,$value);
+    $fh->close or err("gpt: cannot close file \`$value': $!");
+}
+
 sub err ($) { die "gpt: $fn:$lno: $_[0]\n"; }
 
 sub add_perl ($) {
@@ -122,6 +126,7 @@ sub process_input () {
                if ($op =~ m/[-< \$?]/) {
                    $substr.= $esc if @oplist;
                    push @oplist, $op;
+                   add_perl($op) if $op =~ m/[\$]/;
                } elsif ($op =~ m/[\)\}\;\:]/) {
                    err("unmatched closing \@\@$op") unless @oplist;
                    $want= pop @oplist;
@@ -160,6 +165,8 @@ sub process_input () {
                    } else {
                        $substr.= $esc;
                    }
+               } elsif ($op eq '#') {
+                   $l =~ s/^[^\n]*//; $l =~ s/^\n//;
                } else {
                    err("bad escape sequence \@\@$op in text part");
                }
@@ -171,6 +178,26 @@ sub process_input () {
     }
 }
 
+sub close_nesteds () {
+    my ($op);
+    while (@oplist) {
+       $op= $oplist[$#oplist];
+       if (@oplist & 1) {
+           err("unterminated \@\@?") if $op eq '?';
+           $l=' @@';
+       } else {
+           if ($op =~ y/({/)}/) {
+               $l= '@@'.$op;
+           } elsif ($op =~ m/^[;:]+/) {
+               $l= '@@;';
+           } else {
+               die "intern /@oplist/";
+           }
+       }
+       process_input();
+    }
+}
+
 sub process_fh ($$) {
     local ($fh,$fn) = @_;
     local ($l,$lno, @oplist,$substr,$expr,$to,$op);
@@ -180,7 +207,9 @@ sub process_fh ($$) {
        $lno= $.;
        process_input();
     }
+    
     die "gpt: $fn: read error: $!" if $fh->error;
+    close_nesteds();
 }
 
 sub output ($) {
@@ -199,5 +228,6 @@ sub process_i ($) {
     local ($outbuf, @oplist,$substr,$expr,$to,$op);
     $outbuf='';
     process_input();
+    close_nesteds();
     return $outbuf;
 }
diff --git a/perms b/perms
index ef0233c229c47d9af43adffe616db71981f1d21a..69efd01b4460d91e3dd655afb0facb0dd5364d56 100644 (file)
--- a/perms
+++ b/perms
@@ -1,4 +1,9 @@
-.bash_history          0400
-.configs/cache/                2770
-private/               2770
+.bash_history                  0400
+
+.configs/xprofile              0775
+
+personal/@@$platform@@/bin/    2775
+
+.configs/cache/                        2770
+private/                       2770
 .
diff --git a/process b/process
index 0a6dba60474ea47ac3a6bb2aa8f1497fa4a14f7b..bf3295ddfff085cd645aabd1510bb664df558bc3 100755 (executable)
--- a/process
+++ b/process
@@ -6,7 +6,7 @@ $action=0;
 defined($umask=umask) or die $!;
 $home= $ENV{'HOME'}.'/';
 
-while (@ARGV =~ m/^-/) {
+while ($ARGV[0] =~ m/^-/) {
     $_= shift(@ARGV);
     last if m/^--$/;
     while (m/^-./) {
@@ -21,6 +21,7 @@ while (@ARGV =~ m/^-/) {
        }
     }
 }
+die if @ARGV;
 
 stat $home or die $!;
 -d _ or die;
@@ -56,7 +57,7 @@ sub mkparents ($) {
 sub maybe_chmod ($$$) {
     my ($nowperms,$perms,$obj) = @_;
     return if $nowperms==$perms;
-    if ($doing) {
+    if ($action) {
        chmod $perms, $home.$obj or die $!;
     } else {
        would($obj, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
@@ -73,7 +74,7 @@ sub ensuredir ($) {
        maybe_chmod($nowperms,$perms,$dir);
     } else {
        die $! unless $!==&ENOENT;
-       if ($doing) {
+       if ($action) {
            mkdir $home.$dir, $perms or die $!;
        } else {
            would($dir, sprintf 'mkdir %04o', $perms);
@@ -83,6 +84,19 @@ sub ensuredir ($) {
 
 -d 'new' or mkdir 'new', 02700 or die $!;
 
+sub prep_proc ($$) {
+    my ($if,$newf) = @_;
+    my ($c);
+    defined($c= fork) or die $!;
+    if (!$c) {
+       unlink $newf;
+       open STDOUT, "> $newf" or die "$newf $!";
+       exec './gpt','config',$if; die $!;
+    }
+    $!=0; waitpid($c,0)==$c or die $!;
+    $? and die $?;
+}
+
 opendir D, "files" or die $!;
 while ($if=readdir D) {
     next unless $if =~ m/^[_a-z0-9\\]/;
@@ -94,16 +108,9 @@ while ($if=readdir D) {
        length $1 eq 1 ? $1 : sprintf '%c', hex $1 
            /ge;
 
-    $newf= 'new/'.$if;
     mkparents($of);
-    defined($c= fork) or die $!;
-    if (!$c) {
-       unlink $newf;
-       open STDOUT, "> $newf" or die "$of $newf $!";
-       exec './gpt','config','files/'.$if; die $!;
-    }
-    $!=0; waitpid($c,0)==$c or die $!;
-    $? and die $?;
+    $newf= 'new/'.$if;
+    prep_proc('files/'.$if,$newf);
 
     $perms= exists $fileperms{$of} ? $fileperms{$of} : 00666&~$umask;
     chmod $perms, $newf or die $!;
@@ -111,12 +118,13 @@ while ($if=readdir D) {
     if (stat $home.$of) {
        -f _ or die "$of is not a file!";
        $nowperms= (stat _)[2] & 07777;
+       if ($nowperms != $perms) {
+           would($of, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
+       }
        if (!$action) {
-           if ($nowperms != $perms) {
-               would($of, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
-           }
            system 'diff','-u',$home.$of,$newf;
            $?==0 or $?==256 or die $?;
+           $changes++ if $?;
        }
     } else {
        would($of, sprintf 'create %04o', $perms);
@@ -139,6 +147,19 @@ sub would ($$) {
     my ($obj,$what) = @_;
     return if $would_done{$obj}++;
     print STDOUT "*** $what $obj\n" or die $!;
+    $changes++;
+}
+
+if ($changes) {
+    print STDOUT "=== $changes changes\n" or die $!;
+} else {
+    print STDOUT "=== no changes\n" or die $!;
+}
+
+prep_proc('execute','new/,execute');
+if ($action) {
+    chmod 0700,'new/,execute' or die $!;
+    system 'new/,execute'; $? and die $?;
 }
 
 close STDOUT or die $!;
diff --git a/showresult b/showresult
new file mode 100644 (file)
index 0000000..d630ba3
--- /dev/null
@@ -0,0 +1,3 @@
+platform @@$platform@@
+hostname @@$hostname@@
+ncipher  @@$ncipher@@