From: Christian Heller Date: Mon, 6 May 2019 21:06:04 +0000 (+0200) Subject: Enhance secrets setup. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_id%7D%7D?a=commitdiff_plain;h=638ca1a8a28830427ee86251c214384853486730;p=config Enhance secrets setup. --- diff --git a/buster/setup_scripts/setup_secrets.sh b/buster/setup_scripts/setup_secrets.sh index e33a52d..25a49bb 100755 --- a/buster/setup_scripts/setup_secrets.sh +++ b/buster/setup_scripts/setup_secrets.sh @@ -1,19 +1,25 @@ #!/bin/sh set -e -if [ "$#" -ne 1 ]; then - echo 'Need exactly one argument (directory).' - false -fi -directory="$1" +dev="sdb" +source_dir="/media/${dev}/to_usb" +target_dir="${HOME}/tmp_to_usb" borgkeys_dir=~/.config/borg/keys ssh_dir=~/.ssh - -cd "${directory}" +while [ ! -e /dev/"${dev}" ]; do + echo "Put secrets drive into slot for /dev/${dev}, then hit Return." + read +done +sudo pmount /dev/"${dev}" +cp -a "${source_dir}" "${target_dir}" +sudo pumount "${dev}" +echo "You can remove /dev/${dev} now." +cd "${target_dir}" mkdir -p "${ssh_dir}" cp id_rsa ~/.ssh ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub tar xf borg_keyfiles.tar mkdir -p "${borgkeys_dir}" mv borg_keyfiles/* "${borgkeys_dir}" -rmdir borg_keyfiles +cd +rm -rf "${target_dir}"