24 lines
1.0 KiB
Bash
24 lines
1.0 KiB
Bash
#!/bin/bash
|
|
PI_SERIAL="3079dde4"
|
|
TFTP_ROOT="/volume1/rpi/tftpboot/"
|
|
ISCSI_ROOT_PARTITION="/dev/sda1"
|
|
ISCSI_ROOT_DIR="/tmp/tmp.8feKTYMg0S"
|
|
ISCSI_TARGET_IQN="iqn.2000-01.com.synology:SynologyNAS.default-target.b63ef49539c"
|
|
|
|
# Update /boot to point to the NFS mount of the TFTP folder for the Pi.
|
|
NFS_IP="192.168.1.5"
|
|
NFS_ROOT_PATH="${TFTP_ROOT}${PI_MAC}"
|
|
sudo sed -i -r -E \
|
|
"s@.*/boot +.*@${NFS_IP}:${NFS_ROOT_PATH} /boot nfs defaults,vers=4.1,proto=tcp 0 0@" \
|
|
${ISCSI_ROOT_DIR}/etc/fstab
|
|
|
|
# Update / to point to the iSCSI drive.
|
|
ISCSI_ROOT_PARTUUID=$(sudo blkid | grep ${ISCSI_ROOT_PARTITION} | tr ' ' '\n' | grep PARTUUID | cut -d '=' -f 2 | tr -d '"')
|
|
sudo sed -i -r -E \
|
|
"s@.*/ +.*@PARTUUID=${ISCSI_ROOT_PARTUUID} / ext4 _netdev,noatime 0 1@" \
|
|
${ISCSI_ROOT_DIR}/etc/fstab
|
|
|
|
# The connection to the iSCSI device is no longer needed, so clean it up.
|
|
#sudo umount ${ISCSI_ROOT_DIR}
|
|
#sudo iscsiadm --m node -T ${ISCSI_TARGET_IQN} --portal ${ISCSI_TARGET_IP}:3260 -u
|
|
#sudo iscsiadm -m node -o delete -T ${ISCSI_TARGET_IQN} --portal ${ISCSI_TARGET_IP}:3260 |