summaryrefslogtreecommitdiff
path: root/src/initrd/grok-block
diff options
context:
space:
mode:
Diffstat (limited to 'src/initrd/grok-block')
-rwxr-xr-xsrc/initrd/grok-block19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/initrd/grok-block b/src/initrd/grok-block
index 086722d..01265b0 100755
--- a/src/initrd/grok-block
+++ b/src/initrd/grok-block
@@ -7,7 +7,7 @@ case "$DEVNAME" in /dev/loop*|/dev/ram*|/dev/dm-*|/dev/md*|/dev/fd*) exit ;; esa
7 7
8debug_log "grok-block.${DEVNAME##*/}" 8debug_log "grok-block.${DEVNAME##*/}"
9 9
10addmenu_choosekey() 10addmenu_choosekey()
11{ 11{
12 dev=$1 12 dev=$1
13 dir=$2 13 dir=$2
@@ -62,8 +62,8 @@ retry_mount()
62 until mntout="$(mount "$@" 2>&1)" 62 until mntout="$(mount "$@" 2>&1)"
63 do 63 do
64 tries=$(( tries - 1 )) 64 tries=$(( tries - 1 ))
65 case "$mntout" in 65 case "$mntout" in
66 *"Device or resource busy"*) 66 *"Device or resource busy"*)
67 if [ $tries -le 0 ]; then 67 if [ $tries -le 0 ]; then
68 warn "mount $@ failed: $mntout" 68 warn "mount $@ failed: $mntout"
69 return 1 69 return 1
@@ -103,8 +103,9 @@ is_device_without_partitions()
103 103
104is_incomplete_samizdat_install() 104is_incomplete_samizdat_install()
105{ 105{
106 # TODO: Possibly only some of the partitions are incomplete
106 local partition_names="$(parted -sm "$1" print | sed 1,2d | awk -F: -e '{printf "%s:", $6}')" 107 local partition_names="$(parted -sm "$1" print | sed 1,2d | awk -F: -e '{printf "%s:", $6}')"
107 [ "$partition_names" = 'primary:gpg-incomplete:luks-incomplete:' ] 108 [ "$partition_names" = 'samizdat-grub-incomplete:samizdat-plaintext-incomplete:samizdat-luks-encrypted-incomplete:' ]
108} 109}
109 110
110grok_block() 111grok_block()
@@ -119,6 +120,12 @@ grok_block()
119 *) mount_type="-t $ID_FS_TYPE" ;; 120 *) mount_type="-t $ID_FS_TYPE" ;;
120 esac 121 esac
121 122
123 # Skip partitions that we created.
124 # TODO: make these names more unique
125 case "$ID_PART_ENTRY_NAME" in
126 samizdat-grub-incomplete|samizdat-plaintext-incomplete|samizdat-luks-encrypted-incomplete) return ;;
127 esac
128
122 if [ "$ID_FS_TYPE" = hfsplus ] && ! fsck.hfsplus -q "$DEVNAME"; then 129 if [ "$ID_FS_TYPE" = hfsplus ] && ! fsck.hfsplus -q "$DEVNAME"; then
123 (if fsck.hfsplus "$DEVNAME"; then 130 (if fsck.hfsplus "$DEVNAME"; then
124 grok-block "$DEVNAME" 131 grok-block "$DEVNAME"
@@ -200,7 +207,7 @@ grok_block()
200} 207}
201 208
202# Get me all them nice udev variables 209# Get me all them nice udev variables
203eval "$(PATH=$PATH:/lib/udev vol_id "$DEVNAME" | 210eval "$(PATH=$PATH:/lib/udev vol_id "$DEVNAME" |
204 sed "s/'/'\\\\''/; s/=\(.*\)/='\1'/" 211 sed "s/'/'\\\\''/; s/=\(.*\)/='\1'/"
205)" 212)"
206 213
@@ -209,7 +216,7 @@ CDROM_ID_FS_LABEL_ENC=$(sed 's/ /\\x20/g' /lib/samizdat/vol_id.txt)
209if [ "$ID_FS_UUID_ENC" = "$CDROM_ID_FS_UUID_ENC" -o \ 216if [ "$ID_FS_UUID_ENC" = "$CDROM_ID_FS_UUID_ENC" -o \
210 "$ID_FS_LABEL_ENC" = "$CDROM_ID_FS_LABEL_ENC" ] 217 "$ID_FS_LABEL_ENC" = "$CDROM_ID_FS_LABEL_ENC" ]
211then 218then
212 # Recognize and mount the Samizdat 219 # Recognize and mount the Samizdat
213 if ! mountpoint -q /cdrom; then 220 if ! mountpoint -q /cdrom; then
214 mkdir -p /cdrom 221 mkdir -p /cdrom
215 . mdadm-dup.sh 222 . mdadm-dup.sh