-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfake-grub-probe.sh
executable file
·78 lines (70 loc) · 1.59 KB
/
fake-grub-probe.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#
# A faker script for grub-probe, if your's stops working properly
#
# Depends on /root/grub.hack file
# . /root/grub.hach
arg_is_device=0
target=""
# Call Order:
# / --target=device
# --target=fs_uuid /dev/sda1 --device
# /boot --target=device
# --target=fs_uuid /boot --device
# "/" "--target=fs"
# "--target=abstraction" "ext2" "--device"
# "--target=fs" "ext2" "--device"
# "--target=drive" "ext2" "--device"
# "--target=fs_uuid" "ext2" "--device"
# "--target=abstraction" "ext2" "--device"
# "--target=fs" "ext2" "--device"
# "--target=drive" "ext2" "--device"
# "--target=fs_uuid" "ext2" "--device"
# "/" "--target=device"
# "--target=fs_uuid" "ext2" "--device"
# "/boot" "--target=device"
# "--target=fs_uuid" "ext2" "--device"
# "/" "--target=fs"
# "--target=abstraction" "ext2" "--device"
# "--target=fs" "ext2" "--device"
# "--target=drive" "ext2" "--device"
# "--target=fs_uuid" "ext2" "--device"
# "--target=abstraction" "ext2" "--device"
# "--target=fs" "ext2" "--device"
# "--target=drive" "ext2" "--device"
# "--target=fs_uuid" "ext2" "--device"
for opt in $@
do
case "${opt}" in
--device)
# Means the thing in $arg is a device
arg_is_device=1
;;
--target=*)
# = device, = fs, = fs_uuid
target=${opt#*=}
;;
*)
arg=$opt
;;
esac
done
set >> /tmp/probe.env
case "$target" in
abstraction)
echo
;;
device)
echo "/dev/sda1"
;;
drive)
echo "(hd0)"
;;
fs)
# Returns the filesystem type
echo "ext2"
;;
fs_uuid)
tune2fs -l $arg | awk '/Filesystem UUID/ { print $3 }'
;;
esac