Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use URL variables and small enhancements #162

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
fa8b250
Use URL variables and other improvements
epiccurious May 24, 2024
9427ae7
Read with -r
epiccurious May 24, 2024
04abfef
update comments
epiccurious May 24, 2024
c7993da
Improve comments
epiccurious May 24, 2024
2bb631c
Improve a comment
epiccurious May 24, 2024
fed9171
Merge branch 'master' into 73-url-variable-and-improvements
BenWestgate Jun 6, 2024
5c5533a
Remove quotes around BITCOIN_CORE_SOURCE_DOMAINS
epiccurious Jun 10, 2024
0839031
replace [*] array syntax with “[@]”
epiccurious Jun 10, 2024
552201e
Merge branch 'master' into 73-url-variable-and-improvements
BenWestgate Jun 12, 2024
a5ef58f
add missing closing parenthesis to VER assignment
BenWestgate Jun 13, 2024
3ea8e6c
move close terminal commands to `b`
BenWestgate Jun 13, 2024
f358ff9
relaunch bitcoin less often, fix notifcation typo
BenWestgate Jun 13, 2024
9b85f9d
fix default prune calculation to use whole GB
BenWestgate Jun 13, 2024
f9c17e8
add msg on successful update, fix space bug
BenWestgate Jun 13, 2024
1ac355a
add get_guix function
BenWestgate Jun 14, 2024
5560313
remove error message from until get_guix loop
BenWestgate Jun 14, 2024
c1868c0
stop bitcoin-qt if custom datadir is used and remove it repeat prompt
BenWestgate Jun 14, 2024
f4a0c52
fix stop-btc to work for any datadir, use XDG_STATE_HOME/installed in…
BenWestgate Jun 14, 2024
3784564
move link-dotfiles out of subshell, fix b --version
BenWestgate Jun 15, 2024
268296c
don't background get_keys or wrapped bitcoin-qt
BenWestgate Jun 15, 2024
cc9c531
give persistent-setup it's own completion state file
BenWestgate Jun 15, 2024
4f86838
remove dotfile linking from wrapped, end all files in a blank line, c…
BenWestgate Jun 15, 2024
5d03dc4
rename bitcoin-core folder to bitcoin
BenWestgate Jun 15, 2024
9e173c3
Add job control to b
BenWestgate Jun 15, 2024
b45a864
remove job control from b, needless complexity
BenWestgate Jun 15, 2024
a40ab88
clean up variable declarations and remove writing to persistent stora…
BenWestgate Jun 15, 2024
6a76cdc
source install-core so that wget logs are created and output suppressed
BenWestgate Jun 15, 2024
b60ab62
Move persistent-setup call to `b`
BenWestgate Jun 15, 2024
b604d1f
change get_guix_sigs to run in a subprocess to preserve the original …
BenWestgate Jun 15, 2024
b087558
supress cd guix.sigs errors as it's meant to fail on first run.
BenWestgate Jun 15, 2024
5b079cc
Supress necessary error messages, print the command for retry on fail.
BenWestgate Jun 15, 2024
1a32fba
cleanup warn: remove ./trusted-keys/ from text printed
BenWestgate Jun 15, 2024
8722e5f
b: move wait for dotfiles to be ready to background so it can execute…
BenWestgate Jun 15, 2024
1b6f8fc
install-core: Check Bails has been installed before trying to write t…
BenWestgate Jun 15, 2024
839879b
add verbosity, progress and human readability to all copy and remove …
BenWestgate Jun 15, 2024
552fd6e
Progress was too much terminal spam, add "Running" and "Retrying" to …
BenWestgate Jun 15, 2024
819de52
use bitcoin-cli --rpcwait to stop a wrong datadir faster
BenWestgate Jun 15, 2024
1231b71
use stop-btc instead of bitcoin-cli stop because it blocks.
BenWestgate Jun 15, 2024
0f32778
allow entering share in upper case to be accepted
BenWestgate Jun 15, 2024
3ebf191
move reboot command into persistent-setup to prevent accidental restarts
BenWestgate Jun 16, 2024
e3cb2f5
background persistent-setup so rsync can begin as soon as dotfiles is…
BenWestgate Jun 16, 2024
8f82623
make the directory so the SET_UP file can be touched
BenWestgate Jun 16, 2024
915bdad
add verbosity to git pull, remove old guix.sigs, clean up builder-key…
BenWestgate Jun 16, 2024
fea9e0f
keep Bitcoin Core in favorites if sparrow not installed, mk blocksdir…
BenWestgate Jun 16, 2024
206328d
fix shellcheck conditional complaint, remove unreached line, consolid…
BenWestgate Jun 19, 2024
7a688e5
fix the guix.sigs cleanup removing all folders
BenWestgate Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 38 additions & 28 deletions b
Original file line number Diff line number Diff line change
Expand Up @@ -27,52 +27,62 @@
export VERSION='v0.7.0-alpha'
export WAYLAND_DISPLAY="" # Needed for zenity dialogs to have window icon
export ICON="--window-icon=$HOME/.local/share/icons/bails128.png"
DOTFILES='/live/persistence/TailsData_unlocked/dotfiles'
export DOTFILES='/live/persistence/TailsData_unlocked/dotfiles'
BAILS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

if [ "$1" == "--help" ]; then
echo "Bails Version: $VERSION"
if [ "$1" == "--version" ]; then
echo "Bails version $VERSION"
exit 0
elif ! grep 'NAME="Tails"' /etc/os-release > /dev/null; then # Check for Tails OS.
echo "
YOU MUST RUN THIS SCRIPT IN TAILS OS!
"
read -rp "PRESS ENTER TO EXIT SCRIPT, AND RUN AGAIN FROM TAILS. "
exit 1
elif [[ $(id -u) = "0" ]]; then # Check for root.
echo "
YOU SHOULD NOT RUN THIS SCRIPT AS ROOT!
"
read -rp "PRESS ENTER TO EXIT SCRIPT, AND RUN AGAIN AS $USER. "
exit 1
else
# Install Bails to tmpfs
rsync --recursive "$BAILS_DIR/bails/" "$HOME"
rsync -rvh "$BAILS_DIR/bails/" "$HOME"
# shellcheck disable=SC1091
. "$HOME"/.profile
if [ -z "$1" ]; then # Don't update or install core if ran with a parameter
install-core
else
persistent-setup
fi &

until /usr/local/lib/tpscli is-unlocked && \
/usr/local/lib/tpscli is-active Dotfiles && \
[ -d "$DOTFILES" ] && [ -w "$DOTFILES" ]; do
sleep 1
done
# Install Bails to Persistent Storage
rsync -r --remove-source-files "$BAILS_DIR"/bails/ $DOTFILES
rsync --remove-source-files --recursive "$BAILS_DIR"/ $DOTFILES/.local/share/bails
rm -rf "$BAILS_DIR"

# shellcheck disable=SC1090
. ~/.profile
link-dotfiles

. "$HOME/.profile"
(
persistent-setup &
until /usr/local/lib/tpscli is-unlocked && \
/usr/local/lib/tpscli is-active Dotfiles && \
[ -d "$DOTFILES" ] && [ -w "$DOTFILES" ]; do
sleep 1
done
# Install Bails to Persistent Storage
rsync -rvh --remove-source-files "$BAILS_DIR/bails/" $DOTFILES
rsync -rvh --remove-source-files "$BAILS_DIR"/ $DOTFILES/.local/share/bails
rm -rvf "$BAILS_DIR"
link-dotfiles
) & # Run persistent setup in background
# shellcheck disable=SC1091
[ -z "$1" ] && . install-core # Don't update core if ran with a parameter
wait
if [ -z "$1" ]; then
zenity --info --title="Bails install successful" --text="Bails $VERSION has been installed." "$ICON" --icon-name=bails128
# Exit by killing controlling terminal
echo "Bails installation complete!

Closing this window in 30 seconds, press any key to abort.
"
for ((i = 30; i >= 1; i--)); do
echo -n "$i "
read -r -t 1 -n 1 && { printf '\n%s\n' "Aborted."; exit 0; }
done
echo "
Closing terminal window..."
sleep 3
PARENT_PID=$(ps -o ppid= -p $$)
kill -9 "$PARENT_PID"
else
zenity --info --title="Bails update successful" --text="Bails has been updated to $VERSION." "$ICON" --icon-name=bails128
fi &
fi
exit 0
fi
exit 1
1 change: 0 additions & 1 deletion bails/.local/bin/backupd
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,3 @@ $BIN_DIR/backupd $((2*rescan_time))
# expire the USB that is Actually Oldest, not the one with the most adjusted age.
# the number of up-to-date backups is displayed to the user in bails-menu, whenever one expires, before and after updating/creating a backup and constantly when 0 remain updated.
# TODO make sure every backup gets marked expired after creating new descriptor wallets or encrypting existing ones.

5 changes: 1 addition & 4 deletions bails/.local/bin/bails-menu
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ export DOTFILES="/live/persistence/TailsData_unlocked/dotfiles"
export LOCAL_DIR="$DOTFILES/.local/"
export DATA_DIR="/live/persistence/TailsData_unlocked/Persistent/.bitcoin"

# Fetch installed version
# shellcheck disable=SC1091
. $LOCAL_DIR/share/bails/b --help

onlynet_onion() {
zenity --question --title='Network Privacy' --text='Bails offers two settings for connecting to the Bitcoin network. By default, Bitcoin Core connects to both clearnet and Tor (onion) peers, providing a balance between usability and privacy.
Expand Down Expand Up @@ -93,7 +90,7 @@ case "$response2" in
"Donate") xdg-open bitcoin: ;; # FIXME: change address
"Report a Bug") tor-browser https://github.com/BenWestgate/Bails/issues ;;
"About") zenity --info --window-icon="$LOCAL_DIR/share/icons/bails128.png" \
--title="About Bails" --icon-name=bails128 --text="Bails version $VERSION\n\nCopyright © 2024 Ben Westgate\n\nPlease contribute if you find Bails useful. Visit <a href='https://twitter.com/BenWestgate_'>https://twitter.com/BenWestgate_</a> for further information about the software.\nThe source code is available from <a href='https://github.com/BenWestgate/Bails'>https://github.com/BenWestgate/Bails</a>.\n\nThis is experimental software.\nDistributed under the MIT software license, see the accompanying file COPYING or <a href='https://opensource.org/licenses/MIT'>https://opensource.org/licenses/MIT</a>"; bails-menu ;;
--title="About Bails" --icon-name=bails128 --text="$($LOCAL_DIR/share/bails/b --version)\n\nCopyright © 2024 Ben Westgate\n\nPlease contribute if you find Bails useful. Visit <a href='https://twitter.com/BenWestgate_'>https://twitter.com/BenWestgate_</a> for further information about the software.\nThe source code is available from <a href='https://github.com/BenWestgate/Bails'>https://github.com/BenWestgate/Bails</a>.\n\nThis is experimental software.\nDistributed under the MIT software license, see the accompanying file COPYING or <a href='https://opensource.org/licenses/MIT'>https://opensource.org/licenses/MIT</a>"; bails-menu ;;
"Online Help") xdg-open https://bitcoin-core-on-tails.slack.com/ && \
xdg-open https://t.me/bails_support ;;
"Update Bitcoin Core") gnome-terminal --title="Updating Bitcoin Core..." --hide-menubar \
Expand Down
2 changes: 1 addition & 1 deletion bails/.local/bin/bails-wallet
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ display_confirm() {
((x > 3)) && backup=" ${x}th Backup"
progress="($backups_made of $locations)"
unset share
until [ "$codex32_string" == "$share,," ]; do
until [ "$codex32_string" == "{$share,,}" ]; do
zenity --title="Create new a seed backup $progress" --text="Write this codex32 $string legibly:\n\n<big><big>$displayed</big></big>" --info --icon-name=org.gnome.TextEditor --no-wrap $ICON
choice="Create a new seed"
input_share
Expand Down
4 changes: 2 additions & 2 deletions bails/.local/bin/decrypt-vault
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ for _ in 1 2 3; do
fi
done

if (($(lsblk $loop_device | wc -l) < 3)); then
udisksctl loop-delete -b $loop_device
if (($(lsblk "$loop_device" | wc -l) < 3)); then
udisksctl loop-delete -b "$loop_device"
fi
[ -z "$wallet" ] && exit 0
exit 1
Loading