home · contact · privacy
Remove broken printer setup.
[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 # ppd_deb="hll2350dwpdrv-4.0.0-1.i386.deb"
26 # wget "https://download.brother.com/welcome/dlf103566/${ppd_deb}"
27 # dpkg --add-architecture i386
28 # apt update
29 # apt install -y "./${ppd_deb}"
30 # # lpadmin -p 'Brother_HLL2350DW' -m 'brother-HLL2350DW-cups-en.ppd'
31 # # service cups restart
32 # rm "./${ppd_deb}"
33 # # TODO explore potential lpadmin options like -o 'OutputMode=NormalGray'
34
35 # Set up user environments.
36 secrets_dev="sdb"
37 source_dir_secrets="/media/${secrets_dev}/to_usb"
38 target_dir_secrets="/home/plom/tmp_secrets"
39 cd "${setup_scripts_dir}"
40 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
41 set +e
42 HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
43 set -e
44 adduser --disabled-password --gecos "" plom
45 usermod -a -G sudo plom
46 passwd plom
47 if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then
48     echo "Put secrets drive into slot for /dev/${secrets_dev}."
49     while [ ! -e /dev/"${secrets_dev}" ]; do
50         sleep 1
51     done
52     stty -echo
53     printf "Secrets passphrase: "
54     read secrets_pass
55     stty echo
56     echo "" # newline so user knows their input return was accepted
57     echo "${secrets_pass}" | pmount /dev/"${secrets_dev}"
58     cp -a "${source_dir_secrets}" "${target_dir_secrets}"
59     chown -R plom:plom "${target_dir_secrets}"
60     pumount "${secrets_dev}"
61     echo "You can remove /dev/${secrets_dev} now."
62     cp setup_home.sh /home/plom
63     chown plom:plom /home/plom/setup_home.sh
64     SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home.sh ${system_name}" plom
65 fi