Skip to content

Instantly share code, notes, and snippets.

@erantapaa
Created August 27, 2015 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erantapaa/eeed10fd7dc1f4218e70 to your computer and use it in GitHub Desktop.
Save erantapaa/eeed10fd7dc1f4218e70 to your computer and use it in GitHub Desktop.
Setting up keys for a new hsackage-server
#!/bin/sh
#
# Script to populate a TUF directory with a new set of private keys.
#
# Note: Need to install the hackage-repo-tool package from Hackage.
REPO_TOOL=hackage-repo-tool
KEYS_DIR=/tmp/keys
DATA_DIR=./datafiles
mkdir $KEYS_DIR
$REPO_TOOL create-keys --keys $KEYS_DIR
tsfile=$(/bin/ls -1 $KEYS_DIR/timestamp | head -1)
cp "$KEYS_DIR/timestamp/$tsfile" $DATA_DIR/TUF/timestamp.private
snapfile=$(/bin/ls -1 $KEYS_DIR/snapshot | head -1)
cp "$KEYS_DIR/snapshot/$tsfile" "$DATA_DIR/TUF/snapshot.private"
$REPO_TOOL create-root --keys $KEYS_DIR -o $DATA_DIR/TUF/root.json
$REPO_TOOL create-mirrors --keys $KEYS_DIR -o $DATA_DIR/TUF/mirrors.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment