home · contact · privacy
Fix uMatrix URL.
[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.1.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_version="1.4.0"
40 umatrix_xpi="uMatrix.firefox.xpi"
41 url_umatrix="https://github.com/gorhill/uMatrix/releases/download/${umatrix_version}/${umatrix_xpi}"
42 wget "${url_umatrix}"
43 name=$(unzip -p "${umatrix_xpi}" manifest.json | jq -r .applications.gecko.id)
44 mv "${umatrix_xpi}" "${name}".xpi
45 tridactyl_version="1.16.3pre3162"
46 tridactyl_xpi="tridactyl_beta-${tridactyl_version}-an+fx.xpi"
47 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
48 wget "${url_tridactyl}"
49 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
50 mv "${tridactyl_xpi}" "${name}.xpi"
51 mv *.xpi "${extensions_dir}"
52
53 # Set up user environments.
54 secrets_dev="sdb"
55 source_dir_secrets="/media/${secrets_dev}/to_usb"
56 target_dir_secrets="/home/plom/tmp_secrets"
57 cd "${setup_scripts_dir}"
58 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
59 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
60 adduser --disabled-password --gecos "" plom
61 usermod -a -G sudo plom
62 passwd plom
63 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
64     echo "Put secrets drive into slot for /dev/${secrets_dev}."
65     while [ ! -e /dev/"${secrets_dev}" ]; do
66         sleep 1
67     done
68     stty -echo
69     printf "Secrets passphrase: "
70     read secrets_pass
71     stty echo
72     echo "" # newline so user knows their input return was accepted
73     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
74     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
75     chown -R plom:plom "${target_dir_secrets}"
76     pumount "${secrets_dev}"
77     echo "You can remove /dev/${secrets_dev} now."
78     cp setup_home.sh /home/plom
79     chown plom:plom /home/plom/setup_home.sh
80     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
81 fi