Modify /boot 700M, correct printf
This commit is contained in:
parent
e0de0206bf
commit
8db49b2813
|
@ -137,7 +137,7 @@ wipefs -aqf "${inst_dev}" >/dev/null &&
|
|||
|
||||
# Format disklabel as DOS, create partition for LUKS
|
||||
if [ "${inst_boot}" == "yes" ]; then
|
||||
printf 'label: dos\n, 512M, L, *\n, , L\n' | sfdisk -q "${inst_dev}" &&
|
||||
printf 'label: dos\n, 700M, L, *\n, , L\n' | sfdisk -q "${inst_dev}" &&
|
||||
printf "[+] Create disklabel type <DOS> and partition\n"
|
||||
inst_dev_boot=$(lsblk -pnlo NAME "${inst_dev}" | sed -n 2p)
|
||||
inst_dev_pool=$(lsblk -pnlo NAME "${inst_dev}" | sed -n 3p)
|
||||
|
@ -173,7 +173,7 @@ if [ "${inst_boot}" == "yes" ]; then
|
|||
if echo "${luks_pass}" | cryptsetup -q luksFormat "${inst_dev_pool}"; then
|
||||
printf "OK!\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
@ -181,7 +181,7 @@ else
|
|||
if echo "${luks_pass}" | cryptsetup -q --type luks1 luksFormat "${inst_dev_pool}"; then
|
||||
printf "OK!\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -191,7 +191,7 @@ printf "[-] Opening volume to </dev/mapper/%s>... " "${luks_name}"
|
|||
if echo "${luks_pass}" | cryptsetup open "${inst_dev_pool}" "${luks_name}"; then
|
||||
printf "OK!\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -208,11 +208,11 @@ vgcreate ${lvm_name} /dev/mapper/${luks_name} >/dev/null &&
|
|||
# Reading size for LVs
|
||||
inst_dev_size=$(lsblk -pdno SIZE "${inst_dev_pool}" | sed 's/ \+//g')
|
||||
printf "[+] Max size for LV partition - <%s>\n" "${inst_dev_size}"
|
||||
read -rp "[?] Size{G,T,P} for lv-root (empty - all space): " lvm_root_size
|
||||
read -rp "[?] Size{M,G,T,P} for LV-root (empty - all space): " lvm_root_size
|
||||
|
||||
# Check if size is correct
|
||||
if [ -n "${lvm_root_size}" ]; then
|
||||
echo "${lvm_root_size}" | grep -qE "^[0-9]+(\.[0-9])?[GTP]$"
|
||||
echo "${lvm_root_size}" | grep -qE "^[0-9]+(\.[0-9])?[MGTP]$"
|
||||
if [ $? == 1 ]; then
|
||||
printf "%s[!] Not correct size%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
|
@ -283,7 +283,7 @@ printf "[-] Downloading rootfs tarball, wait... "
|
|||
if curl -s -o void.tar.xz ${rootfs_link}; then
|
||||
printf "OK!\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -291,7 +291,7 @@ printf "[-] Extract files from archive, wait... "
|
|||
if tar xf void.tar.xz -C /mnt; then
|
||||
printf "OK!\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -315,7 +315,7 @@ printf "[-] Syncing system and update xbps, wait..."
|
|||
if chroot /mnt xbps-install -Suy xbps >/dev/null; then
|
||||
printf "OK\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -323,7 +323,7 @@ printf "[-] Updating system, wait..."
|
|||
if chroot /mnt xbps-install -uy >/dev/null; then
|
||||
printf "OK\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -331,7 +331,7 @@ printf "[-] Installing base system, wait..."
|
|||
if chroot /mnt xbps-install -y base-system lvm2 cryptsetup grub >/dev/null; then
|
||||
printf "OK\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -339,7 +339,7 @@ printf "[-] Removing package base-voidstrap, wait... "
|
|||
if chroot /mnt xbps-remove -y base-voidstrap >/dev/null; then
|
||||
printf "OK\n"
|
||||
else
|
||||
printf "%s\n[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
printf "%s[!] ERROR!!%s\n" "${cl_red}" "${cl_normal}"
|
||||
fi
|
||||
|
||||
# Add and set passwords for users
|
||||
|
@ -362,8 +362,7 @@ printf "[+] Set language <%s>\n" "${sys_language}"
|
|||
# libc-locales are only applicable for glibc installations
|
||||
echo "${sys_locale}" >>/mnt/etc/default/libc-locales
|
||||
printf "[-] Reconfiguring locale to <%s>, wait... " "${sys_locale}"
|
||||
chroot /mnt xbps-reconfigure -f glibc-locales >/dev/null
|
||||
printf "OK!\n"
|
||||
chroot /mnt xbps-reconfigure -f glibc-locales >/dev/null && printf "OK!\n"
|
||||
|
||||
# Modify file /etc/fstab in chroot
|
||||
if [ "${inst_boot}" == "yes" ]; then
|
||||
|
@ -388,6 +387,50 @@ printf "[+] Enable LUKS in GRUB\n"
|
|||
dd bs=1 count=64 if=/dev/urandom of=/mnt/root/volume.key status=none
|
||||
echo "${luks_pass}" | cryptsetup -q luksAddKey "${inst_dev_pool}" /mnt/root/volume.key
|
||||
|
||||
# Change the permissions to protect generated the keyfile
|
||||
chmod 000 /mnt/root/volume.key
|
||||
chmod -R g-rwx,o-rwx /mnt/root/volume.key
|
||||
printf "%s\tUUID=%s\t/root/volume.key\tluks\n" "${luks_name}" "${luks_uuid}" >> \
|
||||
/mnt/etc/crypttab
|
||||
|
||||
# Configure for dracut
|
||||
printf "install_items+=\" /root/volume.key /etc/crypttab \"\n" > \
|
||||
/mnt/etc/dracut.conf.d/10-crypt.conf
|
||||
|
||||
# Install GRUB bootloader
|
||||
printf "[-] Installing GRUB to <%s>, wait...\n" "${inst_dev}"
|
||||
chroot /mnt grub-install "${inst_dev}" >/dev/null
|
||||
|
||||
# Ensure an initramfs is generated
|
||||
printf "[-] Reconfigure system, wait...\n"
|
||||
chroot /mnt xbps-reconfigure -fa >/dev/null
|
||||
printf "[+] Done!\n"
|
||||
|
||||
printf "%s=======================%s\n" "${cl_green}" "${cl_normal}"
|
||||
printf "%s[*] Swap file configure%s\n" "${cl_green}" "${cl_normal}"
|
||||
printf "%s=======================%s\n" "${cl_green}" "${cl_normal}"
|
||||
|
||||
read -rp "[?] Use swap file: (y/n) " _key
|
||||
if [ "${_key}" == "y" ]; then
|
||||
# Adding swap file
|
||||
printf "[-] Creating swap file 2Gb..."
|
||||
if dd if=/dev/zero of=/mnt/swapfile bs=2048 count=1000000; then
|
||||
printf "OK\n"
|
||||
else
|
||||
printf "[!] Error creating swap file\n"
|
||||
exit 1
|
||||
fi
|
||||
# Set up a Linux swap area
|
||||
mkswap -q /mnt/swapfile
|
||||
chmod 600 /mnt/swapfile
|
||||
printf "[+] Set up a swap file"
|
||||
# Adding swap file to /etc/fstab
|
||||
swap_uuid=$(swaplabel /mnt/swapfile | sed 's/:\s*/=/')
|
||||
printf "%s none swap sw 0 0\n" "${swap_uuid}" >> /mnt/etc/fstab
|
||||
printf "[+] Adding swap file to /etc/fstab"
|
||||
else
|
||||
printf "[+] Skipping swap file configure\n"
|
||||
fi
|
||||
# Adding swap file
|
||||
read -rp "[?] Use swap file: (y/n) " _key
|
||||
if [ "${_key}" == "y" ]; then
|
||||
|
@ -411,25 +454,6 @@ else
|
|||
printf "[+] Skipping swap file configure\n"
|
||||
fi
|
||||
|
||||
# Change the permissions to protect generated the keyfile
|
||||
chmod 000 /mnt/root/volume.key
|
||||
chmod -R g-rwx,o-rwx /mnt/root/volume.key
|
||||
printf "%s\tUUID=%s\t/root/volume.key\tluks\n" "${luks_name}" "${luks_uuid}" >> \
|
||||
/mnt/etc/crypttab
|
||||
|
||||
# Configure for dracut
|
||||
printf "install_items+=\" /root/volume.key /etc/crypttab \"\n" > \
|
||||
/mnt/etc/dracut.conf.d/10-crypt.conf
|
||||
|
||||
# Install GRUB bootloader
|
||||
printf "[-] Installing GRUB to <%s>, wait... " "${inst_dev}"
|
||||
chroot /mnt grub-install "${inst_dev}" >/dev/null
|
||||
printf "OK!\n"
|
||||
|
||||
# Ensure an initramfs is generated
|
||||
printf "[-] Reconfigure system, wait... "
|
||||
chroot /mnt xbps-reconfigure -fa >/dev/null
|
||||
printf "OK!\n"
|
||||
|
||||
printf "%s#######################%s\n" "${cl_blue}" "${cl_normal}"
|
||||
printf "%s# Finish install Void #%s\n" "${cl_blue}" "${cl_normal}"
|
||||
|
|
Loading…
Reference in New Issue