home · contact · privacy
Mount secrets drive as root.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 6 May 2019 21:26:24 +0000 (23:26 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 6 May 2019 21:26:24 +0000 (23:26 +0200)
buster/setup_scripts/setup_eeepc.sh
buster/setup_scripts/setup_home_eeepc.sh

index fa3faeca86917c54bd9ff054e5be0332bcfe44bf..552febc311ecf7d2e8284a8e816d1a30a201bb63 100755 (executable)
@@ -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
index be52afbc2656d4a268d5cb77182941acbb2e0f5e..27b5f4dce00e8775a75fe0f0f4518b90fcb1107f 100755 (executable)
@@ -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."