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