src/init/break-in/do-breakin
author Paul Crowley <paul@lshift.net>
Thu, 19 Feb 2009 16:36:41 +0000
changeset 38 f1ee930c4ba8
permissions -rw-r--r--
Add start of script for breaking in
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     1
#!/bin/sh
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     2
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     3
set -e
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     4
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     5
HOME=~hg
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     6
export HOME
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     7
cd
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     8
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     9
rm -rf temporary-breakin-repo
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    10
mkdir temporary-breakin-repo
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    11
cd temporary-breakin-repo
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    12
hg clone ~/repos/hgadmin .
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    13
if [ $(echo *) != "" ] ; then
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    14
 DIRNAME=retry
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    15
  while [ $DIRNAME = retry ] ; do
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    16
    DIRNAME=$(date -u +"%F_%T.%N")
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    17
    mkdir $DIRNAME || DIRNAME=retry
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    18
  done
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    19
  hg mv * $DIRNAME
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    20
  hg mv -f $DIRNAME old
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    21
fi
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    22
hg echo "init user=initkey" > hg-ssh-access.conf
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    23
mkdir keys
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    24
cat > keys/initkey
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    25
hg add hg-ssh-access.conf keys/initkey
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    26
hg commit -m "Reset access to a single key via break-in script"
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    27
SSH_ORIGINAL_COMMAND= /etc/mercurial-server/hg-ssh-wrapper root
f1ee930c4ba8 Add start of script for breaking in
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    28