114
114
if [ "$1" = "linux" ]; then
115
115
mkdir -p $mountpoint
116
116
unmount_os $device
117
mount $device $mountpoint || error "Failed to mount $device"
117
if ! mount $device $mountpoint; then
118
error "Failed to mount $device"
118
121
if [ -f "$mountpoint/etc/fstab" ]; then
119
122
while read uuid mp rest; do
120
123
echo "$uuid" | grep -q '^#' && continue
121
124
if [ "$mp" != "/home" ]; then
125
if [ "${uuid%=*}" = "UUID" ]; then
126
devname="/dev/disk/by-uuid/${uuid#*=}"
127
uuid=$(readlink -e "$devname") || \
128
error "$devname does not exist."
129
elif [ "${uuid%=*}" = "LABEL" ]; then
130
devname="/dev/disk/by-label/${uuid#*=}"
131
uuid=$(readlink -e "$devname") || \
132
error "$devname does not exist."
133
elif [ ! -e "$uuid" ]; then
134
# This happens when the IDE driver in the old OS
135
# doesn't match the driver in the installer. The old
136
# /home might be mounted on /dev/hda3 which could now
137
# be /dev/sda3 or something entirely different. Since
138
# there's no way to determine what the device is
139
# without the old kernel loaded, we fail gracefully so
140
# that we can continue to the next OS.
141
log "$uuid does not exist, continuing."
145
mount $uuid "$mountpoint/home" || failed="1"
146
if [ "$failed" ]; then
128
if [ -n "${uuid#*=}" ]; then
129
if [ "${uuid%=*}" = "UUID" ]; then
130
devname="/dev/disk/by-uuid/${uuid#*=}"
131
elif [ "${uuid%=*}" = "LABEL" ]; then
132
devname="/dev/disk/by-label/${uuid#*=}"
135
if [ -n "$devname" ]; then
136
uuid=$(readlink -e "$devname") || uuid=
137
if [ -z "$uuid"]; then
138
error "$devname does not exist."
142
error "couldn't understand $uuid."
146
if [ ! -e "$uuid" ]; then
147
# This happens when the IDE driver in the old OS
148
# doesn't match the driver in the installer. The old
149
# /home might be mounted on /dev/hda3 which could now
150
# be /dev/sda3 or something entirely different. Since
151
# there's no way to determine what the device is
152
# without the old kernel loaded, we fail gracefully so
153
# that we can continue to the next OS.
154
error "$uuid does not exist."
157
if ! mount $uuid "$mountpoint/home"; then
147
158
unmount_os "$uuid"
148
mount $uuid "$mountpoint/home" || \
159
if ! mount $uuid "$mountpoint/home"; then
149
160
error "failed to mount $uuid"
152
165
done < "$mountpoint/etc/fstab"
163
176
mkdir -p $mountpoint
164
177
unmount_os $device
165
mount -t ntfs $device $mountpoint -o umask=0022,nls=utf8 3>&- || \
166
( log "Mounting $device to $mountpoint with NTFS failed."
167
mount -t vfat $device $mountpoint -o umask=0022,utf8 || \
168
log "Mounting $device to $mountpoint with VFAT failed." )
178
if ! mount -t ntfs $device $mountpoint -o umask=0022,nls=utf8 3>&-; then
179
log "Mounting $device to $mountpoint with NTFS failed."
180
if ! mount -t vfat $device $mountpoint -o umask=0022,utf8; then
181
log "Mounting $device to $mountpoint with VFAT failed."