#!/bin/bash

set -e

echo "# <target name>	<source device>		<key file>	<options>" > /etc/crypttab
echo "nvme0n1p3_crypt UUID=$(blkid -s UUID -o value /dev/nvme0n1p3) none luks,discard" >> /etc/crypttab
apt-get -y install cryptsetup-initramfs
update-initramfs -k all -u
sed -i 's,#GRUB_DISABLE_OS_PROBER=false,GRUB_DISABLE_OS_PROBER=false,' /etc/default/grub
update-grub

cat >/etc/apt/preferences.d/mozilla <<EOF
Package: firefox
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1000

Package: thunderbird 
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1000
EOF
cat >/etc/apt/preferences.d/snapd <<EOF
Package: snapd
Pin: release a=*
Pin-Priority: -1
EOF
snap remove firefox thunderbird
# apt-get -y purge snapd
apt-get --allow-downgrades -y install firefox thunderbird

ln -s /etc/profile.d/vte-2.91.sh /etc/profile.d/vte.sh

curl -sLo /etc/apt/trusted.gpg.d/morph027-repo.asc https://packaging.gitlab.io/repo/gpg.key
echo "deb [arch=amd64] https://packaging.gitlab.io/repo/ubuntu noble main" > /etc/apt/sources.list.d/packaging.gitlab.io-ubuntu.list

curl -sfLo /etc/apt/trusted.gpg.d/signal-desktop-keyring.asc https://updates.signal.org/desktop/apt/keys.asc
echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" > /etc/apt/sources.list.d/signal-desktop.list

apt-get update
apt-get -y install \
    amtterm \
    fonts-hack-nerd \
    gnome-backgrounds \
    gnome-shell-extension-manager \
    nextcloud-desktop \
    python3-virtualenv \
    sudo \
    tilix \
    ulauncher \
    vim
