home · contact · privacy
Enhance w530 bookworm setup.
[config] / bookworm / setup_scripts / setup_home.sh
1 #!/bin/sh
2 set -e
3 debian_version="bookworm"
4 legal_system_names="x220 w530"
5
6 if [ "$#" -ne 1 ]; then
7     echo 'Need exactly one argument (system name).'
8     false
9 fi
10 found=0
11 for system_name_i in $legal_system_names; do
12     if [ "$1" = "$system_name_i" ]; then
13         found=1
14         system_name="${system_name_i}"
15         continue        
16     fi
17 done
18 if [ "$found" = 0 ]; then
19     echo "Need legal system name."
20     false
21 fi
22 system_name="$1"
23
24 # config_tree_prefix="${public_repos_dir}/config/${debian_version}"
25 git clone https://plomlompom.com/repos/clone/config
26 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "${HOME}" minimal user "${system_name}"
27
28 # public_repos_dir="${HOME}/public_repos"
29 # config_tree_prefix="${public_repos_dir}/config/${debian_version}"
30 # # path_borgscript="${config_tree_prefix}//borg.sh"
31 # setup_scripts_dir="${config_tree_prefix}/setup_scripts"
32 # repos_list_file="${public_repos_dir}/repos"
33 # # dir_secrets="${HOME}/tmp_secrets"
34 # # borgkeys_dir=~/.config/borg/keys
35 # # borgrepos_file=~/.borgrepos
36 # ssh_dir=~/.ssh
37 # # authinfo_file=.authinfo
38 # maildir=~/mail/maildir
39
40 # ensure_repo() {
41 #     repo_name="${1}"
42 #     if [ ! -d "${public_repos_dir}/${repo_name}" ]; then
43 #         cd "${public_repos_dir}"
44 #         git clone plom@plomlompom.com:/var/repos/${repo_name}
45 #     fi
46 # }
47
48 # # Set up iniitial non-public parts of infrastructure: SSH authentication.
49 # cd "${dir_secrets}"
50 # mkdir -p "${ssh_dir}"
51 # echo "Setting up .ssh"
52 # cp id_rsa ~/.ssh
53 # stty -echo
54 # ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
55 # stty echo
56 # eval $(ssh-agent)
57 # ssh-add
58 # ssh-keyscan -H "plomlompom.com" >> ~/.ssh/known_hosts
59
60 # # Clone config to copy dotfiles etc. from it.
61 # cd
62 # mkdir -p "${public_repos_dir}"
63 # ensure_repo config
64 # cd "${setup_scripts_dir}"
65 # ./copy_dirtree.sh "${config_tree_prefix}/home_files" "${HOME}" minimal user "${system_name}"
66
67 # # Set up native messenger for tridactyl.
68 # version='ef9f02d0da258f68d7faf8898707f6d83d90d07a'
69 # curl -fsSl "https://raw.githubusercontent.com/tridactyl/tridactyl/${version}/native/install.sh" | bash
70
71 # # Set up further non-public parts of infrastructure.
72 # cd "${dir_secrets}"
73 # script -c 'gpg --import secret_keys.asc' /dev/null
74 # tar xf borg_keyfiles.tar
75 # mkdir -p "${borgkeys_dir}"
76 # mv borg_keyfiles/* "${borgkeys_dir}"
77 # # .authinfo may not be present on every secrets drive yet
78 # if [ -f "${authinfo_file}" ]; then
79 #     cp "${authinfo_file}" ~
80 # fi
81 # cd
82 # rm -rf "${dir_secrets}"
83
84 # # Sync org dir via borgbackup. For this we need the borgbackup servers
85 # # in our .ssh/known_hosts file.
86 # cat "${borgrepos_file}" | while read line; do
87 #     first_char=$(echo "${line}" | cut -c1)
88 #     if [ "${first_char}" = "#" ]; then
89 #         continue
90 #     fi
91 #     server=$(echo "${line}" | sed 's/.*@//')
92 #     ssh-keyscan "${server}" >> "${ssh_dir}"/known_hosts
93 # done
94 # BORG_PASSPHRASE="${SECRETS_PASS}" "${path_borgscript}" orgpull
95
96 # # Fill ~/public_repos.
97 # cat "${repos_list_file}" | while read line; do
98 #     first_char=$(echo "${line}" | cut -c1)
99 #     if [ "${first_char}" = "#" ]; then
100 #         continue
101 #     fi
102 #     ensure_repo "${line}"
103 # done
104
105 # # Set up e-mail system. Note that we only do mbsync if the imap pass file
106 # # is found. It may not be present on every secrets drive yet, so we have to
107 # # deal with the possibility of it being absent at this point.
108 # mkdir -p "${maildir}"  # expected by mbsync/isync
109 # if [ -f "${HOME}/${authinfo_file}" ]; then
110 #     mbsync -a
111 #     notmuch new
112 # fi
113
114 # # # Final note on how to integrate tridactyl.
115 # # echo "TODO: As tridactyl user, don't forget to do :source on the first Firefox run, wait a little while (Tridactyl needs to walk through all commands in the .tridactylrc) and then re-start."