chiark / gitweb /
tarfile-maker, grab-account, rcsids
authorian <ian>
Sun, 3 Jan 1999 00:14:07 +0000 (00:14 +0000)
committerian <ian>
Sun, 3 Jan 1999 00:14:07 +0000 (00:14 +0000)
sync-accounts/grab-account [new file with mode: 0755]
sync-accounts/sync-accounts
sync-accounts/sync-accounts-createuser
sync-accounts/sync-accounts-mktar [new file with mode: 0755]

diff --git a/sync-accounts/grab-account b/sync-accounts/grab-account
new file mode 100755 (executable)
index 0000000..2eef468
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -e
+
+if [ $# -lt 2 -o $# -gt 3 ]
+then
+       echo >&2 \
+'usage: grab-account <localuser> <shorthostname> [<remoteuser>]
+creates an entry in /etc/sync-accounts, and runs sync-accounts
+$Id: grab-account,v 1.1 1999-01-03 00:14:07 ian Exp $'
+       exit 1
+fi
+
+lu="$1"
+sh="$2"
+
+if [ $# -gt 2 ]
+then
+       ru="$3"
+else
+       ru="$1"
+fi
+
+cf=/etc/sync-accounts
+
+if perl -ne 'exit 1 if m/^\s*user\s+'$lu'\s/;' <$cf
+then
+       perl -pe '
+               next unless m/^\s*host\s+'$sh'\s*$/...m/^host|^end/;
+               next unless m/^\s*addhere\s*$/;
+               next if $done++;
+               print "user '$lu'".("'$lu'" eq "'$ru'" ? "" : " remote='$ru'")."\n"
+                       or die $!;
+        END {
+               print(STDERR "\`addhere'\'' line not found\n"), $?=1 if !$? && !$done;
+        }
+               ' $cf >$cf.new
+       mv -f $cf.new $cf
+else
+       echo "entry already exists in $cf, leaving alone"
+fi
+
+sync-accounts
index a1b1493..70a9e76 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+# $Id: sync-accounts,v 1.4 1999-01-03 00:14:07 ian Exp $
 # usage: sync-accounts [-n] [-C<config-file>] [<host> ...]
 # options:
 #   -n     do not really do anything
index 4959dbe..8377db4 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 # default user-creation script for sync-accounts
+# $Id: sync-accounts-createuser,v 1.2 1999-01-03 00:14:08 ian Exp $
 
 set -e
 mkdir -p $SYNCUSER_CREATE_HOME
diff --git a/sync-accounts/sync-accounts-mktar b/sync-accounts/sync-accounts-mktar
new file mode 100755 (executable)
index 0000000..63ab084
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# $Id: sync-accounts-mktar,v 1.1 1999-01-03 00:14:09 ian Exp $
+set -e
+
+of=sync-accounts-usrlocalsbin.tar
+tar vvcf $of sync-accounts sync-accounts-createuser grab-account
+gzip -9v $of