home · contact · privacy
a7add59929cf920ea7b574fcd627eb0998420dd3
[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 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/66.0/linux-x86_64/en-US/firefox-66.0.tar.bz2"
20 wget "${url_firefox}"
21 mv firefox-66.0.tar.bz2 /opt/
22 cd /opt/
23 tar xf firefox-66.0.tar.bz2
24 rm firefox-66.0.tar.bz2
25 ln -s /opt/firefox/firefox /usr/local/bin/
26 update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200
27 update-alternatives --set x-www-browser /opt/firefox/firefox
28
29 # Install Firefox plugins.
30 # See <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Distribution_options/Sideloading_add-ons>
31 extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/"
32 mkdir -p "${extensions_dir}"
33 noscript_xpi="noscript-10.6.xpi"
34 url_noscript="https://secure.informaction.com/download/releases/${noscript_xpi}"
35 wget "${url_noscript}"
36 name=$(unzip -p "${noscript_xpi}" manifest.json | jq -r .applications.gecko.id)
37 mv "${noscript_xpi}" "${name}.xpi"
38 tridactyl_xpi="tridactyl-1.14.9pre2457-an+fx.xpi"
39 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
40 wget "${url_tridactyl}"
41 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
42 mv "${tridactyl_xpi}" "${name}.xpi"
43 mv *.xpi "${extensions_dir}"
44
45 # Set up user environments.
46 secrets_dev="sdb"
47 source_dir_secrets="/media/${secrets_dev}/to_usb"
48 target_dir_secrets="/home/plom/tmp_secrets"
49 cd "${setup_scripts_dir}"
50 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
51 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
52 adduser --disabled-password --gecos "" plom
53 usermod -a -G sudo plom
54 passwd plom
55 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
56     echo "Put secrets drive into slot for /dev/${secrets_dev}."
57     while [ ! -e /dev/"${secrets_dev}" ]; do
58         sleep 1
59     done
60     stty -echo
61     printf "Secrets passphrase: "
62     read secrets_pass
63     stty echo
64     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
65     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
66     chown -R plom:plom "${target_dir_secrets}"
67     pumount "${secrets_dev}"
68     echo "You can remove /dev/${secrets_dev} now."
69     cp setup_home_eeepc.sh /home/plom
70     chown plom:plom /home/plom/setup_home_eeepc.sh
71     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home_eeepc.sh" plom
72 fi