home · contact · privacy
Outsource Firefox setup to own script.
[config] / bullseye / 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" = "x220" ] && [ ! "$1" = "w530" ]; 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/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}"
20 else
21   ./setup.sh "${system_name}" "" user desktop "${system_name}"
22 fi
23
24 # # Set up printer.
25 # lpadmin -p 'HP_Deskjet_F300_series' -m 'drv:///hpcups.drv/hp-deskjet_f300_series.ppd' -o 'OutputMode=NormalGray' -E
26 # service cups restart
27
28 # Set up user environments.
29 secrets_dev="sdb"
30 source_dir_secrets="/media/${secrets_dev}/to_usb"
31 target_dir_secrets="/home/plom/tmp_secrets"
32 cd "${setup_scripts_dir}"
33 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
34 set +e
35 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
36 set -e
37 adduser --disabled-password --gecos "" plom
38 usermod -a -G sudo plom
39 passwd plom
40 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
41     echo "Put secrets drive into slot for /dev/${secrets_dev}."
42     while [ ! -e /dev/"${secrets_dev}" ]; do
43         sleep 1
44     done
45     stty -echo
46     printf "Secrets passphrase: "
47     read secrets_pass
48     stty echo
49     echo "" # newline so user knows their input return was accepted
50     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
51     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
52     chown -R plom:plom "${target_dir_secrets}"
53     pumount "${secrets_dev}"
54     echo "You can remove /dev/${secrets_dev} now."
55     cp setup_home.sh /home/plom
56     chown plom:plom /home/plom/setup_home.sh
57     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
58 fi