diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/modules/bootloader | 42 | ||||
-rw-r--r-- | backend/modules/install_configure | 41 | ||||
-rw-r--r-- | backend/modules/install_main | 20 | ||||
-rw-r--r-- | backend/modules/partitions | 9 | ||||
-rw-r--r-- | backend/modules/partmgr | 5 |
5 files changed, 105 insertions, 12 deletions
diff --git a/backend/modules/bootloader b/backend/modules/bootloader index c4f366c..4fd4df9 100644 --- a/backend/modules/bootloader +++ b/backend/modules/bootloader @@ -54,6 +54,11 @@ function list_bootloaders() grub) echo "GRUB - GRand Unified Bootloader";; esac done + if [ -d /sys/firmware/efi ]; then + if [ -x /usr/sbin/refind-install ]; then + echo "rEFInd - Refind Bootmanager" + fi + fi } function send_bootloaders() @@ -75,6 +80,9 @@ function install_bootmanager_to_target() burg) install_burg ;; + refind) + install_refind + ;; esac } @@ -82,6 +90,15 @@ function install_grub() { rm -f $TARGET/boot/vmlinuz $TARGET/boot/System.map $TARGET/boot/initrd.img + # special handling for installs with crypttab - option was changed in some grub versions + if grep -q -v -e ^\s*$ -e ^# $TARGET/etc/crypttab; then + if grep -q GRUB_CRYPTODISK_ENABLE $TARGET/usr/sbin/grub-install; then + echo GRUB_CRYPTODISK_ENABLE=y | tee -a /etc/default/grub >> $TARGET/etc/default/grub + elif grep -q GRUB_ENABLE_CRYPTODISK $TARGET/usr/sbin/grub-install; then + echo GRUB_ENABLE_CRYPTODISK=y | tee -a /etc/default/grub >> $TARGET/etc/default/grub + fi + fi + apple=0 dmidecode -s system-manufacturer | grep -q "Apple Inc." && apple=1 @@ -154,6 +171,27 @@ function install_burg() return 0 } +function install_refind() +{ + rm -f $TARGET/boot/vmlinuz $TARGET/boot/System.map $TARGET/boot/initrd.img + + apple=0 + dmidecode -s system-manufacturer | grep -q "Apple Inc." && apple=1 + + # install refind + if [ -d /sys/firmware/efi ]; then + if is_removeable "$cfg_bootloader_target" || [ "$apple" = 1 ]; then + refind-install --usedefault "$cfg_bootloader_target" --alldrivers &>/dev/null + else + refind-install --root $TARGET &>/dev/null + fi + fi + + write_kernel_img_conf + + return 0 +} + function write_kernel_img_conf() { rm -f $TARGET/etc/kernel-img.conf @@ -161,13 +199,9 @@ cat << EOT > $TARGET/etc/kernel-img.conf # Kernel image management overrides # See kernel-img.conf(5) for details do_symlinks = yes -relative_links = yes do_bootloader = no -do_bootfloppy = no do_initrd = yes link_in_boot = no -postinst_hook = update-$cfg_bootloader -postrm_hook = update-$cfg_bootloader EOT } diff --git a/backend/modules/install_configure b/backend/modules/install_configure index 719a9c8..c0eb95b 100644 --- a/backend/modules/install_configure +++ b/backend/modules/install_configure @@ -55,6 +55,14 @@ EOF rm -f $TARGET/tmp 2>/dev/null mkdir -p $TARGET/tmp chmod 1777 $TARGET/tmp + + # create file to mount efivars (needed since bullseye) + cat <<EOF >$TARGET/tmp/fixmount +#!/bin/sh +modprobe efivarfs +mount -t efivarfs efivarfs /sys/firmware/efi/efivars +EOF + chmod ugo+x $TARGET/tmp/fixmount # create /etc/mtab as a regular file rm -f $TARGET/etc/mtab @@ -99,8 +107,15 @@ EOF [ -n "$KEYTABLE" ] && chroot_it install-keymap "$KEYTABLE" 2>/dev/null - # remove live-repo from sources.list + # remove live-repo from sources.list and delete key sed -i -e '/^# Live Media$/{N;\|\ndeb file:/live/image/debian |{N;/\n$/d}}' $TARGET/etc/apt/sources.list + sed -i -e '/^# Live Media$/{N;\|\ndeb file:/run/live/medium/debian |{N;/\n$/d}}' $TARGET/etc/apt/sources.list + sed -i -e '/^# Live Media$/{N;\|\ndeb \[signed-by=\/usr\/share\/keyrings\/live-media.gpg\] file:/run/live/medium/debian |{N;/\n$/d}}' $TARGET/etc/apt/sources.list + rm -f $TARGET/etc/apt/trusted.gpg.d/live-media.asc $TARGET/usr/share/keyrings/live-media.gpg + # remove acritoxinstaller-qt4 repo + sed -i '/[Aa]critoxinstaller-qt4/d' $TARGET/etc/apt/sources.list + # remove double empty lines + sed -i 'N;/^\n$/D;P;D;'g $TARGET/etc/apt/sources.list } # Synopsis: configure_target_purge_live_only_stuff @@ -111,10 +126,12 @@ function configure_target_purge_live_only_stuff() send install_step configure_target_purge_live_only_stuff # remove live-only-packages chroot_it dpkg --purge \ - busybox \ acritoxinstaller \ + acritoxinstaller-icons \ acritoxinstaller-kanotix \ kanotix-enable-persistent-live \ + calamares \ + calamares-settings-kanotix \ live-boot-initramfs-tools \ live-boot \ live-initramfs \ @@ -136,6 +153,14 @@ function configure_target_purge_live_only_stuff() gfxoverlay \ zram &> /dev/null + # remove unused stuff + chroot_it apt-get autoremove --purge --yes &> /dev/null + + # execute above configured fix for efi (new since bullseye) + if [ -d /sys/firmware/efi/efivars ]; then + chroot_it /tmp/fixmount + fi + # remove kde-config-touchpad if no touchpad is available [ "$(su "$FLL_LIVE_USER" -c "qdbus org.kde.synaptiks /modules/synaptiks org.kde.Synaptiks.isTouchpadAvailable")" = true ] && \ chroot_it dpkg --purge kde-config-touchpad @@ -157,10 +182,22 @@ function configure_target_purge_live_only_stuff() # remove kdm live shutdown hack rm -f "$TARGET/home/$cfg_username/.kde/shutdown/kdm-force-shutdown-hack" + # remove with live-boot created powermanagementprofilesrc ,will be automatically recreated at plasma5 session-startup + rm -f "$TARGET/home/$cfg_username/.config/powermanagementprofilesrc" + # remove live-only hooks rm -rf $TARGET/lib/live rm -f $TARGET/etc/profile.d/zz-live.sh rm -f $TARGET/usr/local/bin/enable_persistent_live.bash rm -f "$TARGET/home/$cfg_username/Desktop/enable_persistent.desktop" + + #remove appimage desktop files + if [ -e /run/live/medium/appimages ]; then + for appimages in /run/live/medium/appimages/* + do + appimage=$(basename $appimages) + rm -f "$TARGET/home/$cfg_username/Desktop/$appimage.desktop" + done + fi } diff --git a/backend/modules/install_main b/backend/modules/install_main index 723016d..381f2ae 100644 --- a/backend/modules/install_main +++ b/backend/modules/install_main @@ -285,6 +285,9 @@ function copy_etc_to_target() cp -a /etc/localtime $TARGET/etc/localtime cp -a /etc/default/keyboard $TARGET/etc/default/keyboard cp -a /etc/default/locale $TARGET/etc/default/locale + if [ -e /etc/locale.conf ]; then + cp -a /etc/locale.conf $TARGET/etc/locale.conf + fi cp -a /etc/locale.gen $TARGET/etc/locale.gen cp -a /etc/apt/sources.list.d/*.list $TARGET/etc/apt/sources.list.d/ cp -a /etc/machine-id $TARGET/etc/machine-id @@ -350,6 +353,23 @@ function copy_etc_to_target() $TARGET/etc/lightdm/lightdm.conf fi + # SDDM: auto login + # kde_settings.conf is written by kde-config-sddm so we provide this file in live-build + if [ -e $TARGET/etc/sddm.conf.d/kde_settings.conf ]; then + if [ "$cfg_autologin" = "on" ]; then + sed -i "s/User=kanotix/User=${cfg_username}/" $TARGET/etc/sddm.conf.d/kde_settings.conf + else + sed -i 's/User=kanotix/User=/' $TARGET/etc/sddm.conf.d/kde_settings.conf + fi + fi + if [ -e /var/lib/sddm/state.conf ]; then + mkdir $TARGET/var/lib/sddm + chroot_it chown sddm:sddm /var/lib/sddm &>/dev/null + cp -a /var/lib/sddm/state.conf $TARGET/var/lib/sddm/state.conf + sed -i "s/User=kanotix/User=${cfg_username}/" $TARGET/var/lib/sddm/state.conf + fi + + # Crypto cp -a /etc/crypttab $TARGET/etc/crypttab diff --git a/backend/modules/partitions b/backend/modules/partitions index 52c8e73..4c033c7 100644 --- a/backend/modules/partitions +++ b/backend/modules/partitions @@ -7,7 +7,10 @@ # /dev/sda function strip_live_media() { - grep -ve '^$' $(awk '{if(($2=="/live/image" || $2=="/lib/live/mount/medium") && $3=="iso9660"){gsub(/[0-9]*$/,"",$1); print "-e ^"$1; exit 0;}}' < /proc/mounts) + VENTOY_DEV=$(dmsetup deps ventoy -o devname 2>/dev/null|awk -F['()'] '{print "/dev/"$2}'|sed 's/[0-9]\+//') + VENTOY_GREP= + [ "$VENTOY_DEV" ] && VENTOY_GREP="-e $VENTOY_DEV" + grep -ve '^$' $(awk '{if(($2=="/live/image" || $2=="/lib/live/mount/medium" || $2=="/run/live/medium") && $3=="iso9660"){gsub(/[0-9]*$/,"",$1); print "-e ^"$1; exit 0;}}' < /proc/mounts) $VENTOY_GREP } # Synopsis: list_all_disks @@ -19,7 +22,7 @@ function strip_live_media() function list_all_disks() { ( - awk -vli="$(awk '{if($2=="sd"||$2=="md"||$2=="mmc"||$2=="nvme") print $1;}' /proc/devices)" 'BEGIN{m=split(li,list," ")}{for(i=1;i<=m;i++) if(($1==list[i]&&$2%16==0)||($1==list[i]&&$2==126||($1==list[i]+8&&$2%16==0))) print "/dev/"$4;}' /proc/partitions + awk -vli="$(awk '{if($2=="sd"||$2=="md"||$2=="mmc"||$2=="blkext") print $1;}' /proc/devices)" 'BEGIN{m=split(li,list," ")}{for(i=1;i<=m;i++) if(($1==list[i]&&$2%16==0)||($1==list[i]&&$1==9)) print "/dev/"$4;}' /proc/partitions ) | strip_live_media } @@ -63,7 +66,7 @@ function list_all_partitions() # /dev/mapper/cryptoroot function list_dm_partitions() { - ls /dev/mapper/* 2>/dev/null | fmt -w1 | grep -v "/control$" + ls /dev/mapper/* 2>/dev/null | fmt -w1 | grep -v "/control$" -e "/ventoy$" -e "/vtoy_persistent" } # Synopsis: (e.g.) list_all_partitions | partitions_usage_details diff --git a/backend/modules/partmgr b/backend/modules/partmgr index 281667d..942f6cd 100644 --- a/backend/modules/partmgr +++ b/backend/modules/partmgr @@ -7,9 +7,8 @@ function run_partmgr() get_root TERM=xterm /sbin/"$1" "$2" ;; - gparted|qtparted) - get_root X - "$1" "$2" + gparted) + "/usr/sbin/$1" "$2" ;; esac } |