From 3892b1c10b7252f7e90315e56d5b05b9d8028ecc Mon Sep 17 00:00:00 2001 From: Sun Knudsen Date: Fri, 21 May 2021 14:02:00 -0400 Subject: [PATCH] Fixed missing .electrum directory bug --- .../README.md | 16 ++++------- how-to-create-encrypted-paper-backup/test.sh | 28 +++++++++++-------- .../tests/bip39.exp | 9 ++++++ .../tests/default.exp | 9 ++++++ .../tests/electrum.exp | 3 ++ .../tests/secure-erase.exp | 6 ++++ .../tests/shamir.exp | 3 ++ 7 files changed, 52 insertions(+), 22 deletions(-) diff --git a/how-to-create-encrypted-paper-backup/README.md b/how-to-create-encrypted-paper-backup/README.md index ea185f4..0d9230e 100644 --- a/how-to-create-encrypted-paper-backup/README.md +++ b/how-to-create-encrypted-paper-backup/README.md @@ -585,7 +585,7 @@ $ sudo dphys-swapfile uninstall $ sudo systemctl disable dphys-swapfile.service ``` -#### Remove `dphys-swapfile` `fake-hwclock` and `logrotate` +#### Remove `dphys-swapfile`, `fake-hwclock` and `logrotate` ```shell sudo apt remove -y --purge dphys-swapfile fake-hwclock logrotate @@ -594,25 +594,21 @@ sudo apt remove -y --purge dphys-swapfile fake-hwclock logrotate #### Link `/etc/console-setup` to `/tmp/console-setup` ```console -$ sudo mv /etc/console-setup /tmp/console-setup +$ sudo rm -fr /etc/console-setup $ sudo ln -s /tmp/console-setup /etc/console-setup ``` -#### Link `/etc/resolv.conf` to `/tmp/resolv.conf` +#### Link `/home/pi/.electrum` to `/tmp/pi/.electrum` ```console -$ sudo mv /etc/resolv.conf /tmp/resolv.conf - -$ sudo ln -s /tmp/resolv.conf /etc/resolv.conf +$ ln -s /tmp/pi/.electrum /home/pi/.electrum ``` #### Link `/home/pi/.gnupg` to `/tmp/pi/.gnupg` ```console -$ mkdir -m 700 /tmp/pi - -$ mv /home/pi/.gnupg /tmp/pi/.gnupg +$ rm -fr /home/pi/.gnupg $ ln -s /tmp/pi/.gnupg /home/pi/.gnupg ``` @@ -620,7 +616,7 @@ $ ln -s /tmp/pi/.gnupg /home/pi/.gnupg #### Enable `tmp.mount` service ```console -$ echo -e "D /tmp 1777 root root -\nD /tmp/console-setup 1700 root root -\nD /tmp/pi 1700 pi pi -\nD /tmp/pi/.gnupg 1700 pi pi -\nD /var/tmp 1777 root root -" | sudo tee /etc/tmpfiles.d/tmp.conf +$ echo -e "D /tmp 1777 root root -\nD /tmp/console-setup 1700 root root -\nD /tmp/pi 1700 pi pi -\nD /tmp/pi/.electrum 1700 pi pi -\nD /tmp/pi/.gnupg 1700 pi pi -\nD /var/tmp 1777 root root -" | sudo tee /etc/tmpfiles.d/tmp.conf $ sudo cp /usr/share/systemd/tmp.mount /etc/systemd/system/ diff --git a/how-to-create-encrypted-paper-backup/test.sh b/how-to-create-encrypted-paper-backup/test.sh index 0cb6834..6262a67 100755 --- a/how-to-create-encrypted-paper-backup/test.sh +++ b/how-to-create-encrypted-paper-backup/test.sh @@ -13,15 +13,19 @@ read -rs password export password=$password -printf "%s\n" "Running unit tests…" - -expect ./tests/bip39.exp -expect ./tests/electrum.exp -expect ./tests/default.exp -expect ./tests/shamir.exp -expect ./tests/shamir-2-of-3.exp -expect ./tests/clone.exp -expect ./tests/convert-default-to-shamir-2-of-3.exp -expect ./tests/convert-shamir-2-of-3-to-default.exp -expect ./tests/duplicate.exp -expect ./tests/secure-erase.exp +if [ -n "$1" ]; then + printf "%s\n" "Running unit test…" + expect ./tests/$1 +else + printf "%s\n" "Running unit tests…" + expect ./tests/bip39.exp + expect ./tests/electrum.exp + expect ./tests/default.exp + expect ./tests/shamir.exp + expect ./tests/shamir-2-of-3.exp + expect ./tests/clone.exp + expect ./tests/convert-default-to-shamir-2-of-3.exp + expect ./tests/convert-shamir-2-of-3-to-default.exp + expect ./tests/duplicate.exp + expect ./tests/secure-erase.exp +fi diff --git a/how-to-create-encrypted-paper-backup/tests/bip39.exp b/how-to-create-encrypted-paper-backup/tests/bip39.exp index 75fe0cf..7f89a4d 100644 --- a/how-to-create-encrypted-paper-backup/tests/bip39.exp +++ b/how-to-create-encrypted-paper-backup/tests/bip39.exp @@ -33,6 +33,9 @@ expect { -re {([a-z]+ ?){24}} { test_ok true } + eof { + test_failed + } } test_label "Should validate valid BIP39 mnemonic" @@ -69,6 +72,9 @@ expect { -re {Please type passphrase and press enter} { test_ok true } + eof { + test_failed + } } test_label "Should fail to validate invalid BIP39 mnemonic" @@ -105,4 +111,7 @@ expect { -re {Invalid BIP39 mnemonic} { test_ok true } + eof { + test_failed + } } diff --git a/how-to-create-encrypted-paper-backup/tests/default.exp b/how-to-create-encrypted-paper-backup/tests/default.exp index 43de379..d63edca 100644 --- a/how-to-create-encrypted-paper-backup/tests/default.exp +++ b/how-to-create-encrypted-paper-backup/tests/default.exp @@ -39,6 +39,9 @@ expect { -re {Secrets do not match} { test_ok } + eof { + test_failed + } } test_label "Should fails to backup secret using passphrases that do not match" @@ -87,6 +90,9 @@ expect { -re {Passphrases do not match} { test_ok } + eof { + test_failed + } } test_label "Should backup secret showing passphrase" @@ -157,6 +163,9 @@ expect { -re {Done} { test_ok } + eof { + test_failed + } } test_label "Should restore secret" diff --git a/how-to-create-encrypted-paper-backup/tests/electrum.exp b/how-to-create-encrypted-paper-backup/tests/electrum.exp index 5ac7645..2ea8abf 100644 --- a/how-to-create-encrypted-paper-backup/tests/electrum.exp +++ b/how-to-create-encrypted-paper-backup/tests/electrum.exp @@ -26,4 +26,7 @@ expect { -re {([a-z]+ ?){24}} { test_ok true } + eof { + test_failed + } } diff --git a/how-to-create-encrypted-paper-backup/tests/secure-erase.exp b/how-to-create-encrypted-paper-backup/tests/secure-erase.exp index 1f2c793..3f21019 100644 --- a/how-to-create-encrypted-paper-backup/tests/secure-erase.exp +++ b/how-to-create-encrypted-paper-backup/tests/secure-erase.exp @@ -50,6 +50,9 @@ expect { -re {Done} { test_ok } + eof { + test_failed + } } test_label "Should secure erase flash drive using single round random overwrite and zero overwrite" @@ -88,4 +91,7 @@ expect { -re {Done} { test_ok } + eof { + test_failed + } } diff --git a/how-to-create-encrypted-paper-backup/tests/shamir.exp b/how-to-create-encrypted-paper-backup/tests/shamir.exp index 2e86afc..46a61fc 100644 --- a/how-to-create-encrypted-paper-backup/tests/shamir.exp +++ b/how-to-create-encrypted-paper-backup/tests/shamir.exp @@ -137,6 +137,9 @@ expect { -re {Done} { test_ok } + eof { + test_failed + } } test_label "Should restore secret using Shamir Secret Sharing"