Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
sbin /
[ HOME SHELL ]
Name
Size
Permission
Action
MAKEDEV
28.14
KB
-rwxr-xr-x
accton
10.45
KB
-rwxr-xr-x
addpart
8.26
KB
-rwxr-xr-x
agetty
26.09
KB
-rwxr-xr-x
alsactl
101.37
KB
-rwxr-xr-x
arp
61.37
KB
-rwxr-xr-x
arping
17.48
KB
-rwxr-xr-x
audispd
38.02
KB
-rwxr-x---
auditctl
38.03
KB
-rwxr-x---
augenrules
3.48
KB
-rwxr-x---
aureport
95.78
KB
-rwxr-xr-x
ausearch
93.02
KB
-rwxr-xr-x
autrace
16.13
KB
-rwxr-x---
badblocks
29.05
KB
-rwxr-xr-x
biosdevname
37.26
KB
-rwxr-xr-x
blkdeactivate
13.25
KB
-rwxr-xr-x
blkdiscard
18.73
KB
-rwxr-xr-x
blkid
27.17
KB
-rwxr-xr-x
blockdev
17.21
KB
-rwxr-xr-x
bridge
53.63
KB
-rwxr-xr-x
busybox
1021.48
KB
-rwxr-xr-x
cache_check
1.54
MB
-rwxr-xr-x
cache_dump
1.54
MB
-rwxr-xr-x
cache_metadata_size
1.54
MB
-rwxr-xr-x
cache_repair
1.54
MB
-rwxr-xr-x
cache_restore
1.54
MB
-rwxr-xr-x
cbq
32.77
KB
-rwxr-xr-x
cfdisk
68.41
KB
-rwxr-xr-x
chcpu
29.11
KB
-rwxr-xr-x
chkconfig
36.07
KB
-rwxr-xr-x
clock
47.52
KB
-rwxr-xr-x
consoletype
7.71
KB
-rwxr-xr-x
cryptsetup
43.6
KB
-rwxr-xr-x
ctrlaltdel
8.39
KB
-rwxr-xr-x
debugfs
94.08
KB
-rwxr-xr-x
delpart
8.22
KB
-rwxr-xr-x
depmod
133.05
KB
-rwxr-xr-x
dm_dso_reg_tool
13.6
KB
-rwxr-xr-x
dmevent_tool
13.6
KB
-rwxr-xr-x
dmeventd
42.18
KB
-r-xr-xr-x
dmraid
26.27
KB
-rwxr-xr-x
dmraid.static
26.27
KB
-rwxr-xr-x
dmsetup
142.03
KB
-rwxr-xr-x
dmstats
142.03
KB
-rwxr-xr-x
dosfsck
54.05
KB
-rwxr-xr-x
dosfslabel
51.06
KB
-rwxr-xr-x
dracut
11.86
KB
-rwxr-xr-x
dumpe2fs
22.74
KB
-rwxr-xr-x
e2fsck
192.73
KB
-rwxr-xr-x
e2image
28.74
KB
-rwxr-xr-x
e2label
41.73
KB
-rwxr-xr-x
e2undo
14.25
KB
-rwxr-xr-x
era_check
1.54
MB
-rwxr-xr-x
era_dump
1.54
MB
-rwxr-xr-x
era_invalidate
1.54
MB
-rwxr-xr-x
era_restore
1.54
MB
-rwxr-xr-x
ether-wake
14.37
KB
-rwxr-xr-x
ethtool
233.75
KB
-rwxr-xr-x
faillock
14.57
KB
-rwxr-xr-x
fdisk
112.05
KB
-rwxr-xr-x
findfs
9.38
KB
-rwxr-xr-x
fixfiles
7.75
KB
-rwxr-xr-x
fsadm
14.88
KB
-r-xr-xr-x
fsck
33.87
KB
-rwxr-xr-x
fsck.cramfs
15.82
KB
-rwxr-xr-x
fsck.ext2
192.73
KB
-rwxr-xr-x
fsck.ext3
192.73
KB
-rwxr-xr-x
fsck.ext4
192.73
KB
-rwxr-xr-x
fsck.ext4dev
192.73
KB
-rwxr-xr-x
fsck.msdos
54.05
KB
-rwxr-xr-x
fsck.vfat
54.05
KB
-rwxr-xr-x
fsfreeze
10.27
KB
-rwxr-xr-x
fstab-decode
8.14
KB
-rwxr-xr-x
fstrim
17.95
KB
-rwxr-xr-x
fuser
28.48
KB
-rwxr-xr-x
genhostid
7.91
KB
-rwxr-xr-x
getkey
11.71
KB
-rwxr-xr-x
grub
740.84
KB
-rwxr-xr-x
grub-crypt
2.41
KB
-rwxr-xr-x
grub-install
18
KB
-rwxr-xr-x
grub-md5-crypt
2.24
KB
-rwxr-xr-x
grub-terminfo
2.42
KB
-rwxr-xr-x
grubby
50.31
KB
-rwxr-xr-x
halt
14.48
KB
-rwxr-xr-x
hdparm
108.85
KB
-rwxr-xr-x
hwclock
47.52
KB
-rwxr-xr-x
ifcfg
2.98
KB
-rwxr-xr-x
ifconfig
72.23
KB
-rwxr-xr-x
ifdown
1.47
KB
-rwxr-xr-x
ifenslave
21.65
KB
-rwxr-xr-x
ifrename
31.43
KB
-rwxr-xr-x
ifup
4.58
KB
-rwxr-xr-x
initctl
135.53
KB
-rwxr-xr-x
insmod
13.79
KB
-rwxr-xr-x
insmod.static
784.58
KB
-rwxr-xr-x
install-info
42.56
KB
-rwxr-xr-x
installkernel
2.61
KB
-rwxr-xr-x
ip
241.45
KB
-rwxr-xr-x
ip6tables
49.64
KB
-rwxr-xr-x
ip6tables-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-multi
49.64
KB
-rwxr-xr-x
ip6tables-multi-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-restore
49.64
KB
-rwxr-xr-x
ip6tables-restore-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-save
49.64
KB
-rwxr-xr-x
ip6tables-save-1.4.7
49.64
KB
-rwxr-xr-x
ipmaddr
18.92
KB
-rwxr-xr-x
iptables
58.45
KB
-rwxr-xr-x
iptables-1.4.7
58.45
KB
-rwxr-xr-x
iptables-multi
58.45
KB
-rwxr-xr-x
iptables-multi-1.4.7
58.45
KB
-rwxr-xr-x
iptables-restore
58.45
KB
-rwxr-xr-x
iptables-restore-1.4.7
58.45
KB
-rwxr-xr-x
iptables-save
58.45
KB
-rwxr-xr-x
iptables-save-1.4.7
58.45
KB
-rwxr-xr-x
iptunnel
22.75
KB
-rwxr-xr-x
iw
160.43
KB
-rwxr-xr-x
iwconfig
29.58
KB
-rwxr-xr-x
iwevent
18.23
KB
-rwxr-xr-x
iwgetid
14.06
KB
-rwxr-xr-x
iwlist
35.68
KB
-rwxr-xr-x
iwpriv
14.87
KB
-rwxr-xr-x
iwspy
13.94
KB
-rwxr-xr-x
kdump
10.83
KB
-rwxr-xr-x
kexec
176.1
KB
-rwxr-xr-x
killall5
19.98
KB
-rwxr-xr-x
kpartx
38.43
KB
-rwxr-xr-x
ldconfig
878.12
KB
-rwxr-xr-x
load_policy
10.21
KB
-rwxr-xr-x
logsave
12.8
KB
-rwxr-xr-x
losetup
31.2
KB
-rwxr-xr-x
lsinitrd
3.93
KB
-rwxr-xr-x
lsmod
8.88
KB
-rwxr-xr-x
lspci
70.12
KB
-rwxr-xr-x
lspcmcia
35.33
KB
-rwxr-xr-x
lvchange
1.46
MB
-r-xr-xr-x
lvconvert
1.46
MB
-r-xr-xr-x
lvcreate
1.46
MB
-r-xr-xr-x
lvdisplay
1.46
MB
-r-xr-xr-x
lvextend
1.46
MB
-r-xr-xr-x
lvm
1.46
MB
-r-xr-xr-x
lvmchange
1.46
MB
-r-xr-xr-x
lvmconf
12.39
KB
-r-xr-xr-x
lvmconfig
1.46
MB
-r-xr-xr-x
lvmdiskscan
1.46
MB
-r-xr-xr-x
lvmdump
9.43
KB
-r-xr-xr-x
lvmetad
66.09
KB
-r-xr-xr-x
lvmsadc
1.46
MB
-r-xr-xr-x
lvmsar
1.46
MB
-r-xr-xr-x
lvreduce
1.46
MB
-r-xr-xr-x
lvremove
1.46
MB
-r-xr-xr-x
lvrename
1.46
MB
-r-xr-xr-x
lvresize
1.46
MB
-r-xr-xr-x
lvs
1.46
MB
-r-xr-xr-x
lvscan
1.46
MB
-r-xr-xr-x
matchpathcon
12.01
KB
-rwxr-xr-x
mdmon
229.84
KB
-rwxr-xr-x
microcode_ctl
11.61
KB
-rwxr-xr-x
mii-diag
21.25
KB
-rwxr-xr-x
mii-tool
17.8
KB
-rwxr-xr-x
mingetty
18.7
KB
-rwxr-xr-x
mkdosfs
29.88
KB
-rwxr-xr-x
mkdumprd
120.65
KB
-rwxr-xr-x
mke2fs
67.34
KB
-rwxr-xr-x
mkfs
10.09
KB
-rwxr-xr-x
mkfs.cramfs
26.26
KB
-rwxr-xr-x
mkfs.ext2
67.34
KB
-rwxr-xr-x
mkfs.ext3
67.34
KB
-rwxr-xr-x
mkfs.ext4
67.34
KB
-rwxr-xr-x
mkfs.ext4dev
67.34
KB
-rwxr-xr-x
mkfs.msdos
29.88
KB
-rwxr-xr-x
mkfs.vfat
29.88
KB
-rwxr-xr-x
mkhomedir_helper
22.01
KB
-rwxr-xr-x
mkinitrd
3.33
KB
-rwxr-xr-x
mkswap
30.78
KB
-rwxr-xr-x
modinfo
95.34
KB
-rwxr-xr-x
modprobe
121.42
KB
-rwxr-xr-x
mount.cifs
39.59
KB
-rwxr-xr-x
mount.nfs
122.47
KB
-rwsr-xr-x
mount.nfs4
122.47
KB
-rwsr-xr-x
mount.tmpfs
1.31
KB
-rwxr-xr-x
nameif
15.26
KB
-rwxr-xr-x
netreport
8.59
KB
-rwxr-sr-x
new-kernel-pkg
13.57
KB
-rwxr-xr-x
nfs_cache_getent
460
B
-rwxr-xr-x
nologin
7.63
KB
-rwxr-xr-x
pam_console_apply
41.13
KB
-rwxr-xr-x
pam_tally2
16.87
KB
-rwxr-xr-x
parted
85.11
KB
-rwxr-xr-x
partprobe
14.98
KB
-rwxr-xr-x
partx
24.9
KB
-rwxr-xr-x
pccardctl
35.33
KB
-rwxr-xr-x
pdata_tools
1.54
MB
-rwxr-xr-x
pidof
19.98
KB
-rwxr-xr-x
pivot_root
7.61
KB
-rwxr-xr-x
plipconfig
10.52
KB
-rwxr-xr-x
poweroff
14.48
KB
-rwxr-xr-x
ppp-watch
29.08
KB
-rwxr-xr-x
pvchange
1.46
MB
-r-xr-xr-x
pvck
1.46
MB
-r-xr-xr-x
pvcreate
1.46
MB
-r-xr-xr-x
pvdisplay
1.46
MB
-r-xr-xr-x
pvmove
1.46
MB
-r-xr-xr-x
pvremove
1.46
MB
-r-xr-xr-x
pvresize
1.46
MB
-r-xr-xr-x
pvs
1.46
MB
-r-xr-xr-x
pvscan
1.46
MB
-r-xr-xr-x
quotacheck
103.01
KB
-rwxr-xr-x
quotaoff
72.5
KB
-rwxr-xr-x
quotaon
72.5
KB
-rwxr-xr-x
readahead
25.51
KB
-rwxr-xr-x
readahead-collector
27.76
KB
-rwxr-xr-x
reboot
14.48
KB
-rwxr-xr-x
reload
135.53
KB
-rwxr-xr-x
request-key
20.91
KB
-rwxr-xr-x
resize2fs
41.49
KB
-rwxr-xr-x
restart
135.53
KB
-rwxr-xr-x
restorecon
26.63
KB
-rwxr-xr-x
rfkill
12.13
KB
-rwxr-xr-x
rmmod
16.28
KB
-rwxr-xr-x
rngd
23.47
KB
-rwxr-xr-x
route
58.38
KB
-rwxr-xr-x
rtmon
37.7
KB
-rwxr-xr-x
runlevel
14.02
KB
-rwxr-xr-x
runuser
32.7
KB
-rwxr-xr-x
scsi_id
34.55
KB
-rwxr-xr-x
securetty
10.7
KB
-rwxr-xr-x
service
1.65
KB
-rwxr-xr-x
setfiles
26.63
KB
-rwxr-xr-x
setpci
23.37
KB
-rwxr-xr-x
setsysfont
850
B
-rwxr-xr-x
sfdisk
71.53
KB
-rwxr-xr-x
sgpio
16.36
KB
-rwxr-xr-x
shutdown
62.98
KB
-rwxr-xr-x
slattach
37.35
KB
-rwxr-xr-x
sln
676.6
KB
-rwxr-xr-x
start
135.53
KB
-rwxr-xr-x
status
135.53
KB
-rwxr-xr-x
stop
135.53
KB
-rwxr-xr-x
sulogin
16.6
KB
-rwxr-xr-x
sushell
67
B
-rwxr-xr-x
swapoff
29.69
KB
-rwxr-xr-x
swapon
29.69
KB
-rwxr-xr-x
switch_root
11.95
KB
-rwxr-xr-x
sysctl
18.92
KB
-rwxr-xr-x
tc
253.53
KB
-rwxr-xr-x
telinit
50.33
KB
-rwxr-xr-x
thin_check
1.54
MB
-rwxr-xr-x
thin_delta
1.54
MB
-rwxr-xr-x
thin_dump
1.54
MB
-rwxr-xr-x
thin_ls
1.54
MB
-rwxr-xr-x
thin_metadata_size
1.54
MB
-rwxr-xr-x
thin_repair
1.54
MB
-rwxr-xr-x
thin_restore
1.54
MB
-rwxr-xr-x
thin_rmap
1.54
MB
-rwxr-xr-x
thin_trim
1.54
MB
-rwxr-xr-x
tune2fs
41.73
KB
-rwxr-xr-x
umount.hal
11.94
KB
-rwxr-xr-x
umount.nfs
122.47
KB
-rwsr-xr-x
umount.nfs4
122.47
KB
-rwsr-xr-x
unix_chkpwd
34.02
KB
-rwsr-xr-x
vconfig
13.16
KB
-rwxr-xr-x
vgcfgbackup
1.46
MB
-r-xr-xr-x
vgcfgrestore
1.46
MB
-r-xr-xr-x
vgchange
1.46
MB
-r-xr-xr-x
vgck
1.46
MB
-r-xr-xr-x
vgconvert
1.46
MB
-r-xr-xr-x
vgcreate
1.46
MB
-r-xr-xr-x
vgdisplay
1.46
MB
-r-xr-xr-x
vgexport
1.46
MB
-r-xr-xr-x
vgextend
1.46
MB
-r-xr-xr-x
vgimport
1.46
MB
-r-xr-xr-x
vgimportclone
9.4
KB
-r-xr-xr-x
vgmerge
1.46
MB
-r-xr-xr-x
vgmknodes
1.46
MB
-r-xr-xr-x
vgreduce
1.46
MB
-r-xr-xr-x
vgremove
1.46
MB
-r-xr-xr-x
vgrename
1.46
MB
-r-xr-xr-x
vgs
1.46
MB
-r-xr-xr-x
vgscan
1.46
MB
-r-xr-xr-x
vgsplit
1.46
MB
-r-xr-xr-x
vmcore-dmesg
16.99
KB
-rwxr-xr-x
weak-modules
15.83
KB
-rwxr-xr-x
wipefs
16.19
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : grub-install
#! /bin/sh # Install GRUB on your drive. # Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Initialize some variables. prefix=/usr exec_prefix=/usr sbindir=/sbin datadir=/usr/share PACKAGE=grub VERSION=0.97 host_cpu=x86_64 host_os=linux-gnu host_vendor=redhat pkgdatadir=${datadir}/${PACKAGE}/${host_cpu}-${host_vendor} grub_shell=${sbindir}/grub mdadm=${sbindir}/mdadm log_file=/tmp/grub-install.log.$$ img_file=/tmp/grub-install.img.$$ rootdir= grub_prefix=/boot/grub install_drives= install_device= no_floppy= force_lba= recheck=no debug=no justcopy=no # look for secure tempfile creation wrappers on this platform if test -x /bin/tempfile; then mklog="/bin/tempfile --prefix=grub" mkimg="/bin/tempfile --prefix=grub" elif test -x /bin/mktemp; then mklog="/bin/mktemp /tmp/grub-install.log.XXXXXX" mkimg="/bin/mktemp /tmp/grub-install.img.XXXXXX" else mklog="" mkimg="" fi # Usage: usage # Print the usage. usage () { cat <<EOF Usage: grub-install [OPTION] install_device Install GRUB on your drive. -h, --help print this message and exit -v, --version print the version information and exit --root-directory=DIR install GRUB images under the directory DIR instead of the root directory --grub-shell=FILE use FILE as the grub shell --no-floppy do not probe any floppy drive --force-lba force GRUB to use LBA mode even for a buggy BIOS --recheck probe a device map even if it already exists This flag is unreliable and its use is strongly discouraged. INSTALL_DEVICE can be a GRUB device name or a system device filename. grub-install copies GRUB images into the DIR/boot directory specfied by --root-directory, and uses the grub shell to install grub into the boot sector. Report bugs to <bug-grub@gnu.org>. EOF } # Usage: convert os_device # Convert an OS device to the corresponding GRUB drive. # This part is OS-specific. convert () { # First, check if the device file exists. if test -e "$1"; then : else echo "$1: Not found or not a block device." 1>&2 exit 1 fi # Break the device name into the disk part and the partition part. case "$host_os" in linux*) tmp_disk=`echo "$1" | grep -v '/mapper/control$' | grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq | sed -e 's%\([shv]d[[:lower:]]\+\)[0-9]*$%\1%' \ -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ -e 's%\(fd[0-9]*\)$%\1%' \ -e 's%/part[0-9]*$%/disc%' \ -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \ -e 's%\(/mapper/[[:alpha:]]\+[[:digit:]]*\)p[[:digit:]]\+$%\1%' \ -e 's%\(/mapper/isw_[[:alpha:]_]\+[[:alpha:]]\+[[:digit:]]\+\)p[[:digit:]]\+$%\1%' \ -e 's%\(/mapper/[[:alpha:]]\+_[[:alpha:]]\+\)[[:digit:]]\+$%\1%' \ -e 's%\(/mapper/[[:alnum:]]\+\(_[[:alnum:]]\+\)\+\)\p[[:digit:]]\+$%\1%' \ -e 's%\(/mapper/[[:alnum:]_-]\+\)\+p[[:digit:]]\+$%\1%' \ -e 's%\(nvme[0-9]*n[0-9]*\)p[0-9]*$%\1%'` tmp_part=`echo "$1" | grep -v '/mapper/control$' | grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq | sed -e 's%.*/[shv]d[[:lower:]]\+\([0-9]*\)$%\1%' \ -e 's%.*d[0-9]*p%%' \ -e 's%.*/fd[0-9]*$%%' \ -e 's%.*/floppy/[0-9]*$%%' \ -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \ -e 's%.*c[0-7]d[0-9]*%%' \ -e 's%.*/mapper/[[:alpha:]]\+[[:digit:]]*p\([[:digit:]]\+\)$%\1%' \ -e 's%.*/mapper/isw_[[:alpha:]_]\+[[:alpha:]]\+[[:digit:]]\+p\([[:digit:]]\+\)$%\1%' \ -e 's%.*/mapper/[[:alpha:]]\+_[[:alpha:]]\+\([[:digit:]]\+\)$%\1%' \ -e 's%.*/mapper/[[:alnum:]]\+\(_[[:alpha:]]\+[[:digit:]]*\)\+p\([[:digit:]]\+\)$%\2%' \ -e 's%.*/mapper/[[:alnum:]_-]\+p\([[:digit:]]\+\)$%\1%' \ -e 's%.*/nvme[0-9]*n[0-9]*p\([0-9]*\)%\1%' | grep -v '.*/mapper/.*'` ;; gnu*) tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; freebsd* | kfreebsd*-gnu) tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \ | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'` tmp_part=`echo "$1" \ | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \ | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` ;; netbsd* | knetbsd*-gnu) tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \ | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'` tmp_part=`echo "$1" \ | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"` ;; *) echo "grub-install does not support your OS yet." 1>&2 exit 1 ;; esac # Get the drive name. tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \ | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'` # If not found, print an error message and exit. if test "x$tmp_drive" = x; then echo "$1 does not have any corresponding BIOS drive." 1>&2 exit 1 fi if test "x$tmp_part" != x; then # If a partition is specified, we need to translate it into the # GRUB's syntax. case "$host_os" in linux*) echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;; gnu*) if echo $tmp_part | grep "^s" >/dev/null; then tmp_pc_slice=`echo $tmp_part \ | sed "s%s\([0-9]*\)[a-g]*$%\1%"` tmp_drive=`echo "$tmp_drive" \ | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` fi if echo $tmp_part | grep "[a-g]$" >/dev/null; then tmp_bsd_partition=`echo "$tmp_part" \ | sed "s%[^a-g]*\([a-g]\)$%\1%"` tmp_drive=`echo "$tmp_drive" \ | sed "s%)%,$tmp_bsd_partition)%"` fi echo "$tmp_drive" ;; freebsd* | kfreebsd*-gnu) if echo $tmp_part | grep "^s" >/dev/null; then tmp_pc_slice=`echo $tmp_part \ | sed "s%s\([0-9]*\)[a-h]*$%\1%"` tmp_drive=`echo "$tmp_drive" \ | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` fi if echo $tmp_part | grep "[a-h]$" >/dev/null; then tmp_bsd_partition=`echo "$tmp_part" \ | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"` tmp_drive=`echo "$tmp_drive" \ | sed "s%)%,$tmp_bsd_partition)%"` fi echo "$tmp_drive" ;; netbsd* | knetbsd*-gnu) if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then tmp_bsd_partition=`echo "$tmp_part" \ | sed "s%\([a-p]\)$%\1%"` tmp_drive=`echo "$tmp_drive" \ | sed "s%)%,$tmp_bsd_partition)%"` fi echo "$tmp_drive" ;; esac else # If no partition is specified, just print the drive name. echo "$tmp_drive" fi } # Usage: resolve_symlink file # Find the real file/device that file points at resolve_symlink () { tmp_fname=$1 # Resolve symlinks while test -L $tmp_fname; do tmp_new_fname=`ls -al $tmp_fname | sed -n 's%.*-> \(.*\)%\1%p'` if test -z "$tmp_new_fname"; then echo "Unrecognized ls output" 1>&2 exit 1 fi # Convert relative symlinks case $tmp_new_fname in /*) tmp_fname="$tmp_new_fname" ;; *) tmp_fname="`echo $tmp_fname | sed 's%/[^/]*$%%'`/$tmp_new_fname" ;; esac done echo "$tmp_fname" } # Usage: is_raid1_device devicename # Returns 0 if devicename is a raid1 md device, 1 if it is not. is_raid1_device () { case "$host_os" in linux*) level=`$mdadm --query --detail $1 2>/dev/null | \ awk '/Raid Level :/ {print $4}'` if [ "$level" = "raid1" ]; then return 0 fi ;; esac return 1 } # Usage: find_real_devs device # Returns space separated list of devices for linux if device is # a raid1 device. In all other cases, the provided value is returned. find_real_devs () { source_device=$1 case "$host_os" in linux*) if is_raid1_device $source_device ; then list="" for device in `$mdadm --query --detail "${source_device}" | \ awk '/\/dev\/[^(md)]/ {print $7}'` ; do list="$list $device" done echo $list return 0 fi ;; esac echo $source_device return 0 } # Usage: stat_device file # Find major:minor of a device node. stat_device() { dev=`resolve_symlink $1` majmin=`stat -c "%t:%T" "$dev" 2>/dev/null` if test -z "$majmin"; then echo "Could not find device for $1" 1>&2 exit 1 fi echo "$majmin" } # Usage: find_mapper_device file # Find a file in /dev/mapper with the same major:minor as the specified node. find_mapper_device() { if [ -b "$1" ]; then dev="$1" else mntpnt=`echo "$1" | sed 's,/,\\\\/,g'` dev=`awk '($2 ~ /'$mntpnt'/) { print $1 }' /etc/mtab` fi if test -z "$dev"; then echo "Could not find device for $1" 1>&2 exit 1 fi majmin=`stat_device $dev` for x in /dev/mapper/* ; do devmajmin=`stat_device "$x"` if [ "$majmin" == "$devmajmin" ]; then echo "$x" return 0 fi done return 1 } # Usage: find_device file # Find block device on which the file resides. find_device () { # For now, this uses the program `df' to get the device name, but is # this really portable? tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^ ]*\).*%\1%p'` if test -z "$tmp_fname"; then echo "Could not find device for $1" 1>&2 exit 1 fi ret_fname=`resolve_symlink $tmp_fname` || exit 1 tmp_fname=`find_mapper_device $ret_fname` if test -n "$tmp_fname"; then ret_fname="$tmp_fname" fi echo "$ret_fname" return 0 } copy_images() { # Copy the GRUB images to the GRUB directory. for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do rm -f $file || exit 1 done for file in \ ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do cp -f $file ${grubdir} 1>&2 || exit 1 done } dump_boot_block () { sync $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file dump ${root_drive}${tmp} ${img_file} quit EOF } install_boot_block () { # Before all invocations of the grub shell, call sync to make sure # the raw device is in sync with any bufferring in filesystems. sync # Now perform the installation. $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >>$log_file root $1 setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $2 quit EOF } # Check the arguments. for option in "$@"; do case "$option" in -h | --help) usage exit 0 ;; -v | --version) echo "grub-install (GNU GRUB ${VERSION})" exit 0 ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; --grub-shell=*) grub_shell=`echo "$option" | sed 's/--grub-shell=//'` ;; --no-floppy) no_floppy="--no-floppy" ;; --force-lba) force_lba="--force-lba" ;; --recheck) recheck=yes ;; --just-copy) justcopy=yes ;; # This is an undocumented feature... --debug) debug=yes ;; -*) echo "Unrecognized option \`$option'" 1>&2 usage exit 1 ;; *) if test "x$install_device" != x; then echo "More than one install_devices?" 1>&2 usage exit 1 fi install_device="${option}" ;; esac done # If the debugging feature is enabled, print commands. if test $debug = yes; then set -x fi # Initialize these directories here, since ROOTDIR was initialized. case "$host_os" in netbsd* | openbsd*) # Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub # instead of /boot/grub. grub_prefix=/grub bootdir=${rootdir} ;; *) # Use /boot/grub by default. bootdir=${rootdir}/boot ;; esac grubdir=${bootdir}/grub device_map=${grubdir}/device.map if [ "$recheck" == "yes" ]; then if grep 'mapper' ${device_map} >/dev/null; then echo 'grub-install does not support reprobing of device.map when' 1>&2 echo 'using a device-mapper based boot device.' 1>&2 exit 1 fi fi # if they just want the images copied, copy the images and then exit if test $justcopy = yes; then copy_images exit 0 fi if test "x$install_device" = x; then echo "install_device not specified." 1>&2 usage exit 1 fi # Check if GRUB is installed. # This is necessary, because the user can specify "grub --read-only". set $grub_shell dummy if test -f "$1"; then : else echo "$1: Not found." 1>&2 exit 1 fi if test -f "$pkgdatadir/stage1"; then : else echo "${pkgdatadir}/stage1: Not found." 1>&2 exit 1 fi if test -f "$pkgdatadir/stage2"; then : else echo "${pkgdatadir}/stage2: Not found." 1>&2 exit 1 fi # Don't check for *stage1_5, because it is not fatal even if any # Stage 1.5 does not exist. # Create the GRUB directory if it is not present. test -d "$bootdir" || mkdir "$bootdir" || exit 1 test -d "$grubdir" || mkdir "$grubdir" || exit 1 copy_images # If --recheck is specified, remove the device map, if present. if test $recheck = yes; then mv $device_map ${device_map}.backup fi # Create the device map file if it is not present. if test -f "$device_map"; then : else # Create a safe temporary file. test -n "$mklog" && log_file=`$mklog` # Before all invocations of the grub shell, call sync to make sure # the raw device is in sync with any bufferring in filesystems. sync $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file quit EOF if grep "Error [0-9]*: " $log_file >/dev/null; then cat $log_file 1>&2 exit 1 fi rm -f $log_file fi # Make sure that there is no duplicated entry. tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \ | sort | uniq -d | sed -n 1p` if test -n "$tmp"; then echo "The drive $tmp is defined multiple times in the new device map." 1>&2 if test $recheck = yes; then echo "Reverting to backed up copy." 1>&2 mv ${device_map}.backup $device_map fi exit 1 fi # Make sure device.map has at least one hd device grep -q "^(hd[0-9]\+)" $device_map if [ "x$?" != "x0" ]; then echo "No suitable drive was found in the generated device map." 1>&2 if test $recheck = yes; then echo "Reverting to backed up copy." 1>&2 mv ${device_map}.backup $device_map fi exit 1 fi # Check for INSTALL_DEVICE. case "$install_device" in /dev/*) echo $install_device | grep -q "^/dev/mapper" if [ "x$?" != "x0" ]; then install_device=`resolve_symlink "$install_device"` || exit 1 fi for install_drive in `find_real_devs $install_device` ; do install_drive=`convert $install_drive` || exit 1 if is_raid1_device $install_device; then install_drive=`echo $install_drive | sed 's/,[0-9]*)/)/'` fi if [ "x$install_drive" = "x" ]; then exit 1 fi install_drives="${install_drives} ${install_drive}" done unset install_drive if test "x$install_drives" = x ; then exit 1 fi ;; \([hf]d[0-9]*\)) install_drives="$install_device" ;; [hf]d[0-9]*) # The GRUB format with no parenthesis. install_drives="($install_device)" ;; *) echo "Format of install_device not recognized." 1>&2 usage exit 1 ;; esac unset install_device # Get the root drive. root_device=`find_device ${rootdir}` || exit 1 bootdir_device=`find_device ${bootdir}` || exit 1 # Check if the boot directory is in the same device as the root directory. if test "x$root_device" != "x$bootdir_device"; then # Perhaps the user has a separate boot partition. root_device=$bootdir_device grub_prefix="/grub" fi # Check if the root directory exists in the same device as the grub directory. grubdir_device=`find_device ${grubdir}` || exit 1 if test "x$grubdir_device" != "x$root_device"; then # For now, cannot deal with this situation. cat <<EOF 1>&2 You must set the root directory by the option --root-directory, because $grubdir does not exist in the root device $root_device. EOF exit 1 fi # Make sure that GRUB reads the same images as the host OS. test -n "$mkimg" && img_file=`$mkimg` test -n "$mklog" && log_file=`$mklog` # There's not a real root device, so just pick the first if is_raid1_device $root_device ; then root_device=`find_real_devs $root_device | awk '{print $1}'` fi # Convert the root deviceto a GRUB drive. root_drive=`convert "$root_device"` || exit 1 if [ "x$root_drive" = x ]; then exit 1 fi for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do count=5 tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` while test $count -gt 0; do dump_boot_block $root_drive $img_file if grep "Error [0-9]*: " $log_file >/dev/null; then : else # Use sha1sum instead of cmp to avoid a dependency on diffutils. sha1=`sha1sum $file | cut -d' ' -f 1` sha2=`sha1sum $img_file | cut -d' ' -f 1` if test -f $file -a -f $img_file -a "$sha1" = "$sha2"; then break fi fi sleep 1 count=`expr $count - 1` done if test $count -eq 0; then echo "The file $file not read correctly." 1>&2 exit 1 fi done rm -f $img_file rm -f $log_file if ! test -e ${grubdir}/grub.conf ; then test -e ${grubdir}/menu.lst && ln -s ./menu.lst ${grubdir}/grub.conf fi # Create a safe temporary file. test -n "$mklog" && log_file=`$mklog` for install_drive in $install_drives; do # Convert the root deviceto a GRUB drive. root_drive=`convert "$root_device"` || exit 1 if [ "x$root_drive" = x ]; then exit 1 fi install_boot_block $root_drive $install_drive done if grep "Error [0-9]*: " $log_file >/dev/null ; then cat $log_file 1>&2 exit 1 fi if test $debug = yes; then cat $log_file 1>&2 fi rm -f $log_file # Prompt the user to check if the device map is correct. echo "Installation finished. No error reported." echo "This is the contents of the device map $device_map." echo "Check if this is correct or not. If any of the lines is incorrect," echo "fix it and re-run the script \`grub-install'." echo cat $device_map # Bye. exit 0
Close