home · contact · privacy
Restructure source file tree.
[config] / buster / setup_scripts / setup_desktop.sh
1 #!/bin/sh
2 set -e
3
4 if [ "$#" -ne 1 ]; then
5     echo 'Need exactly one argument (system name).'
6     false
7 fi
8 if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ]; then
9     echo "Need legal system name."
10     false
11 fi
12 system_name="$1"
13
14 # Set up system without user environment.
15 config_tree_prefix="${HOME}/config/buster"
16 setup_scripts_dir="${config_tree_prefix}/setup_scripts"
17 cd "${setup_scripts_dir}"
18 ./setup.sh "${system_name}" ""
19 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" user "${system_name}"
20 ./install_for_target.sh user "${system_name}"
21
22 # Install Firefox directly from Mozilla.
23 firefox_release="68.0esr"
24 firefox_filename="firefox-${firefox_release}.tar.bz2"
25 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}"
26 wget "${url_firefox}"
27 mv "${firefox_filename}" /opt/
28 cd /opt/
29 tar xf "${firefox_filename}"
30 rm "${firefox_filename}"
31 ln -s /opt/firefox/firefox /usr/local/bin/
32 update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200
33 update-alternatives --set x-www-browser /opt/firefox/firefox
34
35 # Install Firefox plugins.
36 # See <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Distribution_options/Sideloading_add-ons>
37 extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/"
38 mkdir -p "${extensions_dir}"
39 umatrix_xpi="uMatrix.firefox.signed.xpi"
40 url_umatrix="https://github.com/gorhill/uMatrix/releases/download/1.3.17rc4/${umatrix_xpi}"
41 wget "${url_umatrix}"
42 name=$(unzip -p "${umatrix_xpi}" manifest.json | jq -r .applications.gecko.id)
43 mv "${umatrix_xpi}" "${name}".xpi
44 #noscript_xpi="noscript-11.0.2.xpi"
45 #url_noscript="https://secure.informaction.com/download/releases/${noscript_xpi}"
46 #wget "${url_noscript}"
47 #name=$(unzip -p "${noscript_xpi}" manifest.json | jq -r .applications.gecko.id)
48 #mv "${noscript_xpi}" "${name}.xpi"
49 tridactyl_xpi="tridactyl-latest.xpi"
50 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
51 wget "${url_tridactyl}"
52 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
53 mv "${tridactyl_xpi}" "${name}.xpi"
54 mv *.xpi "${extensions_dir}"
55
56 # Set up user environments.
57 secrets_dev="sdb"
58 source_dir_secrets="/media/${secrets_dev}/to_usb"
59 target_dir_secrets="/home/plom/tmp_secrets"
60 cd "${setup_scripts_dir}"
61 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
62 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
63 adduser --disabled-password --gecos "" plom
64 usermod -a -G sudo plom
65 passwd plom
66 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
67     echo "Put secrets drive into slot for /dev/${secrets_dev}."
68     while [ ! -e /dev/"${secrets_dev}" ]; do
69         sleep 1
70     done
71     stty -echo
72     printf "Secrets passphrase: "
73     read secrets_pass
74     stty echo
75     echo "" # newline so user knows their input return was accepted
76     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
77     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
78     chown -R plom:plom "${target_dir_secrets}"
79     pumount "${secrets_dev}"
80     echo "You can remove /dev/${secrets_dev} now."
81     cp setup_home.sh /home/plom
82     chown plom:plom /home/plom/setup_home_eeepc.sh
83     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
84 fi