add new calamares modules and scripts and new install firefox hook

This commit is contained in:
manuel 2024-09-07 12:26:32 +00:00
parent 8cc4e5fb02
commit fdb7f62c22
39 changed files with 236 additions and 20 deletions

View File

@ -2,20 +2,48 @@
CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
# Set secure permissions for the initramfs if we're configuring
# Install luks utilities if needed.
# Also, set secure permissions for the initramfs if we're configuring
# full-disk-encryption. The initramfs is re-generated later in the
# installation process so we only set the permissions snippet without
# regenerating the initramfs right now:
if [ "$(mount | grep $CHROOT" " | cut -c -16)" = "/dev/mapper/luks" ]; then
echo "UMASK=0077" > $CHROOT/etc/initramfs-tools/conf.d/initramfs-permissions
chroot $CHROOT apt-get -y install cryptsetup-initramfs cryptsetup keyutils
fi
# Update packages in the repos
chroot $CHROOT apt-get update
echo "Running bootloader-config..."
if [ -d /sys/firmware/efi/efivars ]; then
# Detect architecture and install the appropriate GRUB package
ARCH=$(uname -m)
case "$ARCH" in
x86_64)
if [ -d /sys/firmware/efi/efivars ]; then
echo " * Installing grub-efi (uefi)..."
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-efi-ia32 cryptsetup keyutils
else
echo " * install grub... (bios)"
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-pc cryptsetup keyutils
fi
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-efi-amd64
else
echo " * Installing grub-pc (bios)..."
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-pc
fi
;;
i686)
echo " * Installing grub-efi-ia32 (uefi 32-bit)..."
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-efi-ia32
;;
aarch64)
echo " * Installing grub-efi-arm64 (uefi arm64)..."
DEBIAN_FRONTEND=noninteractive chroot $CHROOT apt-get -y install grub-efi-arm64
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Re-enable os-prober:
sed -i "s/#GRUB_DISABLE_OS_PROBER=false/# OS_PROBER re-enabled by Debian Calamares installation:\nGRUB_DISABLE_OS_PROBER=false/g" $CHROOT/etc/default/grub
chroot $CHROOT /usr/sbin/update-grub

View File

Before

Width:  |  Height:  |  Size: 299 KiB

After

Width:  |  Height:  |  Size: 299 KiB

View File

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 209 KiB

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

Before

Width:  |  Height:  |  Size: 700 KiB

After

Width:  |  Height:  |  Size: 700 KiB

View File

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

View File

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 258 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

@ -76,13 +76,16 @@ sequence:
- bootloader-config
- grubcfg
- bootloader
- packages
- luksbootkeyfile
- luksopenswaphookcfg
- plymouthcfg
- initramfscfg
- initramfs
- sources-media-unmount
- sources-final
- update-system
- grub-defaults
- shellprocess
- umount
# Phase 3 - postinstall.

View File

@ -0,0 +1,6 @@
---
type: "job"
name: "grub-defaults"
interface: "process"
command: "/usr/sbin/grub-defaults"
timeout: 600

View File

@ -0,0 +1,6 @@
---
type: "job"
name: "update-system"
interface: "process"
command: "/usr/sbin/update-system"
timeout: 600

53
calamares/scripts/grub-defaults Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppermintOS Team (peppermintosteam@proton.me)
# This script configures grub defaults after Debian installation.
# Define CHROOT
CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
# Sets GRUB configuration.
# Writes the configuration to the /etc/default/grub file.
# Updates the bootloader.
# Check if CHROOT is set
if [ -z "$CHROOT" ]; then
echo "CHROOT not set. Exiting."
exit 1
fi
# Defines the variables
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Peppermint"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE=1360x768
GRUB_THEME="/boot/grub/themes/peppermint/theme.txt"
GRUB_DISABLE_OS_PROBER=false
# GRUB configuration file path
GRUB_CONFIG_FILE="$CHROOT/etc/default/grub"
# Modify the GRUB file
sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT/" $GRUB_CONFIG_FILE
sed -i "s/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=$GRUB_TIMEOUT/" $GRUB_CONFIG_FILE
sed -i "s/^GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"$GRUB_DISTRIBUTOR\"/" $GRUB_CONFIG_FILE
sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"$GRUB_CMDLINE_LINUX_DEFAULT\"/" $GRUB_CONFIG_FILE
sed -i "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX\"/" $GRUB_CONFIG_FILE
sed -i "s/^#GRUB_GFXMODE=.*/GRUB_GFXMODE=$GRUB_GFXMODE/" $GRUB_CONFIG_FILE
# Add GRUB_THEME if it doesn't exist
if ! grep -q "^GRUB_THEME=" $GRUB_CONFIG_FILE; then
echo "GRUB_THEME=\"$GRUB_THEME\"" >> $GRUB_CONFIG_FILE
else
sed -i "s#^GRUB_THEME=.*#GRUB_THEME=\"$GRUB_THEME\"#" $GRUB_CONFIG_FILE
fi
sed -i "s/^#GRUB_DISABLE_OS_PROBER=.*/GRUB_DISABLE_OS_PROBER=$GRUB_DISABLE_OS_PROBER/" $GRUB_CONFIG_FILE
# Run update-grub after modifying the file
chroot $CHROOT update-grub

35
calamares/scripts/update-system Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# Apply updates to the system
# Function to update the system
function update_system() {
# Define CHROOT
CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
# Verifying CHROOT
if [ -z "$CHROOT" ]; then
echo "Error: CHROOT is not set."
exit 1
fi
echo "Updating the system..."
# Update the package list
chroot $CHROOT /usr/bin/apt update
# Update installed packages
chroot $CHROOT /usr/bin/apt upgrade -y
# Remove unnecessary packages
chroot $CHROOT /usr/bin/apt autoremove -y
# Clean the APT cache
chroot $CHROOT /usr/bin/apt clean
echo "System successfully updated!"
}
# Run the function to update the system
update_system

View File

@ -0,0 +1,62 @@
#!/bin/bash
# Script to be used as a hook in Debian Live-Build
# to install Firefox from the official Mozilla repository along with all available language packs
# Function to set up the Mozilla repository and GPG key
setup_repository_and_key() {
echo "Setting up Mozilla repository and GPG key for Firefox..."
# Create directory to store the APT repository keyring if it doesn't exist
install -d -m 0755 /etc/apt/keyrings
# Import the Mozilla APT repository authentication key
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
# Verify the GPG key fingerprint
expected_fingerprint="35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3"
actual_fingerprint=$(gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print $0}')
if [ "$actual_fingerprint" == "$expected_fingerprint" ]; then
echo "The GPG key fingerprint matches: $actual_fingerprint."
else
echo "Verification failed: the GPG key fingerprint ($actual_fingerprint) does not match the expected one ($expected_fingerprint)."
exit 1
fi
# Add the Mozilla APT repository to the sources list
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list
# Configure APT to prioritize packages from the Mozilla repository
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' > /etc/apt/preferences.d/mozilla
# Update the package list
apt-get update
}
# Function to install Firefox and available language packs
install_firefox() {
echo "Installing Firefox and its language packs..."
# Install Firefox
apt-get install -y firefox
# Install all available Firefox language packs
apt-get install -y $(apt-cache search firefox-l10n | awk '{print $1}')
}
# Main execution of the script
main() {
setup_repository_and_key
install_firefox
echo "Firefox installation completed."
}
# Execute the main function
main

View File

@ -200,6 +200,9 @@ tumbler
tumbler-plugins-extra
ffmpegthumbnailer
xterm
git
curl
wget
grub-pc
spice-vdagent
console-setup
@ -246,10 +249,12 @@ mkdir -p $build/build/config/includes.chroot/usr/sbin
mkdir -p $build/build/config/includes.chroot/etc/lightdm
mkdir -p $build/build/config/includes.chroot/usr/share/pixmaps
mkdir -p $build/build/config/includes.chroot/usr/share/plymouth/themes
mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
#mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
mkdir -p $build/build/config/includes.chroot/etc/skel/Desktop
mkdir -p $build/build/config/includes.chroot/etc/default
mkdir -p $build/build/config/includes.chroot/boot/grub/themes
mkdir -p $build/build/config/includes.chroot/usr/lib/calamares
mkdir -p $build/build/config/includes.chroot/etc/default
mkdir -p $build/build/config/includes.chroot/boot/grub
# Copy Configs to the chroot
cp $build/userconfig/* $build/build/config/includes.chroot/etc/live/config.conf.d
@ -258,6 +263,7 @@ cp $build/hooks/live/* $build/build/config/includes.chroot/usr/lib/live/config
cp $build/hooks/normal/* $build/build/config/hooks/normal
cp $build/install-debian/* $build/build/config/includes.chroot/usr/share/pixmaps
cp $build/sources-final/* $build/build/config/includes.chroot/usr/sbin
cp $build/calamares/scripts/* $build/build/config/includes.chroot/usr/sbin
cp $build/bootloader-config/* $build/build/config/includes.chroot/usr/sbin
cp $build/grub/grub $build/build/config/includes.chroot/etc/default
@ -265,14 +271,15 @@ cp -r $build/lightdm/* $build/build/config/includes.chroot/etc/lightdm
cp -r $build/bootloaders/* $build/build/config/includes.binary
cp -r $build/repos/* $build/build/config/archives
cp -r $build/backgrounds/* $build/build/config/includes.chroot/usr/share/backgrounds
cp -r $build/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/calamares/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/configs/* $build/build/config/includes.chroot/etc/
cp -r $build/icons/* $build/build/config/includes.chroot/usr/share/icons
cp -r $build/themes/* $build/build/config/includes.chroot/usr/share/themes
#cp -r $build/desktop-base/* $build/build/config/includes.chroot/usr/share/desktop-base
#cp -r $build/plymouth/* $build/build/config/includes.chroot/usr/share/plymouth/themes
#cp -r $build/packages/* $build/build/config/packages.chroot
cp -r $build/grub/themes/* $build/build/config/includes.chroot/boot/grub/themes
cp -r $build/grub/themes $build/build/config/includes.chroot/boot/grub
cp -r $build/calamares/modules/* $build/build/config/includes.chroot/usr/lib/calamares
# build the ISO #
lb build #--debug --verbose

View File

@ -0,0 +1 @@
../packages

View File

@ -200,6 +200,9 @@ tumbler
tumbler-plugins-extra
ffmpegthumbnailer
xterm
git
curl
wget
grub-pc
spice-vdagent
console-setup
@ -247,8 +250,10 @@ mkdir -p $build/build/config/includes.chroot/usr/sbin
mkdir -p $build/build/config/includes.chroot/etc/lightdm
mkdir -p $build/build/config/includes.chroot/usr/share/pixmaps
mkdir -p $build/build/config/includes.chroot/usr/share/plymouth/themes
mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
#mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
mkdir -p $build/build/config/includes.chroot/etc/skel/Desktop
mkdir -p $build/build/config/includes.chroot/boot/grub/themes
mkdir -p $build/build/config/includes.chroot/usr/lib/calamares
mkdir -p $build/build/config/includes.chroot/etc/default
mkdir -p $build/build/config/includes.chroot/boot/grub
@ -259,6 +264,7 @@ cp $build/hooks/live/* $build/build/config/includes.chroot/usr/lib/live/config
cp $build/hooks/normal/* $build/build/config/hooks/normal
cp $build/install-debian/* $build/build/config/includes.chroot/usr/share/pixmaps
cp $build/sources-final/* $build/build/config/includes.chroot/usr/sbin
cp $build/calamares/scripts/* $build/build/config/includes.chroot/usr/sbin
cp $build/bootloader-config/* $build/build/config/includes.chroot/usr/sbin
cp $build/grub/grub $build/build/config/includes.chroot/etc/default
@ -266,7 +272,7 @@ cp -r $build/lightdm/* $build/build/config/includes.chroot/etc/lightdm
cp -r $build/bootloaders/* $build/build/config/includes.binary
cp -r $build/repos/* $build/build/config/archives
cp -r $build/backgrounds/* $build/build/config/includes.chroot/usr/share/backgrounds
cp -r $build/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/calamares/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/configs/* $build/build/config/includes.chroot/etc/
cp -r $build/icons/* $build/build/config/includes.chroot/usr/share/icons
cp -r $build/themes/* $build/build/config/includes.chroot/usr/share/themes
@ -274,6 +280,7 @@ cp -r $build/themes/* $build/build/config/includes.chroot/usr/share/themes
#cp -r $build/plymouth/* $build/build/config/includes.chroot/usr/share/plymouth/themes
#cp -r $build/packages/* $build/build/config/packages.chroot
cp -r $build/grub/themes $build/build/config/includes.chroot/boot/grub
cp -r $build/calamares/modules/* $build/build/config/includes.chroot/usr/lib/calamares
# build the ISO #
lb build #--debug --verbose

View File

@ -0,0 +1 @@
../packages

View File

@ -242,14 +242,17 @@ mkdir -p $build/build/config/includes.chroot/usr/share/backgrounds
mkdir -p $build/build/config/includes.chroot/etc/calamares
mkdir -p $build/build/config/includes.chroot/usr/share/icons
mkdir -p $build/build/config/includes.chroot/usr/share/themes
mkdir -p $build/build/config/includes.chroot/etc/dpkg/origins
mkdir -p $build/build/config/includes.chroot/usr/sbin
mkdir -p $build/build/config/includes.chroot/etc/lightdm
mkdir -p $build/build/config/includes.chroot/usr/share/pixmaps
mkdir -p $build/build/config/includes.chroot/usr/share/plymouth/themes
mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
#mkdir -p $build/build/config/includes.chroot/usr/share/desktop-base
mkdir -p $build/build/config/includes.chroot/etc/skel/Desktop
mkdir -p $build/build/config/includes.chroot/etc/default
mkdir -p $build/build/config/includes.chroot/boot/grub/themes
mkdir -p $build/build/config/includes.chroot/usr/lib/calamares
mkdir -p $build/build/config/includes.chroot/etc/default
mkdir -p $build/build/config/includes.chroot/boot/grub
# Copy Configs to the chroot
cp $build/userconfig/* $build/build/config/includes.chroot/etc/live/config.conf.d
@ -258,20 +261,23 @@ cp $build/hooks/live/* $build/build/config/includes.chroot/usr/lib/live/config
cp $build/hooks/normal/* $build/build/config/hooks/normal
cp $build/install-debian/* $build/build/config/includes.chroot/usr/share/pixmaps
cp $build/sources-final/* $build/build/config/includes.chroot/usr/sbin
cp $build/calamares/scripts/* $build/build/config/includes.chroot/usr/sbin
cp $build/bootloader-config/* $build/build/config/includes.chroot/usr/sbin
cp $build/grub/grub $build/build/config/includes.chroot/etc/default
cp -r $build/lightdm/* $build/build/config/includes.chroot/etc/lightdm
cp -r $build/bootloaders/* $build/build/config/includes.binary
cp -r $build/repos/* $build/build/config/archives
cp -r $build/backgrounds/* $build/build/config/includes.chroot/usr/share/backgrounds
cp -r $build/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/calamares/calamares/* $build/build/config/includes.chroot/etc/calamares
cp -r $build/configs/* $build/build/config/includes.chroot/etc/
cp -r $build/icons/* $build/build/config/includes.chroot/usr/share/icons
cp -r $build/themes/* $build/build/config/includes.chroot/usr/share/themes
#cp -r $build/desktop-base/* $build/build/config/includes.chroot/usr/share/desktop-base
#cp -r $build/plymouth/* $build/build/config/includes.chroot/usr/share/plymouth/themes
cp -r $build/packages/* $build/build/config/packages.chroot
cp -r $build/grub/themes/* $build/build/config/includes.chroot/boot/grub/themes
#cp -r $build/packages/* $build/build/config/packages.chroot
cp -r $build/grub/themes $build/build/config/includes.chroot/boot/grub
cp -r $build/calamares/modules/* $build/build/config/includes.chroot/usr/lib/calamares
# Build the ISO #
lb build #--debug --verbose

View File

@ -0,0 +1 @@
../packages