home · contact · privacy
Use last working tridactyl versions.
[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 # Set up printer.
23 lpadmin -p 'HP_Deskjet_F300_series' -m 'drv:///hpcups.drv/hp-deskjet_f300_series.ppd' -o 'OutputMode=NormalGray'
24 service cups restart
25
26 # Install Firefox directly from Mozilla.
27 firefox_release="68.4.1esr"
28 firefox_filename="firefox-${firefox_release}.tar.bz2"
29 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}"
30 wget "${url_firefox}"
31 mv "${firefox_filename}" /opt/
32 cd /opt/
33 tar xf "${firefox_filename}"
34 rm "${firefox_filename}"
35 ln -s /opt/firefox/firefox /usr/local/bin/
36 update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200
37 update-alternatives --set x-www-browser /opt/firefox/firefox
38
39 # Install Firefox plugins.
40 # See <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Distribution_options/Sideloading_add-ons>
41 extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/"
42 mkdir -p "${extensions_dir}"
43 umatrix_version="1.4.0"
44 umatrix_xpi="uMatrix.firefox.xpi"
45 url_umatrix="https://github.com/gorhill/uMatrix/releases/download/${umatrix_version}/${umatrix_xpi}"
46 wget "${url_umatrix}"
47 name=$(unzip -p "${umatrix_xpi}" manifest.json | jq -r .applications.gecko.id)
48 mv "${umatrix_xpi}" "${name}".xpi
49 tridactyl_version="1.17.1pre3355"
50 tridactyl_xpi="tridactyl_beta-${tridactyl_version}-an+fx.xpi"
51 url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}"
52 wget "${url_tridactyl}"
53 name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id)
54 mv "${tridactyl_xpi}" "${name}.xpi"
55 mv *.xpi "${extensions_dir}"
56
57 # Set up user environments.
58 secrets_dev="sdb"
59 source_dir_secrets="/media/${secrets_dev}/to_usb"
60 target_dir_secrets="/home/plom/tmp_secrets"
61 cd "${setup_scripts_dir}"
62 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
63 set +e
64 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
65 set -e
66 adduser --disabled-password --gecos "" plom
67 usermod -a -G sudo plom
68 passwd plom
69 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
70     echo "Put secrets drive into slot for /dev/${secrets_dev}."
71     while [ ! -e /dev/"${secrets_dev}" ]; do
72         sleep 1
73     done
74     stty -echo
75     printf "Secrets passphrase: "
76     read secrets_pass
77     stty echo
78     echo "" # newline so user knows their input return was accepted
79     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
80     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
81     chown -R plom:plom "${target_dir_secrets}"
82     pumount "${secrets_dev}"
83     echo "You can remove /dev/${secrets_dev} now."
84     cp setup_home.sh /home/plom
85     chown plom:plom /home/plom/setup_home.sh
86     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
87 fi