From: Christian Heller Date: Mon, 6 May 2019 21:26:24 +0000 (+0200) Subject: Mount secrets drive as root. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/ledger?a=commitdiff_plain;h=698a73e4a203ae4271b9d3670e594ed3a9bc4410;p=config Mount secrets drive as root. --- diff --git a/buster/setup_scripts/setup_eeepc.sh b/buster/setup_scripts/setup_eeepc.sh index fa3faec..552febc 100755 --- a/buster/setup_scripts/setup_eeepc.sh +++ b/buster/setup_scripts/setup_eeepc.sh @@ -43,12 +43,24 @@ mv "${tridactyl_xpi}" "${name}.xpi" mv *.xpi "${extensions_dir}" # Set up user environments. +secrets_dev="sdb" +source_dir_secrets="/media/${secrets_dev}/to_usb" +target_dir_secrets="/home/plom/tmp_secrets" cd "${setup_scripts_dir}" ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?) adduser --disabled-password --gecos "" plom usermod -a -G sudo plom if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then + while [ ! -e /dev/"${secrets_dev}" ]; do + echo "Put secrets drive into slot for /dev/${secrets_dev}, then hit Return." + read ignore + done + pmount /dev/"${secrets_dev}" + cp -a "${source_dir_secrets}" "${target_dir_secrets}" + chown -R plom:plom "${target_dir_secrets}" + pumount "${secrets_dev}" + echo "You can remove /dev/${secrets_dev} now." cp setup_home_eeepc.sh /home/plom chown plom:plom /home/plom/setup_home_eeepc.sh su -c "cd && ./setup_home_eeepc.sh" plom diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home_eeepc.sh index be52afb..27b5f4d 100755 --- a/buster/setup_scripts/setup_home_eeepc.sh +++ b/buster/setup_scripts/setup_home_eeepc.sh @@ -5,9 +5,7 @@ public_repos_dir="${HOME}/public_repos" config_tree_prefix="${public_repos_dir}/config/buster" setup_scripts_dir="${config_tree_prefix}/setup_scripts" repos_list_file="${public_repos_dir}/repos" -secrets_dev="sdb" -source_dir="/media/${secrets_dev}/to_usb" -target_dir="${HOME}/tmp_to_usb" +dir_secrets="${HOME}/tmp_secrets" borgkeys_dir=~/.config/borg/keys ssh_dir=~/.ssh @@ -28,15 +26,7 @@ cat "${repos_list_file}" | while read line; do ensure_repo "${line}" done curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash -while [ ! -e /dev/"${secrets_dev}" ]; do - echo "Put secrets drive into slot for /dev/${secrets_dev}, then hit Return." - read ignore -done -sudo pmount /dev/"${secrets_dev}" -cp -a "${source_dir}" "${target_dir}" -sudo pumount "${secrets_dev}" -echo "You can remove /dev/${secrets_dev} now." -cd "${target_dir}" +cd "${dir_secrets}" mkdir -p "${ssh_dir}" echo "Setting up .ssh" cp id_rsa ~/.ssh @@ -45,5 +35,5 @@ tar xf borg_keyfiles.tar mkdir -p "${borgkeys_dir}" mv borg_keyfiles/* "${borgkeys_dir}" cd -rm -rf "${target_dir}" +rm -rf "${dir_secrets}" echo "TODO: As tridactyl user, don't forget to do :source on the first Firefox run and then re-start."