diff options
author | Jeremy Katz <katzj@redhat.com> | 2001-07-20 00:22:38 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2001-07-20 00:22:38 +0000 |
commit | 1fe54e8ffaad91ee06a7a139b42998052972147b (patch) | |
tree | 78fb2c701d57794c3c910e51dc21e58614eb8a40 | |
parent | bb4e7de377544ad0a5d47039f5bd892e16443017 (diff) | |
download | anaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.tar.gz anaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.tar.xz anaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.zip |
maybe we'll eject the cd now
-rw-r--r-- | loader/init.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/loader/init.c b/loader/init.c index 9d5ef788c..36d189a7b 100644 --- a/loader/init.c +++ b/loader/init.c @@ -505,6 +505,25 @@ void disableSwap(void) { } } +void ejectCdrom(void) { + int ejectfd; + struct stat sb; + + stat("/tmp/cdrom", &sb); + + if ((sb.st_mode & S_IFBLK) == S_IFBLK) { + printf("ejecting /tmp/cdrom..."); + if ((ejectfd = open("/tmp/cdrom", O_RDONLY | O_NONBLOCK, 0)) >= 0) { + if (ioctl(ejectfd, CDROMEJECT, 0)) + printf("eject failed %d ", errno); + close(ejectfd); + } else { + printf("eject failed %d ", errno); + } + printf("\n"); + } +} + int main(int argc, char **argv) { pid_t installpid, childpid; int waitStatus; @@ -738,6 +757,9 @@ int main(int argc, char **argv) { printf("unmounting filesystems...\n"); unmountFilesystems(); + printf("ejecting cdrom (if it exists)...\n"); + ejectCdrom(); + if (doReboot) { printf("rebooting system\n"); sleep(2); |