#!/bin/bash # Load configuration parameter source config.sh # Load functions source common/confirmation.sh source common/preinstall.sh source common/parainstall.sh source common/parainstall_msg.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 ubuntu-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="/target" # 1 : Show message during GUI/TUI installer, 0 : Do not show. export PARAINSTMSG=1 # Distribution check if ! uname -a | grep ubuntu -i > /dev/null ; then # "Ubuntu" is not found in the OS name. echo "*******************************************************************************" uname -a cat <&2 Installation terminated. HEREDOC return fi # if YES fi # "Ubuntu" is not found in the OS name. # ******************************************************************************* # Confirmation before installation # ******************************************************************************* # Common part of the parameter confirmation if ! confirmation ; then return 1 fi # ******************************************************************************* # Pre-install stage # ******************************************************************************* # Common part of the pre-install stage if ! pre_install ; then return 1 fi # ******************************************************************************* # Para-install stage # ******************************************************************************* # Show common message to let the operator focus on the critical part if ! parainstall ; then return 1 fi # Ubuntu dependent message cat <> /etc/crypttab # Putting key file into the ramfs initial image echo "...Register key file to the ramfs" echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf # Finally, update the ramfs initial image with the key file. echo "...Upadte initramfs." update-initramfs -uk all # Leave chroot HEREDOC # Unmount all echo "...Unmount all." umount -R ${TARGETMOUNTPOINT} # Finishing message cat <