mirror of
https://github.com/suikan4github/kaiten-yaki.git
synced 2025-12-20 02:21:17 -03:00
commit
f1323b4673
5 changed files with 44 additions and 44 deletions
|
|
@ -5,7 +5,7 @@ The followings are the list of functionalities:
|
|||
- Ubuntu and Void Linux support.
|
||||
- Help to install from LiveCD/USB.
|
||||
- Invoke GUI/TUI installer automatically at the middle of script execution, for the ease of installation.
|
||||
- Automatic detection of EFI firmware and create GPT (The BIOS detection and MBR creation function exist. But they are not test from v1.3.0).
|
||||
- Automatic detection of EFI firmware and create GPT (The BIOS detection and MBR creation function exist. But they are not tested from v1.3.0).
|
||||
- Create an EFI partition, if needed.
|
||||
- Support multiple boot in a LUKS partition.
|
||||
- Support btrfs in addition to the major file systems.
|
||||
|
|
@ -59,7 +59,7 @@ These scripts are based on the script by [myn's diary](https://myn.hatenablog.jp
|
|||
|
||||
Also, the following documents were very important to study how Void Linux installation works.
|
||||
- [Full Disk Encryption](https://docs.voidlinux.org/installation/guides/fde.html) in the Void Handbook.
|
||||
- [Install LVM LUKS](https://wiki.voidlinux.org/Install_LVM_LUKS) (deprecated)
|
||||
- [Install LVM LUKS](https://wiki.voidlinux.org/Install_LVM_LUKS) (deprecated)[[archive](https://web.archive.org/web/20201112031114/https://wiki.voidlinux.org/Install_LVM_LUKS)].
|
||||
# Kaiten-yaki
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Configuration parameters for Kaiten-Yaki
|
||||
|
||||
# Storage device to install the linux.
|
||||
# Storage device to install Linux.
|
||||
export DEV="/dev/sda"
|
||||
|
||||
# Whether you want to erase all contents of the storage device or not.
|
||||
|
|
@ -26,7 +26,7 @@ export LVROOTNAME="anko"
|
|||
# You will have
|
||||
# anko
|
||||
# anko_home
|
||||
# You will not have anko_var because the USELVEXT2=0.
|
||||
# You will not have anko_var because of the USELVEXT2=0.
|
||||
export USELVEXT1=0
|
||||
export LVEXT1SUFFIX="_home"
|
||||
export USELVEXT2=0
|
||||
|
|
@ -50,10 +50,10 @@ export EFISIZE="200M"
|
|||
export LVSWAPSIZE="8G"
|
||||
|
||||
# Logical volume size of the Linux installation.
|
||||
# There are four posibble way to specify the volume.
|
||||
# nnnM, nnnG, nnnT : Absolute size speicification. nnnMbyte, nnnGByte, nnnT byte.
|
||||
# There are four posibble ways to specify the volume.
|
||||
# nnnM, nnnG, nnnT : Absolute size specification. nnnMbyte, nnnGByte, nnnT byte.
|
||||
# mm%VG : Use mm% of the entire volume group.
|
||||
# mm%FREE : Use mm% of the avairable storage are in the volume group.
|
||||
# mm%FREE : Use mm% of the available storage in the volume group.
|
||||
export LVROOTSIZE="10G"
|
||||
|
||||
# Logical volume size of the optional volumes.
|
||||
|
|
@ -85,7 +85,7 @@ if [ -d /sys/firmware/efi ]; then
|
|||
export ISEFI=1 # Yes, EFI
|
||||
else
|
||||
export ISEFI=0 # No, BIOS
|
||||
fi # is EFI firmaare?
|
||||
fi # is it EFI firmware?
|
||||
|
||||
# Set partition number based on the firmware type
|
||||
if [ ${ISEFI} -ne 0 ] ; then
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ function confirmation(){
|
|||
return 1 # with error status
|
||||
fi # "-" is found in the volume name.
|
||||
|
||||
# For surre ask the your config.sh is edited
|
||||
# Make sure config.sh is edited
|
||||
cat <<- HEREDOC
|
||||
|
||||
LUKS volume partition : ${DEV}${CRYPTPARTITION}
|
||||
|
|
@ -149,7 +149,7 @@ function confirmation(){
|
|||
# -l ###%[FREE|VG|PVS|ORIGIN] : Size by relative value.
|
||||
# -L ###[M|G|T|m|g|t] : Size by absolute value.
|
||||
# Too preven the duplicated match, awk exists the process after it match the /%/ pattern.
|
||||
# If Unit is not specified, installation will fail.
|
||||
# If the unit is not specified, installation will fail.
|
||||
|
||||
LVSWAPSIZE=$(echo "${LVSWAPSIZE}" | awk '/%/{print "-l", $0; exit} /M|G|T|m|g|t/{print "-L", $0}')
|
||||
export LVSWAPSIZE
|
||||
|
|
@ -228,7 +228,7 @@ function pre_install() {
|
|||
echo "[Kaiten-Yaki] Opening a crypt partition \"${DEV}${CRYPTPARTITION}\" as \"${CRYPTPARTNAME}\""
|
||||
printf %s "${PASSPHRASE}" | cryptsetup open -d - "${DEV}${CRYPTPARTITION}" "${CRYPTPARTNAME}"
|
||||
|
||||
# Check whether successful open. If mapped, it is successful.
|
||||
# Check whether it successfully opens. If mapped, it is successful.
|
||||
if [ ! -e /dev/mapper/"${CRYPTPARTNAME}" ] ; then
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Cannot open LUKS volume "${CRYPTPARTNAME}" on "${DEV}${CRYPTPARTITION}". *****
|
||||
|
|
@ -240,7 +240,7 @@ function pre_install() {
|
|||
fi # if crypt volume is unable to open
|
||||
|
||||
# ----- Configure the LVM in LUKS volume -----
|
||||
# Check volume group ${VGNAME} exist or not
|
||||
# Check if volume group ${VGNAME} exist or not
|
||||
if vgdisplay -s "${VGNAME}" &> /dev/null ; then # if exist
|
||||
echo "[Kaiten-Yaki] Volume group \"${VGNAME}\" already exist. Skipped to create. No problem."
|
||||
echo "[Kaiten-Yaki] Activating all logical volumes in volume group \"${VGNAME}\"."
|
||||
|
|
@ -275,7 +275,7 @@ function pre_install() {
|
|||
create_ext_lv
|
||||
if [ $? -ne 0 ] ; then deactivate_and_close; return 1 ; fi;
|
||||
|
||||
else # exist and not overwriteinstall
|
||||
else # exist and not overwrite install
|
||||
cat <<- HEREDOC
|
||||
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" already exists. *****
|
||||
[Kaiten-Yaki] Check LVROOTNAME environment variable in your config.txt.
|
||||
|
|
@ -360,17 +360,17 @@ function para_install_msg() {
|
|||
# *******************************************************************************
|
||||
# Common post-install stage
|
||||
# *******************************************************************************
|
||||
# In side this script, the chrooted job is parameterrized as by evn variable TARGETCHROOTEDJOB
|
||||
# Inside this script, the chrooted job is parameterized as by evn variable TARGETCHROOTEDJOB
|
||||
function post_install() {
|
||||
## Mount the target file system
|
||||
# ${TARGETMOUNTPOINT} is created by the GUI/TUI installer
|
||||
# ${TARGETMOUNTPOINT} is created by the GUI/TUI installer.
|
||||
# ${BTRFSOPTION} is defined by the caller of this function for BTRFS formated volume.
|
||||
# ${BTRFSOPTION} have to be NOT quoted. Otherwise, mount will receive an empty
|
||||
# ${BTRFSOPTION} have to be NOT quoted. Otherwise, mount will receive an empty.
|
||||
# string as first option, when the veraible is empty.
|
||||
echo "[Kaiten-Yaki] Mounting /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
|
||||
mount ${BTRFSOPTION} /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" "${TARGETMOUNTPOINT}"
|
||||
|
||||
# And mount other directories
|
||||
# And mount other directories.
|
||||
echo "[Kaiten-Yaki] Mounting all other dirs."
|
||||
for n in proc sys dev tmp etc/resolv.conf; do mount --rbind "/$n" "${TARGETMOUNTPOINT}/$n"; done
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ function post_install() {
|
|||
echo "[Kaiten-Yaki] Disabling swap to release the LUKS volume."
|
||||
swapoff -a
|
||||
|
||||
# Close LUKS
|
||||
# Close LUKS.
|
||||
echo "[Kaiten-Yaki] Deactivating all logical volumes in volume group \"${VGNAME}\"."
|
||||
vgchange -a n "${VGNAME}"
|
||||
echo "[Kaiten-Yaki] Closing LUKS volume \"${CRYPTPARTNAME}\"."
|
||||
|
|
@ -412,7 +412,7 @@ function post_install() {
|
|||
PASSPHRASE=""
|
||||
export PASSPHRASE
|
||||
|
||||
# Finishing message
|
||||
# Finishing message.
|
||||
cat <<- HEREDOC
|
||||
****************** Install process finished ******************
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ function deactivate_and_close(){
|
|||
}
|
||||
|
||||
# *******************************************************************************
|
||||
# Delete the nwe volume if overwrite install, and close all
|
||||
# Delete the new volume if overwrite install, and close all
|
||||
# *******************************************************************************
|
||||
function on_unexpected_installer_quit(){
|
||||
echo "***** ERROR : The GUI/TUI installer terminated unexpectedly. *****"
|
||||
|
|
@ -478,7 +478,7 @@ function on_unexpected_installer_quit(){
|
|||
|
||||
|
||||
# *******************************************************************************
|
||||
# Check whether given signaure is in the system information
|
||||
# Check whether given signature is in the system information
|
||||
# *******************************************************************************
|
||||
function distribution_check(){
|
||||
if ! uname -a | grep "${DISTRIBUTIONSIGNATURE}" -i > /dev/null ; then # Signature is not found in the OS name.
|
||||
|
|
@ -537,7 +537,7 @@ function create_ext_lv() {
|
|||
echo "***** ERROR : failed to create "${VGNAME}-${LVROOTNAME}${LVEXT1SUFFIX}" . *****"
|
||||
return 1 ;
|
||||
else # if success
|
||||
IS_LVEXT2_CREATED=1 # Mark this volume is created
|
||||
IS_LVEXT2_CREATED=1 # Mark this volume as created
|
||||
fi;
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function main() {
|
|||
export DISTRIBUTIONSIGNATURE="ubuntu"
|
||||
export DISTRIBUTIONNAME="Ubuntu"
|
||||
|
||||
# Check whetehr given signature exist or not
|
||||
# Check whether given signature exist or not
|
||||
if ! distribution_check ; then
|
||||
return 1 # with error status
|
||||
fi
|
||||
|
|
@ -62,7 +62,7 @@ function main() {
|
|||
export BTRFSOPTION=""
|
||||
fi
|
||||
|
||||
# Distribution dependent finalizing. Embedd encryption key into the ramfs image.
|
||||
# Distribution dependent finalizing. Embed encryption key into the ramfs image.
|
||||
# The script is parameterized by env-variable to fit to the distribution
|
||||
post_install
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ function para_install_local() {
|
|||
# Show common message to let the operator focus on the critical part
|
||||
para_install_msg
|
||||
|
||||
# Distrobution dependent message
|
||||
# Distribution dependent message
|
||||
cat <<- HEREDOC
|
||||
|
||||
**************** CAUTION! CAUTION! CAUTION! ********************
|
||||
|
|
@ -90,7 +90,7 @@ function para_install_local() {
|
|||
[Kaiten-Yaki] Type return key to start Ubiquity.
|
||||
HEREDOC
|
||||
|
||||
# waiting for a console input
|
||||
# Waiting for a console input
|
||||
read -r
|
||||
|
||||
# Start Ubiquity installer
|
||||
|
|
@ -112,7 +112,7 @@ function para_install_local() {
|
|||
|
||||
|
||||
# *******************************************************************************
|
||||
# This function will be executed in the foreguround context, to watch the GUI installer.
|
||||
# This function will be executed in the foreground context, to watch the GUI installer.
|
||||
function grub_check_and_modify_local() {
|
||||
|
||||
# While the /etc/default/grub in the install target is NOT existing, keep sleeping.
|
||||
|
|
@ -123,16 +123,16 @@ function grub_check_and_modify_local() {
|
|||
|
||||
# Check if installer quit unexpectedly
|
||||
if ! ps $INSTALLER_PID > /dev/null ; then # If not exists
|
||||
# Delete the nwe volume if overwrite install, and close all
|
||||
# Delete the new volume if overwrite install, and close all
|
||||
on_unexpected_installer_quit
|
||||
return 1 # with error status
|
||||
fi
|
||||
done # while
|
||||
|
||||
# Perhaps, too neuvous. Wait 1 more sectond to avoid the rece condition.
|
||||
# Perhaps, too nervous. Wait 1 more second to avoid the rece condition.
|
||||
sleep 1 # 1sec.
|
||||
|
||||
# Make target GRUB aware to the crypt partition
|
||||
# Make target GRUB aware of the crypt partition
|
||||
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
||||
echo "[Kaiten-Yaki] Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
||||
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function main() {
|
|||
export DISTRIBUTIONSIGNATURE="void"
|
||||
export DISTRIBUTIONNAME="Void Linux"
|
||||
|
||||
# Check whetehr given signature exist or not
|
||||
# Check whether given signature exist or not
|
||||
if ! distribution_check ; then
|
||||
return 1 # with error status
|
||||
fi
|
||||
|
|
@ -41,7 +41,7 @@ function main() {
|
|||
# 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
|
||||
# This modification is guaratnteed once only. To allow re-trying the installation after unexpected GUI/TUI installer quit.
|
||||
# This modification is guaranteed once only. To allow re-trying the installation after unexpected GUI/TUI installer quit.
|
||||
export GRUB_ADDITIONAL_PARAMETERS="rd.auto=1 cryptdevice=${DEV}${CRYPTPARTITION}:${CRYPTPARTNAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}"
|
||||
if grep "$GRUB_ADDITIONAL_PARAMETERS" /etc/default/grub ; then # Is additonal parameter already added?
|
||||
# Yes
|
||||
|
|
@ -77,7 +77,7 @@ function main() {
|
|||
# We don't need special option for BTRFSOPTION.
|
||||
export BTRFSOPTION=""
|
||||
|
||||
# Distribution dependent finalizing. Embedd encryption key into the ramfs image.
|
||||
# Distribution dependent finalizing. Embed encryption key into the ramfs image.
|
||||
# The script is parameterized by env-variable to fit to the distribution
|
||||
post_install
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ function para_install_local() {
|
|||
# Show common message to let the operator focus on the critical part
|
||||
para_install_msg
|
||||
|
||||
# Distrobution dependent message
|
||||
# Distribution dependent message
|
||||
cat <<- HEREDOC
|
||||
|
||||
******************** CAUTION! CAUTION! CAUTION! ************************
|
||||
|
|
@ -105,10 +105,10 @@ function para_install_local() {
|
|||
[Kaiten-Yaki] Type return key to start void-installer.
|
||||
HEREDOC
|
||||
|
||||
# waiting for a console input
|
||||
# Waiting for a console input
|
||||
read -r
|
||||
|
||||
# Start the background target/etc/default/grub cheker.
|
||||
# Start the background target/etc/default/grub checker.
|
||||
# The definition of this function is down below.
|
||||
grub_check_and_modify_local &
|
||||
|
||||
|
|
@ -120,8 +120,8 @@ function para_install_local() {
|
|||
|
||||
# Check if background checker still exist
|
||||
if ps $grub_check_and_modify_id > /dev/null ; then # If exists
|
||||
# If exist, the grub was not modifyed -> void-installer termianted unexpectedly
|
||||
# Delete the nwe volume if overwrite install, and close all
|
||||
# If exist, the grub was not modifyed -> void-installer terminated unexpectedly
|
||||
# Delete the new volume if overwrite install, and close all
|
||||
on_unexpected_installer_quit
|
||||
echo "[Kaiten-Yaki] restoring modified /etc/default/grub."
|
||||
sed -i "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub
|
||||
|
|
@ -144,10 +144,10 @@ function grub_check_and_modify_local() {
|
|||
sleep 1 # 1sec.
|
||||
done # while
|
||||
|
||||
# Perhaps, too neuvous. Wait 1 more sectond to avoid the rece condition.
|
||||
# Perhaps, too nervous. Wait 1 more second to avoid the rece condition.
|
||||
sleep 1 # 1sec.
|
||||
|
||||
# Make target GRUB aware to the crypt partition
|
||||
# Make target GRUB aware of the crypt partition
|
||||
# This must do it after start of the file copy by installer, but before the end of the file copy.
|
||||
echo "[Kaiten-Yaki] Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub "
|
||||
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue