Refactored code again

This commit is contained in:
Suikan 2021-07-01 14:46:59 +09:00
parent 488c998048
commit 53c4426a98
3 changed files with 20 additions and 17 deletions

View file

@ -2,9 +2,6 @@
# Common part of para-install
# *******************************************************************************
# Record the PID of the installer.
installer_pid=$!
# While the /etc/default/grub in the install target is NOT existing, keep sleeping.
# If installer terminated without file copy, this script also terminates.
while [ ! -e ${TARGETMOUNTPOINT}/etc/default/grub ]

View file

@ -78,6 +78,9 @@ read dummy_var
# Start Ubiquity installer
ubiquity &
# Record the PID of the installer.
installer_pid=$!
# Common part of the para-install.
# Record the install PID, modify the /etc/default/grub of the target,
# and then, wait for the end of sintaller.
@ -88,17 +91,17 @@ source _parainstall.sh
# *******************************************************************************
## Mount the target file system
# /target is created by the Ubiquity installer
echo "...Mount /dev/mapper/${VGNAME}-${LVROOTNAME} on /target."
mount /dev/mapper/${VGNAME}-${LVROOTNAME} /target
# ${TARGETMOUNTPOINT} is created by the GUI/TUI installer
echo "...Mount /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
mount /dev/mapper/${VGNAME}-${LVROOTNAME} ${TARGETMOUNTPOINT}
# And mount other directories
echo "...Mount all other dirs."
for n in proc sys dev etc/resolv.conf; do mount --rbind "/$n" "/target/$n"; done
for n in proc sys dev etc/resolv.conf; do mount --rbind "/$n" "${TARGETMOUNTPOINT}/$n"; done
# Change root and create the keyfile and ramfs image for Linux kernel.
echo "...Chroot to /target."
cat <<HEREDOC | chroot /target /bin/bash
echo "...Chroot to ${TARGETMOUNTPOINT}."
cat <<HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
# Mount the rest of partitions by target /etc/fstab
mount -a
@ -133,7 +136,7 @@ HEREDOC
# Unmount all
echo "...Unmount all."
umount -R /mnt/target
umount -R ${TARGETMOUNTPOINT}
# Finishing message
cat <<HEREDOC

View file

@ -89,6 +89,9 @@ else
void-installer &
fi
# Record the PID of the installer.
installer_pid=$!
# Common part of the para-install.
# Record the install PID, modify the /etc/default/grub of the target,
# and then, wait for the end of sintaller.
@ -99,17 +102,17 @@ source _parainstall.sh
# *******************************************************************************
## Mount the target file system
# /mnt/target is created by the void-installer
echo "...Mount /dev/mapper/${VGNAME}-${LVROOTNAME} on /mnt/target."
mount /dev/mapper/${VGNAME}-${LVROOTNAME} /mnt/target
# ${TARGETMOUNTPOINT} is created by the GUI/TUI installer
echo "...Mount /dev/mapper/${VGNAME}-${LVROOTNAME} on ${TARGETMOUNTPOINT}."
mount /dev/mapper/${VGNAME}-${LVROOTNAME} ${TARGETMOUNTPOINT}
# And mount other directories
echo "...Mount all other dirs."
for n in proc sys dev etc/resolv.conf; do mount --rbind "/$n" "/mnt/target/$n"; done
for n in proc sys dev etc/resolv.conf; do mount --rbind "/$n" "${TARGETMOUNTPOINT}/$n"; done
# Change root and create the keyfile and ramfs image for Linux kernel.
echo "...Chroot to /target."
cat <<HEREDOC | chroot /mnt/target /bin/bash
echo "...Chroot to ${TARGETMOUNTPOINT}."
cat <<HEREDOC | chroot ${TARGETMOUNTPOINT} /bin/bash
# Mount the rest of partitions by target /etc/fstab
mount -a
@ -148,7 +151,7 @@ HEREDOC
# Unmount all
echo "...Unmount all."
umount -R /mnt/target
umount -R ${TARGETMOUNTPOINT}
# Finishing message
cat <<HEREDOC