soios/os/layers/participant/hooks/live/2000-participant.hook.chroot

48 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -eu
# Update dconf database after having put files in /etc/dconf/.
dconf update
# Configure timezone.
TIMEZONE=Europe/Zurich
echo "$TIMEZONE" > /etc/timezone
ln -sf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
# Install VS Code extensions.
VSCODE_EXTENSIONS="ms-python.python ms-vscode.cpptools swissolyinfo.soicode"
mkdir /etc/skel/.vscode
chown nobody:nogroup /etc/skel/.vscode
for ext in $VSCODE_EXTENSIONS; do
runuser -u nobody -- code --user-data-dir=/tmp/vsc.tmp \
--extensions-dir=/etc/skel/.vscode/extensions \
--install-extension="$ext"
done
chown -R root:root /etc/skel/.vscode
rm -rf /tmp/vsc.tmp
# Enable codeblocks template.
sed -i 's|// project wizards|RegisterWizard(wizProject, _T("soi"), _T("A SOI task"), _T("Console"));|' /usr/share/codeblocks/templates/wizard/config.script
# Add a default keyring to avoid a prompt to create one when launching Chromium.
mkdir -p /etc/skel/.local/share/keyrings/
chmod og= /etc/skel/.local/share/keyrings/
echo -n "Default_keyring" > /etc/skel/.local/share/keyrings/default
cat > /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= /etc/skel/.local/share/keyrings/Default_keyring.keyring
# Patch bug in live-boot.
# This is fixed upstream: https://salsa.debian.org/live-team/live-boot/-/commit/2cb049fb7502d11f344d14c567aab2592f19e77b
# Once we pull in the fix through an upgrade, we can remove the patch here.
if [ -f /lib/live/boot/9990-toram-todisk.sh ]; then
sed -i 's|dev="/dev/shm"|dev="tmpfs"|g' /lib/live/boot/9990-toram-todisk.sh
fi