4 if [ "$#" -ne 1 ]; then
5 echo 'Need exactly one argument (system name).'
8 if [ ! "$1" = "eeepc" ] && [ ! "$1" = "x200s" ] && [ ! "$1" = "x220" ] && [ ! "$1" = "w530" ]; then
9 echo "Need legal system name."
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 if [ "$1" = "x200s" ] || [ "$1" = "x220" ] || [ "$1" = "w530" ]; then
19 ./setup.sh "${system_name}" "" user desktop thinkpad "${system_name}"
21 ./setup.sh "${system_name}" "" user desktop "${system_name}"
23 # For hibernation on lid switch to work, we need a newer kernel on the EeePC,
24 # see <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919227>.
25 if [ "${system_name}" = "eeepc" ]; then
26 apt -y install -t buster-backports linux-image-amd64
30 lpadmin -p 'HP_Deskjet_F300_series' -m 'drv:///hpcups.drv/hp-deskjet_f300_series.ppd' -o 'OutputMode=NormalGray' -E
33 # Install Firefox directly from Mozilla.
34 firefox_release="68.4.1esr"
35 firefox_filename="firefox-${firefox_release}.tar.bz2"
36 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}"
38 mv "${firefox_filename}" /opt/
40 tar xf "${firefox_filename}"
41 rm "${firefox_filename}"
42 ln -s /opt/firefox/firefox /usr/local/bin/
43 update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200
44 update-alternatives --set x-www-browser /opt/firefox/firefox
46 # Install Firefox plugins.
47 # See <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Distribution_options/Sideloading_add-ons>
48 extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/"
49 mkdir -p "${extensions_dir}"
50 umatrix_version="1.4.0"
51 umatrix_xpi="uMatrix.firefox.xpi"
52 url_umatrix="https://github.com/gorhill/uMatrix/releases/download/${umatrix_version}/${umatrix_xpi}"
54 name=$(unzip -p "${umatrix_xpi}" manifest.json | jq -r .applications.gecko.id)
55 mv "${umatrix_xpi}" "${name}".xpi
56 tridactyl_version="1.17.1pre3355"
57 tridactyl_xpi="tridactyl_beta-${tridactyl_version}-an+fx.xpi"
58 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
59 wget "${url_tridactyl}"
60 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
61 mv "${tridactyl_xpi}" "${name}.xpi"
62 mv *.xpi "${extensions_dir}"
64 # Set up user environments.
66 source_dir_secrets="/media/${secrets_dev}/to_usb"
67 target_dir_secrets="/home/plom/tmp_secrets"
68 cd "${setup_scripts_dir}"
69 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
71 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
73 adduser --disabled-password --gecos "" plom
74 usermod -a -G sudo plom
76 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
77 echo "Put secrets drive into slot for /dev/${secrets_dev}."
78 while [ ! -e /dev/"${secrets_dev}" ]; do
82 printf "Secrets passphrase: "
85 echo "" # newline so user knows their input return was accepted
86 echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
87 cp -a "${source_dir_secrets}" "${target_dir_secrets}"
88 chown -R plom:plom "${target_dir_secrets}"
89 pumount "${secrets_dev}"
90 echo "You can remove /dev/${secrets_dev} now."
91 cp setup_home.sh /home/plom
92 chown plom:plom /home/plom/setup_home.sh
93 SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom