4 if [ "$#" -ne 1 ]; then
5 echo 'Need exactly one argument (system name).'
8 if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ]; then
9 echo "Need legal system name."
14 public_repos_dir="${HOME}/public_repos"
15 config_tree_prefix="${public_repos_dir}/config"
16 path_borgscript="${config_tree_prefix}/all_new_2018/borg.sh"
17 config_tree_buster="${config_tree_prefix}/buster"
18 setup_scripts_dir="${config_tree_buster}/setup_scripts"
19 repos_list_file="${public_repos_dir}/repos"
20 dir_secrets="${HOME}/tmp_secrets"
21 borgkeys_dir=~/.config/borg/keys
22 borgrepos_file=~/.borgrepos
24 authinfo_file=.authinfo
25 maildir=~/mail/maildir
29 if [ ! -d "${public_repos_dir}/${repo_name}" ]; then
30 cd "${public_repos_dir}"
31 git clone https://plomlompom.com/repos/clone/${repo_name}
35 # Clone config to copy dotfiles etc. from it.
37 mkdir -p "${public_repos_dir}"
39 cd "${setup_scripts_dir}"
40 ./copy_dirtree.sh "${config_tree_buster}/home_files" "${HOME}" minimal user "${system_name}"
42 # Set up native messenger for tridactyl.
43 curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash
45 # Set up non-public parts of infrastructure.
48 echo "Setting up .ssh"
51 ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
53 script -c 'gpg --import secret_keys.asc' /dev/null
54 tar xf borg_keyfiles.tar
55 mkdir -p "${borgkeys_dir}"
56 mv borg_keyfiles/* "${borgkeys_dir}"
57 # .authinfo may not be present on every secrets drive yet
58 if [ -f "${authinfo_file}" ]; then
59 cp "${authinfo_file}" ~
62 rm -rf "${dir_secrets}"
64 # Sync org dir via borgbackup. For this we need the borgbackup servers
65 # in our .ssh/known_hosts file.
66 cat "${borgrepos_file}" | while read line; do
67 first_char=$(echo "${line}" | cut -c1)
68 if [ "${first_char}" = "#" ]; then
71 server=$(echo "${line}" | sed 's/.*@//')
72 ssh-keyscan "${server}" >> "${ssh_dir}"/known_hosts
74 BORG_PASSPHRASE="${SECRETS_PASS}" "${path_borgscript}" orgpull
76 # Fill ~/public_repos.
77 cat "${repos_list_file}" | while read line; do
78 first_char=$(echo "${line}" | cut -c1)
79 if [ "${first_char}" = "#" ]; then
85 # Set up e-mail system. Note that we only do mbsync if the imap pass file
86 # is found. It may not be present on every secrets drive yet, so we have to
87 # deal with the possibility of it being absent at this point.
88 mkdir -p "${maildir}" # expected by mbsync/isync
89 if [ -f "${HOME}/${authinfo_file}" ]; then
94 # Final note on how to integrate tridactyl.
95 echo "TODO: As tridactyl user, don't forget to do :source on the first Firefox run and then re-start."