auto detect drive names
This commit is contained in:
parent
525b36dc28
commit
1c60f71446
@ -1,5 +1,5 @@
|
|||||||
DRIVE1 /dev/sda
|
DRIVE1 /dev/nvme0n1
|
||||||
DRIVE2 /dev/sdb
|
DRIVE2 /dev/nvme1n1
|
||||||
HOSTNAME nullpoint
|
HOSTNAME nullpoint
|
||||||
BOOTLOADER grub
|
BOOTLOADER grub
|
||||||
SWRAID 1
|
SWRAID 1
|
||||||
|
24
install.sh
24
install.sh
@ -95,7 +95,28 @@ fi
|
|||||||
# Update install.conf
|
# Update install.conf
|
||||||
echo "[+] Configuring installation..."
|
echo "[+] Configuring installation..."
|
||||||
cd /tmp/nullpoint
|
cd /tmp/nullpoint
|
||||||
# Update install.conf with proper escaping
|
|
||||||
|
# Auto-detect drives
|
||||||
|
echo "[+] Detecting drives..."
|
||||||
|
DRIVES=($(lsblk -dno NAME,TYPE | grep disk | awk '{print "/dev/"$1}' | sort))
|
||||||
|
if [ ${#DRIVES[@]} -lt 2 ]; then
|
||||||
|
echo "ERROR: Need at least 2 drives for RAID1, found ${#DRIVES[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
DRIVE1="${DRIVES[0]}"
|
||||||
|
DRIVE2="${DRIVES[1]}"
|
||||||
|
echo " Found drives: $DRIVE1 and $DRIVE2"
|
||||||
|
# Update install.conf with detected drives
|
||||||
|
if ! sed -i "s|^DRIVE1 .*|DRIVE1 $DRIVE1|" install.conf; then
|
||||||
|
echo "ERROR: Failed to update DRIVE1 in install.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! sed -i "s|^DRIVE2 .*|DRIVE2 $DRIVE2|" install.conf; then
|
||||||
|
echo "ERROR: Failed to update DRIVE2 in install.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update hostname
|
||||||
if ! sed -i "s/^HOSTNAME .*/HOSTNAME $HOSTNAME/" install.conf; then
|
if ! sed -i "s/^HOSTNAME .*/HOSTNAME $HOSTNAME/" install.conf; then
|
||||||
echo "ERROR: Failed to update HOSTNAME in install.conf"
|
echo "ERROR: Failed to update HOSTNAME in install.conf"
|
||||||
exit 1
|
exit 1
|
||||||
@ -224,7 +245,6 @@ echo "The installer will now run. Follow any prompts if needed."
|
|||||||
echo ""
|
echo ""
|
||||||
if ! $INSTALLIMAGE_CMD -a -c /root/install.conf -s /root/post-install.sh; then
|
if ! $INSTALLIMAGE_CMD -a -c /root/install.conf -s /root/post-install.sh; then
|
||||||
echo -e "\nERROR: Installation failed!"
|
echo -e "\nERROR: Installation failed!"
|
||||||
echo "Please check the error messages above."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user