Skip to content

Commit

Permalink
Renamed upgrade script (#121)
Browse files Browse the repository at this point in the history
- Removed "no attestation" versions of upgrade scripts
- Renamed `upgrade-v2-device` to `upgrade-existing-device`
- Removed unused code
  • Loading branch information
italo-sampaio authored Jan 25, 2023
1 parent 82f5706 commit 5acf171
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 41 deletions.
2 changes: 1 addition & 1 deletion dist/README-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To upgrade an existing powHSM device to a newer firmware version, you will first
Then, to execute the upgrade process, within the `/path/to/dist` directory, issue:

```
/path/to/dist> ./upgrade-v2-device
/path/to/dist> ./upgrade-existing-device
```

and follow the instructions.
2 changes: 1 addition & 1 deletion dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To upgrade an existing powHSM device, you will first need:
Then, to execute the upgrade process, within the `/path/to/dist` directory, issue:

```
/path/to/dist> ./upgrade-v2-device
/path/to/dist> ./upgrade-existing-device
```

and follow the instructions.
41 changes: 8 additions & 33 deletions dist/scripts/upgrade-v2 → dist/scripts/upgrade-existing
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ popd > /dev/null

TARGET_ID="$(cat $ROOT_DIR/scripts/target.id)"

# Exclude attestation?
DO_ATTESTATION="yes"
if [[ "$1" == "--noatt" ]]; then
DO_ATTESTATION="no"
elif [[ "$1" != "" ]]; then
echo -e "\e[1;31mInvalid or unknown option '$1'\e[0m"
exit 1
fi

# Binaries
LBUTILS_DIR="$ROOT_DIR/bin/lbutils"
LBUTILS_BUNDLE="$LBUTILS_DIR.tgz"
Expand Down Expand Up @@ -129,12 +120,7 @@ function createOutputDir() {
}

function keys() {
UNLOCK_OPT="-p$(cat $PIN_FILE)"
if [[ "$DO_ATTESTATION" == "yes" ]]; then
UNLOCK_OPT="-u"
fi

$ADMIN pubkeys -o $PUBLIC_KEY_FILE $UNLOCK_OPT
$ADMIN pubkeys -o $PUBLIC_KEY_FILE -u
error
}

Expand All @@ -154,10 +140,7 @@ echo
checkFirmware
checkForPinFile
checkForSignerAuthFile

if [[ "$DO_ATTESTATION" == "yes" ]]; then
checkForAttestationFile
fi
checkForAttestationFile

echo -e "\e[1;33mConnect your ledger.\e[0m"
echo -e "Press [Enter] to continue"
Expand All @@ -180,23 +163,15 @@ read continue
sleep 2
createOutputDir
echo

if [[ "$DO_ATTESTATION" == "yes" ]]; then
echo -e "\e[1;32mGathering attestation\e[0m"
attestation
echo
fi

echo -e "\e[1;32mGathering attestation\e[0m"
attestation
echo
echo -e "\e[1;32mGathering public keys\e[0m"
keys
echo

if [[ "$DO_ATTESTATION" == "yes" ]]; then
echo -e "\e[1;32mVerifying attestation\e[0m"
verify_attestation
echo
fi

echo -e "\e[1;32mVerifying attestation\e[0m"
verify_attestation
echo
echo -e "\e[1;32mpowHSM Upgrade complete.\e[0m"
echo -e "\e[1;33mPlease disconnect the device.\e[0m"
echo
Expand Down
3 changes: 3 additions & 0 deletions dist/upgrade-existing-device
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

$(dirname $0)/scripts/run_with_docker upgrade-existing
3 changes: 0 additions & 3 deletions dist/upgrade-v2-device

This file was deleted.

3 changes: 0 additions & 3 deletions dist/upgrade-v2-device-noatt

This file was deleted.

0 comments on commit 5acf171

Please sign in to comment.