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