#!/bin/bash # Load configuration parameter source config.sh # Varidate whether script is executed as sourced or not (return 0 2>/dev/null) && sourced=1 || sourced=0 if [ $sourced -eq 0 ] ; then cat <&2 ***** ERROR : Must execute as "sourced" ***** Execute as following : source void-kaiten-yaki.sh Installation terminated. HEREDOC exit # use "exit" instead of "return", if not "sourced" execusion fi # "sourced" validation # This is the mount point of the install target. export TARGETMOUNTPOINT="/mnt/target" # 1 : Show message during GUI/TUI installer, 0 : Do not show. export PARAINSTMSG=0 # Distribution check if ! uname -a | grep void -i > /dev/null ; then # "Void" is not found in the OS name. echo "*********************************************************************************" uname -a cat <&2 Installation terminated. HEREDOC return fi # if YES fi # "Void" is not found in the OS name. # ******************************************************************************* # Confirmation before installation # ******************************************************************************* # Common part of the parameter confirmation source common/_confirmation.sh # ******************************************************************************* # Pre-install stage # ******************************************************************************* # Install essential packages. # If GUI environment, also install xterm to run the void-installer in a window if [ ${GUIENV} -eq 1 ] ; then xbps-install -y -Su xbps gptfdisk xterm else xbps-install -y -Su xbps gptfdisk fi # Common part of the pre-install stage source common/_preinstall.sh # ADD "rd.auto=1 cryptdevice=/dev/sda2:${LUKS_NAME} root=/dev/mapper/${VGNAME}-${ROOTNAME}" to GRUB. # This is magical part. I have not understood why this is required. # Anyway, without this modification, Void Linux doesn't boot. # Refer https://wiki.voidlinux.org/Install_LVM_LUKS#Installation_using_void-installer echo "...Modify /etc/default/grub." sed -i "s#loglevel=4#loglevel=4 rd.auto=1 cryptdevice=/dev/sda2:${LUKS_NAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}#" /etc/default/grub # ******************************************************************************* # Para-install stage # ******************************************************************************* # Show common message to let the operator focus on the critical part source common/_parainstall_msg.sh # Ubuntu dependent message cat <> /etc/crypttab # Putting key file into the ramfs initial image echo "...Register key file to the ramfs" echo 'install_items+=" /etc/luks/boot_os.keyfile /etc/crypttab " ' > /etc/dracut.conf.d/10-crypt.conf # Finally, update the ramfs initial image with the key file. echo "...Upadte initramfs." xbps-reconfigure -fa echo "...grub-mkconfig." grub-mkconfig -o /boot/grub/grub.cfg echo "...update-grub." update-grub # Leave chroot HEREDOC # Unmount all echo "...Unmount all." umount -R ${TARGETMOUNTPOINT} # Finishing message cat <