Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpolations and bash vars usage #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ fi
# This is assumed to have the format /dev/sd[f-p] (e.g. /dev/sdf, /dev/sdp)
DEVICE_NAME_INPUT='${volume_device_name}'

if [ $$DEVICE_NAME_INPUT != '' ]; then
if [ "$${DEVICE_NAME_INPUT}" != '' ]; then
MOUNT_PATH='${volume_mount_path}'

# Extract the last character of the device name
LAST_CHAR=$$(echo -n $$DEVICE_NAME_INPUT | tail -c 1)
LAST_CHAR=$(echo -n $${DEVICE_NAME_INPUT} | tail -c 1)

# Finding the device name the OS is using the last character of the device name
# This assumes the OS will map the device name to a format such as "/dev/xvd?"
# where '?' is the last character of the device name chosen by the user
if [ -b /dev/xvd$$LAST_CHAR ]; then
INSTANCE_STORE_BLOCK_DEVICE=/dev/xvd$$LAST_CHAR
if [ -b /dev/xvd$${LAST_CHAR} ]; then
INSTANCE_STORE_BLOCK_DEVICE=/dev/xvd$${LAST_CHAR}
fi

echo $${INSTANCE_STORE_BLOCK_DEVICE}

if [ -b $${INSTANCE_STORE_BLOCK_DEVICE} ]; then
sudo mke2fs -E nodiscard -L $$MOUNT_PATH -j $${INSTANCE_STORE_BLOCK_DEVICE} &&
sudo mke2fs -E nodiscard -L $${MOUNT_PATH} -j $${INSTANCE_STORE_BLOCK_DEVICE} &&
sudo tune2fs -r 0 $${INSTANCE_STORE_BLOCK_DEVICE} &&
echo "LABEL=$$MOUNT_PATH $$MOUNT_PATH ext4 defaults,noatime 1 1" >> /etc/fstab &&
sudo mkdir $$MOUNT_PATH &&
sudo mount $$MOUNT_PATH
echo "LABEL=$${MOUNT_PATH} $${MOUNT_PATH} ext4 defaults,noatime 1 1" >> /etc/fstab &&
sudo mkdir $${MOUNT_PATH} &&
sudo mount $${MOUNT_PATH}
fi
fi

Expand Down