Skip to content

Commit

Permalink
feat(setup.sh): lets user to preserve existing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-medvedev committed Jul 12, 2021
1 parent a093c3b commit 25a133c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ chmod 700 "${KEYS_DIR}"

cd "${KEYS_DIR}"

"${UTILS_DIR}/generate-random-id" -m keys -n server > "${KEYS_DIR}/keys_s"
"${UTILS_DIR}/generate-random-id" -m keys -n liteserver > "${KEYS_DIR}/keys_l"
"${UTILS_DIR}/generate-random-id" -m keys -n client > "${KEYS_DIR}/keys_c"
declare -A KEYS=( [server]=keys_s [liteserver]=keys_l [client]=keys_c )
for k in "${!KEYS[@]}"; do
if [ ! -f "${KEYS_DIR}/$k" ] || [ ! -f "${KEYS_DIR}/${KEYS[$k]}" ]; then
"${UTILS_DIR}/generate-random-id" -m keys -n "${kEYS_DIR}/$k" > "${KEYS_DIR}/${KEYS[$k]}"
fi
done

chmod 600 "${KEYS_DIR}"/*

find "${KEYS_DIR}"

mv "${KEYS_DIR}/server" "${TON_WORK_DIR}/db/keyring/$(awk '{print $1}' "${KEYS_DIR}/keys_s")"
mv "${KEYS_DIR}/liteserver" "${TON_WORK_DIR}/db/keyring/$(awk '{print $1}' "${KEYS_DIR}/keys_l")"
cp "${KEYS_DIR}/server" "${TON_WORK_DIR}/db/keyring/$(awk '{print $1}' "${KEYS_DIR}/keys_s")"
cp "${KEYS_DIR}/liteserver" "${TON_WORK_DIR}/db/keyring/$(awk '{print $1}' "${KEYS_DIR}/keys_l")"

awk '{
if (NR == 1) {
Expand Down

0 comments on commit 25a133c

Please sign in to comment.