From 6c7050888fc79ffb5690b0488a0dbb007a80f9fa Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 10 Nov 2021 11:32:14 +0100 Subject: [PATCH] Correct gpg tty on su/sudo --- setup.sh | 12 ++++-------- setup_bloxberg.sh | 16 +--------------- setup_key.sh | 4 +++- setup_path.sh | 18 ++++++++++++++++++ systemd/cic-cache-tracker.service | 4 ---- 5 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 setup_path.sh diff --git a/setup.sh b/setup.sh index 7b82e97..72e4e62 100644 --- a/setup.sh +++ b/setup.sh @@ -5,6 +5,7 @@ want_cicada_version=0.0.1a7 want_evm=bloxberg . aux/bdbg/bdbg.sh + _level=2 _debug=1 @@ -20,8 +21,7 @@ if [ "$UID" -eq 0 ]; then fi . setup_check.sh - - +. setup_path.sh dbg $dbg_debug "importing keys" for f in ./keys/*.asc; do @@ -118,8 +118,7 @@ if [ $update -gt 0 ]; then debug_flag="-v" fi pip install --index-url $PIP_INDEX_URL --extra-index-url $PIP_EXTRA_INDEX_URL $PIP_EXTRA_ARGS $debug_flag -r requirements.txt - - dbg $dbg_debug "executing database migrations" + update_path $HOME/.local/bin fi @@ -163,11 +162,8 @@ dbg $dbg_debug "execute database migrations" mkdir -vp $HOME/.local/share/cic/cache -python ../cic-internal-integration/apps/cic-cache/scripts/migrate.py -c /home/lash/.config/cic/cache/ +python ../cic-internal-integration/apps/cic-cache/scripts/migrate.py -c $HOME/.config/cic/cache/ if [ ! -z $want_evm ]; then . setup_${want_evm}.sh fi - - - diff --git a/setup_bloxberg.sh b/setup_bloxberg.sh index d02a503..2f6e3f0 100644 --- a/setup_bloxberg.sh +++ b/setup_bloxberg.sh @@ -27,21 +27,7 @@ if [ ! -d $OPENETHEREUM_RUN ]; then chmod 400 $OPENETHEREUM_RUN/bootnode.pwd fi -_IFS=$IFS -IFS=: -read -rapaths <<< "$PATH" -matchpath= -for f in ${paths[@]}; do - if [ "$f" == "$openethereum_dir" ]; then - matchpath=1 - fi -done - -if [ -z "$matchpath" ]; then - dbg dbg_info "Adding bloxberg executable path $openethereum_dir to \$PATH" - export PATH=$PATH:$openethereum_dir - echo "export PATH=\$PATH:$openethereum_dir" >> $HOME/.bashrc -fi +update_path $openethereum_dir if [ ! -z "$install_env" ]; then popd diff --git a/setup_key.sh b/setup_key.sh index 13ef6a5..1092af2 100644 --- a/setup_key.sh +++ b/setup_key.sh @@ -1,3 +1,5 @@ +export GPG_TTY=$(tty) + echo You have not selected a key to use. We will now make a new one. echo The personal details you provide below will not be shared anywhere without getting your permission first. @@ -42,6 +44,6 @@ mkdir -vp $HOME/.config/cic/staff-client/.gnupg chmod 0700 -v $HOME/.config/cic/staff-client/.gnupg gpg --homedir $t --export-secret-keys | gpg --homedir $HOME/.config/cic/staff-client/.gnupg --import -#gpg --homedir $HOME/.config/cic/staff-client/.gnupg --export -a > $HOME/.config/cic/staff-client/user.asc +gpg --homedir $HOME/.config/cic/staff-client/.gnupg --export -a > $HOME/.config/cic/staff-client/user.asc gpg --list-packets $HOME/.config/cic/staff-client/user.asc | awk '/issuer fpr/ { print $9; }' | cut -b -40 > $HOME/.config/cic/staff-client/key_fingerprint diff --git a/setup_path.sh b/setup_path.sh new file mode 100644 index 0000000..3378baf --- /dev/null +++ b/setup_path.sh @@ -0,0 +1,18 @@ +function update_path { + pathdir=$1 + _IFS=$IFS + IFS=: + read -rapaths <<< "$PATH" + matchpath= + for f in ${paths[@]}; do + if [ "$f" == "$pathdir" ]; then + matchpath=1 + fi + done + if [ -z "$matchpath" ]; then + dbg dbg_info "Adding executable path $pathdir to \$PATH" + export PATH=$PATH:$pathdir + echo "export PATH=\$PATH:$pathdir" >> $HOME/.bashrc + fi + IFS=$_IFS +} diff --git a/systemd/cic-cache-tracker.service b/systemd/cic-cache-tracker.service index b38162f..91a4ca5 100644 --- a/systemd/cic-cache-tracker.service +++ b/systemd/cic-cache-tracker.service @@ -3,10 +3,6 @@ Description=CIC transaction cache syncer After=network.target [Service] -Environment="RPC_PROVIDER=http://localhost:8545" -Environment="CHAIN_SPEC=evm:byzantium:8995:bloxberg" -Environment="CIC_REGISTRY=ADDRESS={{CIC_REGISTRY_ADDRESS}}" -Environment="CIC_TRUST_ADDRESS={{CIC_TRUST_ADDRESS}}" ExecStart="cic-cache-trackerd -c %h/.config/cic/cache" Restart=always