summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-07-20 00:22:38 +0000
committerJeremy Katz <katzj@redhat.com>2001-07-20 00:22:38 +0000
commit1fe54e8ffaad91ee06a7a139b42998052972147b (patch)
tree78fb2c701d57794c3c910e51dc21e58614eb8a40 /loader
parentbb4e7de377544ad0a5d47039f5bd892e16443017 (diff)
downloadanaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.tar.gz
anaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.tar.xz
anaconda-1fe54e8ffaad91ee06a7a139b42998052972147b.zip
maybe we'll eject the cd now
Diffstat (limited to 'loader')
-rw-r--r--loader/init.c22
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);