#!/bin/bash #Translation export TEXTDOMAINDIR="/usr/share/locale" export TEXTDOMAIN=calamares-chili detect_distro_path() { # Define o diretório base onde as distribuições são montadas local base_dir="/run/miso/bootmnt" local distro_dir local distro # Tenta encontrar o diretório da distribuição dentro do diretório base for distro_dir in "$base_dir"/*/x86_64/; do # Verifica se o caminho é um diretório e segue o padrão esperado if [ -d "$distro_dir" ]; then # Extrai o nome da distribuição a partir do caminho distro=$(basename $(dirname "$distro_dir")) # Verifica se o nome da distribuição é válido if [[ "$distro" != "x86_64" ]]; then # Retorna o caminho completo encontrado echo "$distro_dir" break fi fi done # Caso não encontre nenhum diretório válido, retorna o default e foda-se if [ -z "$distro" ]; then echo '/run/miso/bootmnt/manjaro/x86_64/' fi } export -f detect_distro_path declare -g path_iso="$(detect_distro_path)" declare -g local_path_iso="$path_iso" touch /tmp/chili-wait-install OIFS=$IFS IFS=$'\n' rm -f /tmp/start_calamares if [ "$option" = "btrfs" ]; then # rm -f /tmp/use_disable_fsync cp -f /usr/share/bigbashview/apps/calamares/partition.conf /etc/calamares/modules/partition.conf > /tmp/start_calamares fi if [ "$option" = "ext4" ]; then # rm -f /tmp/use_disable_fsync #rm -f /etc/calamares/modules/partition.conf cp -f /usr/share/bigbashview/apps/calamares/partition.conf /etc/calamares/modules/partition.conf sed -i 's/defaultFileSystemType.*/defaultFileSystemType: "ext4"/' /etc/calamares/modules/partition.conf > /tmp/start_calamares fi if [[ "$use_custom_desktop" = "yes" ]]; then echo "--- unpack: - source: \"$path_iso/rootfs.sfs\" sourcefs: \"squashfs\" destination: \"\"" > /etc/calamares/modules/unpackfs.conf else echo "--- unpack: - source: \"$path_iso/rootfs.sfs\" sourcefs: \"squashfs\" destination: \"\" - source: \"$path_iso/desktopfs.sfs\" sourcefs: \"squashfs\" destination: \"\"" > /etc/calamares/modules/unpackfs.conf fi if [ -e "/etc/calamares/modules/packages.conf" ];then sudo rm /etc/calamares/modules/packages.conf fi if [ "$use_custom_desktop" = "yes" ]; then echo '--- backend: pacman skip_if_no_internet: false update_db: true update_system: true pacman: num_retries: 10 disable_download_timeout: true needed_only: true operations:' > /etc/calamares/modules/packages.conf if [ "$remove_packages" != "" ]; then echo ' - remove:' >> /etc/calamares/modules/packages.conf sed -i '/pacman/s/-Rs/-Rcns/' /lib/calamares/modules/chrootcfg/main.py sed -i '/pacman/s/-Rs/-Rcns/' /lib/calamares/modules/packages/main.py echo $remove_packages | tr -d '\r' > /tmp/packageRemove sed -i 's/[ ]\+/ /g' /tmp/packageRemove sed -i 's/ /\n/g' /tmp/packageRemove for package in $(cat /tmp/packageRemove); do echo " - $package" >> /etc/calamares/modules/packages.conf done fi if [ "$install_packages" != "" ]; then echo ' - install:' >> /etc/calamares/modules/packages.conf echo $install_packages | tr -d '\r' > /tmp/packageInstallList sed -i 's/[ ]\+/ /g' /tmp/packageInstallList sed -i 's/ /\n/g' /tmp/packageInstallList for package in $(cat /tmp/packageInstallList); do echo " - $package" >> /etc/calamares/modules/packages.conf done fi fi # Remove packages if [ "$less_pkgs" = "yes" ]; then # Remove old list if exist rm -f /tmp/listPkgsNoRemove.txt # Write list of packages to remove to a file in tmp echo $pkg_rm | sudo tee /tmp/listPkgsNoRemove.txt # Change ; to line break sudo sed -i 's/;/\n/g' /tmp/listPkgsNoRemove.txt # Remove packages that are in the list of packages to keep grep -Fxv -f "/tmp/listPkgsNoRemove.txt" "/tmp/pkgAvaliableToRemove.txt" > /tmp/listPkgsRemove # Checking if the file is not empty if [ -s /tmp/listPkgsRemove ]; then echo '--- backend: pacman skip_if_no_internet: false update_db: false update_system: false pacman: num_retries: 0 disable_download_timeout: false needed_only: false operations: - remove: - --cascade' > /etc/calamares/modules/packages.conf # Checking if the package is installed in the ISO to add the removal for pkg_to_remove in $(cat /tmp/listPkgsRemove); do pacman -Q $pkg_to_remove &> /dev/null if [ "$?" = "0" ]; then echo " - $pkg_to_remove" >> /etc/calamares/modules/packages.conf fi done fi fi # General configuration echo '--- modules-search: [ local ] instances: - id: initialize_pacman module: shellprocess config: shellprocess_initialize_pacman.conf - id: displaymanager_chili module: shellprocess config: shellprocess_displaymanager_chili.conf sequence: - show: - welcome - locale - keyboard - partition - users - summary - exec: - partition - mount - unpackfs - networkcfg - machineid - fstab - locale - keyboard' > /etc/calamares/settings.conf # Change desktop if [ "$use_custom_desktop" = "yes" ]; then echo ' - shellprocess@initialize_pacman - packages' >> /etc/calamares/settings.conf if [ "$login_manager" != "" ]; then echo ' - shellprocess@displaymanager_chili' >> /etc/calamares/settings.conf fi fi # Only remove packages if [ "$pkg_rm" != "" ]; then echo ' - packages' >> /etc/calamares/settings.conf fi echo ' - localecfg - luksopenswaphookcfg - luksbootkeyfile - initcpiocfg - initcpio - users - displaymanager - mhwdcfg - hwclock - services - grubcfg - grubcfg-fix - bootloader - postcfg - btrfs-fix - umount - show: - finished branding: chili prompt-install: true dont-chroot: false oem-setup: false disable-cancel: false disable-cancel-during-exec: false quit-at-end: false' >> /etc/calamares/settings.conf #add net-install if xivastudio and online if [ -n "$(lsb_release -i | grep -i xivastudio)" ];then # update package database and check if there is an internet connection windowID="$(xprop -root '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)" sleep 600 | zenity --attach="$windowID" --width=300 --progress --title=$"Wait..." --pulsate --no-cancel --auto-close --text $"Checking internet connection..." & # wait for gpg to finish while [ -n "$(top -b -d1 n1 | grep gpg$)" ]; do sleep 0.5 done sudo pacman -Sy if [ "$?" = "0" ];then if [ ! -e "/etc/calamares/modules/packages.conf" ];then echo '--- backend: pacman skip_if_no_internet: false update_db: true update_system: true pacman: num_retries: 10 disable_download_timeout: true needed_only: true' > /etc/calamares/modules/packages.conf fi sudo sed -i '/shellprocess_displaymanager/{p;s/.*/\n- id: xivastudio\n module: netinstall\n config: netinstall-xivastudio.conf/;}' /etc/calamares/settings.conf sudo sed -i "$(sed -n '/partition/{=;q}' /etc/calamares/settings.conf)s/partition/partition\n - netinstall@xivastudio/" /etc/calamares/settings.conf sudo sed -i '/localecfg/{h;s/.*/ - shellprocess@initialize_pacman\n - packages/;p;x;}' /etc/calamares/settings.conf sudo cp -fa /usr/share/bigbashview/apps/calamares/netinstall-xivastudio.conf /etc/calamares/modules/ sudo cp -fa /usr/share/bigbashview/apps/calamares/netinstall-xivastudio.yaml /etc/calamares/modules/ killall zenity else killall zenity zenity --attach="$windowID" --error --width=300 --title=$"Internet" --text $"Without internet connection...\nExtra packages installation disabled." fi fi # start keys in pacman echo '--- dontChroot: false script: - "pacman-key --init" - command: "pacman-key --populate archlinux manjaro biglinux community chili" timeout: 1200 i18n: name: "Init pacman-key"' > /etc/calamares/modules/shellprocess_initialize_pacman.conf # Change display manager echo "--- dontChroot: false script: - \"systemctl enable $login_manager\" i18n: name: \"Enable login manager\"" > /etc/calamares/modules/shellprocess_displaymanager_chili.conf IFS=$OIFS echo ' '