summaryrefslogtreecommitdiffstats
path: root/live/One/2006.0/files/halt.local
blob: b39f97581d7f6a190ec9470e247c426f02f9af63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);
use MDK::Common;
use detect_devices;
use c;

system("mount -t proc none /proc");
my ($device) = cat_("/proc/mounts") =~ m!(/dev/\S+)\s+/live/media\s+iso9660!;
system("umount /proc");
$device or exit;

# try to put halt/reboot in cache, if not called directly from them
system("$_ --help 2>/dev/null") foreach qw(halt reboot);

my $f = detect_devices::tryOpen($device);
# see openCdromTray() and unlockCdrom(), from install_any
ioctl($f, c::CDROM_LOCKDOOR(), 0);
ioctl($f, c::CDROMEJECT(), 0);

print "\n\nPlease press <Enter> once the medium is removed.\n";
<STDIN>;

ioctl($f, 0x5319, 0); # CDROMCLOSETRAY