Codebase list cdrom-detect / a7f10813-7e75-4f2a-9876-e96f5d46670f/main finish-install
a7f10813-7e75-4f2a-9876-e96f5d46670f/main

Tree @a7f10813-7e75-4f2a-9876-e96f5d46670f/main (Download .tar.gz)

finish-install @a7f10813-7e75-4f2a-9876-e96f5d46670f/mainraw · history · blame

#! /bin/sh -e

. /usr/share/debconf/confmodule

log() {
	logger -t cdrom-detect "$@"
}

# Cannot just tell eject to eject /cdrom as it is not compatible
# with busybox umount. Instead, unmount the cdrom first, and then
# eject the device.
CDDEV=$(mount | grep "on /cdrom" | cut -d ' ' -f 1)
if [ -n "$CDDEV" ]; then
	log "Unmounting and ejecting '$CDDEV'"
	umount /cdrom || true

	db_get cdrom-detect/eject
	if [ "$RET" = false ]; then
		log "Not ejecting CD, per debconf setting."
	else
		eject $CDDEV || true
	fi
else
	log "Not ejecting CD, as nothing is mounted."
fi