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