-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux_ramdisk.sh
More file actions
executable file
·63 lines (49 loc) · 1.69 KB
/
linux_ramdisk.sh
File metadata and controls
executable file
·63 lines (49 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# THIS ALL NEEDS TO BE RE-WRITTEN!
# DOES IT EVEN WORK??
echo "Reading from linux_ramdisk.sh"
# Input: default variables for a ramdisk
# Output: a properly mounted ramdisk
echo "Hello again, ${HOSTNAME}, you beautiful ${OS} box, you."
echo "I'm thinking about creating a ${MB_SIZE}MB ramdisk at ${MOUNT_POINT}/${DISK_NAME}."
# Linux wants the mountpoint to already exist, though we should warn if the directory is NOT empty.
#############################################################################################
# VALIDATING THE DEFAULT RAM DISK NAME
#############################################################################################
echo ""
while [ ! -d ${MOUNT_POINT}/${DISK_NAME} ]
# named RamDisk does not exist
do
echo "Hold up! ${MOUNT_POINT}/${DISK_NAME} does not exist. You can:"
echo ""
RD_ACTIONS=("change ramdisk name" "create ${MOUNT_POINT}/${DISK_NAME}" )
PS3="Select action: "
select action in "${RD_ACTIONS[@]}"
do
case $REPLY in
1) echo "change_rd"
change_rd
break ;;
2) mkdir ${MOUNT_POINT}/${DISK_NAME}
break ;;
esac
done
done
echo "${MOUNT_POINT}/${DISK_NAME} exists! Is it empty?"
shopt -s nullglob
shopt -s dotglob # To include hidden files
files=(${MOUNT_POINT}/${DISK_NAME}/*)
while [ ${#files[@]} -gt 1 ]; then
echo "${MOUNT_POINT}/${DISK_NAME} is not empty. Did you want to mount on top of it anyway?"
ls -lh
echo "This bit is broken."
#We should probably check whether or not this is already an active mount point.
#if mount | grep /mnt/md0 > /dev/null; then
# echo "yay"
#else
# echo "nay"
#fi
done
shopt -u dotglob
shopt -u nullglob
#Let's do this thing!
create_rd