4 if [ "$#" -ne 1 ]; then
5 echo 'Need exactly one argument (system name).'
8 if [ ! "$1" = "x220" ] && [ ! "$1" = "w530" ]; then
9 echo "Need legal system name."
14 # Set up system without user environment.
15 config_tree_prefix="${HOME}/config/bullseye"
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}"
25 # lpadmin -p 'HP_Deskjet_F300_series' -m 'drv:///hpcups.drv/hp-deskjet_f300_series.ppd' -o 'OutputMode=NormalGray' -E
26 # service cups restart
28 # Install Firefox directly from Mozilla.
29 firefox_release="91.5.0esr"
30 firefox_filename="firefox-${firefox_release}.tar.bz2"
31 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}"
33 mv "${firefox_filename}" /opt/
35 tar xf "${firefox_filename}"
36 rm "${firefox_filename}"
37 ln -s /opt/firefox/firefox /usr/local/bin/
38 update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200
39 update-alternatives --set x-www-browser /opt/firefox/firefox
41 # Install Firefox plugins.
42 # See <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Distribution_options/Sideloading_add-ons>
43 extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/"
44 mkdir -p "${extensions_dir}"
45 ublock_version="1.40.8"
46 ublock_xpi="$uBlock_0{ublock_version}.firefox.signed.xpi"
47 url_ublock="https://github.com/gorhill/uBlock/releases/download/${ublock_version}/${ublock_xpi}"
49 name=$(unzip -p "${ublock_xpi}" manifest.json | jq -r .applications.gecko.id)
50 mv "${ublock_xpi}" "${name}".xpi
51 tridactyl_version="1.22.0pre6103"
52 tridactyl_xpi="tridactyl_beta-${tridactyl_version}-an+fx.xpi"
53 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
54 wget "${url_tridactyl}"
55 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
56 mv "${tridactyl_xpi}" "${name}.xpi"
57 mv *.xpi "${extensions_dir}"
59 # Set up user environments.
61 source_dir_secrets="/media/${secrets_dev}/to_usb"
62 target_dir_secrets="/home/plom/tmp_secrets"
63 cd "${setup_scripts_dir}"
64 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
66 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
68 adduser --disabled-password --gecos "" plom
69 usermod -a -G sudo plom
71 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
72 echo "Put secrets drive into slot for /dev/${secrets_dev}."
73 while [ ! -e /dev/"${secrets_dev}" ]; do
77 printf "Secrets passphrase: "
80 echo "" # newline so user knows their input return was accepted
81 echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
82 cp -a "${source_dir_secrets}" "${target_dir_secrets}"
83 chown -R plom:plom "${target_dir_secrets}"
84 pumount "${secrets_dev}"
85 echo "You can remove /dev/${secrets_dev} now."
86 cp setup_home.sh /home/plom
87 chown plom:plom /home/plom/setup_home.sh
88 SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom