From: ian Date: Wed, 18 Jul 2001 22:08:41 +0000 (+0000) Subject: autotitle builds and installs. Various fixes. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=ian-dotfiles.git;a=commitdiff_plain;h=2101c0a7fa5dbbc6df915feab299d5f1c2f5b124 autotitle builds and installs. Various fixes. --- diff --git a/autotitle/Makefile b/autotitle/Makefile index 028636a..209d7a7 100644 --- a/autotitle/Makefile +++ b/autotitle/Makefile @@ -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 index 8d51ae9..0000000 Binary files a/autotitle/autotitle and /dev/null differ diff --git a/autotitle/autotitleaix b/autotitle/autotitleaix deleted file mode 100755 index 67faa6c..0000000 Binary files a/autotitle/autotitleaix and /dev/null differ diff --git a/autotitle/cusmake b/autotitle/cusmake deleted file mode 100644 index 0ae96e9..0000000 --- a/autotitle/cusmake +++ /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 index 7619d6b..0000000 --- a/autotitle/linuxcompile +++ /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 index e821133..0000000 --- a/autotitle/ursacompile +++ /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 9014c2a..6c6b6c6 100644 --- 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 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 diff --git a/files/_.configs_setenvir b/files/_.configs_setenvir index c46fa93..d85148c 100755 --- a/files/_.configs_setenvir +++ b/files/_.configs_setenvir @@ -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 c50443a..f16320c 100755 --- 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= ''; - $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 ef0233c..69efd01 100644 --- 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 0a6dba6..bf3295d 100755 --- 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 index 0000000..d630ba3 --- /dev/null +++ b/showresult @@ -0,0 +1,3 @@ +platform @@$platform@@ +hostname @@$hostname@@ +ncipher @@$ncipher@@