Skip to content

Commit

Permalink
initrd init: Fix automatic flash PUPMODE
Browse files Browse the repository at this point in the history
This is mostly the code suggested by gyrog, but I did add the
lines for nvme devices after seeing issue #1115
  • Loading branch information
woodenshoe-wi authored and wdlkmpx committed Dec 10, 2017
1 parent c948d7d commit 29fe998
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion initrd-progs/0initrd/init
Expand Up @@ -1317,7 +1317,17 @@ if [ "$PUPSAVE" ];then #refine pupmode
# we must check if it's located in a flash storage device
# in order to change the $SAVE_LAYER to /pup_ro1
PUPSAVE_DRV=$(echo $PUPSAVE | cut -f1 -d ',')
PUPSAVE_DRV=${PUPSAVE_DRV:0:3} #sda1 -> sda TODO: needs a proper fix
if [ ! -d "/sys/block/$PUPSAVE_DRV" ];then #not device e.g. sr0, assume partition
#remove upto 3 trailing digits
PUPSAVE_DRV="${PUPSAVE_DRV%[0-9]}"
PUPSAVE_DRV="${PUPSAVE_DRV%[0-9]}"
PUPSAVE_DRV="${PUPSAVE_DRV%[0-9]}"
#remove any trailing 'p'
[ "${PUPSAVE_DRV:0:6}" = "mmcblk" ] && PUPSAVE_DRV="${PUPSAVE_DRV%p}"
# not sure about this, I don't have any nvme devices to test
#remove any trailing 'n'
[ "${PUPSAVE_DRV:0:4}" = "nvme" ] && PUPSAVE_DRV="${PUPSAVE_DRV%n}"
fi
if probedisk ${PUPSAVE_DRV} | grep -q '|usbflash|' ; then
echo "*** Pupsave is located in a flash storage device: $PUPSAVE_DRV" #debug
PUPSAVE_MEDIA=usbflash
Expand Down

0 comments on commit 29fe998

Please sign in to comment.