X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=bullseye%2Fsetup_scripts%2Fsetup_desktop.sh;fp=bullseye%2Fsetup_scripts%2Fsetup_desktop.sh;h=6f4754f9ef082b9f4438534c859409e9bc7ec124;hb=15171dcfb9e48aa0311fb77948478dbca48245fa;hp=0000000000000000000000000000000000000000;hpb=e6322abd2e985e59e8320e92a5b9b3082f21375a;p=config diff --git a/bullseye/setup_scripts/setup_desktop.sh b/bullseye/setup_scripts/setup_desktop.sh new file mode 100755 index 0000000..6f4754f --- /dev/null +++ b/bullseye/setup_scripts/setup_desktop.sh @@ -0,0 +1,89 @@ +#!/bin/sh +set -e + +if [ "$#" -ne 1 ]; then + echo 'Need exactly one argument (system name).' + false +fi +if [ ! "$1" = "x220" ] && [ ! "$1" = "w530" ]; then + echo "Need legal system name." + false +fi +system_name="$1" + +# Set up system without user environment. +config_tree_prefix="${HOME}/config/bullseye" +setup_scripts_dir="${config_tree_prefix}/setup_scripts" +cd "${setup_scripts_dir}" +if [ "$1" = "x200s" ] || [ "$1" = "x220" ] || [ "$1" = "w530" ]; then + ./setup.sh "${system_name}" "" user desktop thinkpad "${system_name}" +else + ./setup.sh "${system_name}" "" user desktop "${system_name}" +fi + +# # Set up printer. +# lpadmin -p 'HP_Deskjet_F300_series' -m 'drv:///hpcups.drv/hp-deskjet_f300_series.ppd' -o 'OutputMode=NormalGray' -E +# service cups restart + +# Install Firefox directly from Mozilla. +firefox_release="91.5.0esr" +firefox_filename="firefox-${firefox_release}.tar.bz2" +url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}" +wget "${url_firefox}" +mv "${firefox_filename}" /opt/ +cd /opt/ +tar xf "${firefox_filename}" +rm "${firefox_filename}" +ln -s /opt/firefox/firefox /usr/local/bin/ +update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 +update-alternatives --set x-www-browser /opt/firefox/firefox + +# Install Firefox plugins. +# See +extensions_dir="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/" +mkdir -p "${extensions_dir}" +ublock_version="1.40.8" +ublock_xpi="$uBlock_0{ublock_version}.firefox.signed.xpi" +url_ublock="https://github.com/gorhill/uBlock/releases/download/${ublock_version}/${ublock_xpi}" +wget "${url_ublock}" +name=$(unzip -p "${ublock_xpi}" manifest.json | jq -r .applications.gecko.id) +mv "${ublock_xpi}" "${name}".xpi +tridactyl_version="1.22.0pre6103" +tridactyl_xpi="tridactyl_beta-${tridactyl_version}-an+fx.xpi" +url_tridactyl="https://tridactyl.cmcaine.co.uk/betas/${tridactyl_xpi}" +wget "${url_tridactyl}" +name=$(unzip -p "${tridactyl_xpi}" manifest.json | jq -r .applications.gecko.id) +mv "${tridactyl_xpi}" "${name}.xpi" +mv *.xpi "${extensions_dir}" + +# Set up user environments. +secrets_dev="sdb" +source_dir_secrets="/media/${secrets_dev}/to_usb" +target_dir_secrets="/home/plom/tmp_secrets" +cd "${setup_scripts_dir}" +./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root +set +e +HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?) +set -e +adduser --disabled-password --gecos "" plom +usermod -a -G sudo plom +passwd plom +if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then + echo "Put secrets drive into slot for /dev/${secrets_dev}." + while [ ! -e /dev/"${secrets_dev}" ]; do + sleep 1 + done + stty -echo + printf "Secrets passphrase: " + read secrets_pass + stty echo + echo "" # newline so user knows their input return was accepted + echo "${secrets_pass}" | pmount /dev/"${secrets_dev}" + cp -a "${source_dir_secrets}" "${target_dir_secrets}" + chown -R plom:plom "${target_dir_secrets}" + pumount "${secrets_dev}" + echo "You can remove /dev/${secrets_dev} now." + cp setup_home.sh /home/plom + chown plom:plom /home/plom/setup_home.sh + SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom +fi