Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/initramfs/init b/initramfs/init
- index 779bd62..dc49222 100755
- --- a/initramfs/init
- +++ b/initramfs/init
- @@ -723,13 +723,9 @@ sysresccd_stage1_nfs()
- fi
- }
- -# find the device that contains a file with that path: ${SUBDIR}/${LOOPDAT}
- -sysresccd_find_file() # $1=devtype, $2=filepath $3=mountdir, $4=mode
- +sysresccd_find_devices() # $1=devtype
- {
- - devtype="$1" # on which devices should we search that file
- - filepath="$2" # path of the file we are looking for (eg: "/sysrcd.dat")
- - mountdir="$3" # where to mount the device if we find it
- - mountmode="$4" # mount mode: either 'ro' or 'rw'
- + devtype="$1"
- case "${devtype}" in
- auto) # all devices
- @@ -755,15 +751,29 @@ sysresccd_find_file() # $1=devtype, $2=filepath $3=mountdir, $4=mode
- if [ -b "${target}" ]
- then
- searchdevices="${target}"
- - elif [ -b "/dev/disk/by-label/${uuid}" ]
- + elif [ -b "/dev/disk/by-label/${label}" ]
- then
- - searchdevices="/dev/disk/by-label/${uuid}"
- + searchdevices="/dev/disk/by-label/${label}"
- fi
- ;;
- *) # specific device name (eg: "/dev/sda1")
- searchdevices="${devtype}"
- ;;
- esac
- +
- + echo "${searchdevices}"
- + return 1
- +}
- +
- +# find the device that contains a file with that path: ${SUBDIR}/${LOOPDAT}
- +sysresccd_find_file() # $1=devtype, $2=filepath $3=mountdir, $4=mode
- +{
- + devtype="$1" # on which devices should we search that file
- + filepath="$2" # path of the file we are looking for (eg: "/sysrcd.dat")
- + mountdir="$3" # where to mount the device if we find it
- + mountmode="$4" # mount mode: either 'ro' or 'rw'
- +
- + searchdevices="$(sysresccd_find_devices ${devtype})"
- SEARCHDEVICE='' # result returned
- mkdir -p ${mountdir}
- @@ -995,28 +1005,57 @@ sysresccd_stage3_normal() # "backstore" + "aufs" + "mount --move"
- if [ "${BACKSTORE_CMD}" != 'off' ]
- then
- BACKSTORE_DEVTYPE='rmdev' # by default search backstores only on removable devices
- + BACKSTORE_NOLOOP=''
- for curopt in $(echo ${BACKSTORE_CMD} | sed -e 's!,! !g')
- do
- case "${curopt}" in
- alldev)
- BACKSTORE_DEVTYPE='auto' # search for backstores on all types of devices
- ;;
- + UUID\=*)
- + BACKSTORE_DEVTYPE=${curopt}
- + ;;
- + LABEL\=*)
- + BACKSTORE_DEVTYPE=${curopt}
- + ;;
- + noloop)
- + BACKSTORE_NOLOOP='1' # uses a device as backstore
- + ;;
- *)
- BACKSTORE_DAT=${curopt} # search for backstores on that particular device
- ;;
- esac
- done
- - good_msg "Searching for ${SUBDIR}/${BACKSTORE_DAT} on devices..."
- - if sysresccd_find_file ${BACKSTORE_DEVTYPE} ${SUBDIR}/${BACKSTORE_DAT} ${BACKSTORE_MNT} 'rw'
- + if [ -n "${BACKSTORE_NOLOOP}" ]
- then
- - good_msg "Backing store ${SUBDIR}/${BACKSTORE_DAT} found on ${SEARCHDEVICE}"
- - if ! mount ${BACKSTORE_MNT}/${SUBDIR}/${BACKSTORE_DAT} ${BACKSTORE_MEM}
- + case "${BACKSTORE_DEVTYPE}" in
- + UUID\=* | LABEL\=* )
- + good_msg "Mounting device ${BACKSTORE_DEVTYPE} as backing store"
- + BACKSTORE_DEV="$(sysresccd_find_devices ${BACKSTORE_DEVTYPE})"
- + if ! mount ${BACKSTORE_DEV} ${BACKSTORE_MEM}
- + then
- + sysresccd_panic "Cannot mount the backstore device ${BACKSTORE_DEV}"
- + fi
- + BACKSTORE_FOUND='1'
- + ;;
- + rmdev | auto | * )
- + sysresccd_panic "UUID or LABEL needed to mount a block device as backing store"
- + ;;
- + esac
- + else
- + good_msg "Searching for ${SUBDIR}/${BACKSTORE_DAT} on devices..."
- + if sysresccd_find_file ${BACKSTORE_DEVTYPE} ${SUBDIR}/${BACKSTORE_DAT} ${BACKSTORE_MNT} 'rw'
- then
- - sysresccd_panic "Cannot mount the loopback backstore file ${SUBDIR}/${BACKSTORE_DAT}"
- + good_msg "Backing store ${SUBDIR}/${BACKSTORE_DAT} found on ${SEARCHDEVICE}"
- + if ! mount ${BACKSTORE_MNT}/${SUBDIR}/${BACKSTORE_DAT} ${BACKSTORE_MEM}
- + then
- + sysresccd_panic "Cannot mount the loopback backstore file ${SUBDIR}/${BACKSTORE_DAT}"
- + fi
- + BACKSTORE_FOUND='1'
- fi
- - BACKSTORE_FOUND='1'
- fi
- +
- fi
- # 2. store modifications in a tmpfs filesystem if there is no backstore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement