PepMiniiso/pepscripts/copy-files-to-chroot.sh

64 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
# This script copies a file to the chroot and runs commands during the Debian installation process.
# setup a folder structure
mkdir /target/etc/skel/.local/share/pmostools
mkdir /target/opt/pepconf
mkdir /target/opt/pypep/dbpep
# Copy files to the chroot directory
echo "Copying files to chroot..."
cp /preseed/grub/grub /target/etc/default
cp /preseed/apps/* /target/usr/share/applications
cp /preseed/repos/multimedia.list /target/etc/apt/sources.list.d
cp /preseed/repos/peppermint.list /target/etc/apt/sources.list.d
cp /preseed/repos/sources.list /target/etc/apt
cp /preseed/conf/* /target/opt/pepconf
cp /preseed/keyrings/deb-multimedia-keyring.gpg /target/etc/apt/trusted.gpg.d
cp /preseed/keyrings/peppermint-keyring.gpg /target/etc/apt/trusted.gpg.d
cp /preseed/keyrings/deb-multimedia-keyring.gpg /target/usr/share/keyrings
cp /preseed/keyrings/peppermint-keyring.gpg /target/usr/share/keyrings
cp /preseed/database/* /target/opt/pypep/dbpep
cp /preseed/polkit/* /target/usr/share/polkit-1/actions
cp /preseed/pixmaps/* /target/usr/share/pixmaps
# Copy recursive files and sub-directories
cp -r /preseed/protools/* /target/usr/local/bin
cp -r /preseed/py/* /target/usr/lib/python3/dist-packages
cp -r /preseed/grub-themes/themes /target/boot/grub
cp -r /preseed/tools* /target/etc/skel/.local/share/pmostools
# Run a commands in the chroot
chroot /target update-initramfs -u
chroot /target update-grub
cd /target//usr/share/python-apt/templates/
ln -s Debian.info Peppermint.info
ln -s Debian.mirrors Peppermint.mirrors
cd /target/usr/share/distro-info/
ln -s debian.csv peppermint.csv
cd /target/usr/share/
ln -s -r icons pepicons
ln -s -r themes pepthemes
ls -s -r backgrounds pepwallpaper
chmod 777 pepicons
chmod 777 pepthemes
chmod 777 pepwallpaper
# Install hblock
in-target /bin/bash -c curl -o /tmp/hblock 'https://raw.githubusercontent.com/hectorm/hblock/v3.4.1/hblock' \
&& echo 'bb1f6fcafdcba6f7bd9e12613fc92b02a0a0da1263b0e44d209cb40d8715d647 /tmp/hblock' | shasum -c \
&& sudo mv /tmp/hblock /usr/local/bin/hblock \
&& sudo chown 0:0 /usr/local/bin/hblock \
&& sudo chmod 755 /usr/local/bin/hblock
exit 0