This repository has been archived on 2024-05-18. You can view files and clone it, but cannot push or open issues or pull requests.
soifai/config/setup-bern.sh

60 lines
2.1 KiB
Bash
Executable File

#! /bin/bash
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
FAI=/var/lib/bernconfig
target=/
apt-get install -y libnss3-tools cmake gnome-tweaks fonts-firacode
rsync --archive \
--exclude /etc/apt \
--exclude /usr/share/keyrings \
--exclude /etc/ssh \
$FAI/simplefiles/PARTICIPANT/ $target
rsync --archive \
--exclude /etc/systemd/timesyncd.conf.d \
--exclude /etc/hosts \
--exclude /etc/nftables.conf \
--exclude /root \
$FAI/simplefiles/CONTESTANT/ $target
$ROOTCMD dconf update
# Install soi header
tar --overwrite -xf $FAI/downloads/soi-header.tar.gz -C $target/usr/local/include --strip-components=2 soi-header/include/
sed -i 's|"homepage": ".*"|"homepage": "https://finals.soi.ch/"|' $target/etc/chromium/master_preferences
sed -i 's|"homepage_is_newtabpage": true,|"homepage_is_newtabpage": false,|' $target/etc/chromium/master_preferences
# Disable sleep
$ROOTCMD systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
# Disable panels in gnome-control-center
DISABLE_DESKTOP="$ROOTCMD dpkg-statoverride --force-statoverride-add --update --add root root 640"
$DISABLE_DESKTOP /usr/share/applications/gnome-bluetooth-panel.desktop
$DISABLE_DESKTOP /usr/share/applications/gnome-online-accounts-panel.desktop
$DISABLE_DESKTOP /usr/share/applications/gnome-sharing-panel.desktop
# Add a default keyring to avoid a prompt to create one when launching Chromium
mkdir -p $target/etc/skel/.local/share/keyrings/
chmod og= $target/etc/skel/.local/share/keyrings/
echo -n "Default_keyring" > $target/etc/skel/.local/share/keyrings/default
cat > $target/etc/skel/.local/share/keyrings/Default_keyring.keyring << EOF
[keyring]
display-name=Default keyring
ctime=0
mtime=0
lock-on-idle=false
lock-after=false
EOF
chmod og= $target/etc/skel/.local/share/keyrings/Default_keyring.keyring
# Auto login
sed -i 's/# AutomaticLoginEnable = true/AutomaticLoginEnable = true/g' $target/etc/gdm3/daemon.conf
sed -i 's/# AutomaticLogin = user1/AutomaticLogin = contestant/g' $target/etc/gdm3/daemon.conf
exit $error