-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakemultiboot.sh
More file actions
executable file
·123 lines (90 loc) · 1.9 KB
/
makemultiboot.sh
File metadata and controls
executable file
·123 lines (90 loc) · 1.9 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
script=$(readlink -f "$0")
scriptpath=$(dirname "$script")
# U basic files path
basicpath="$scriptpath/ubasic"
# target u disk
targetdev="$1"
function asktocontinue () {
echo -n "Want to continue?(y/n)"
answer=""
read answer
#echo $answer
if [ ! $answer = 'y' ] && [ ! $answer = 'Y' ] || [ ! $answer ]; then
echo "Abort."
exit
fi
echo "Continue."
}
echo "U disk basic file are in" "$1"
echo ""
echo "Target device is" "$2"
echo ""
asktocontinue
#==============================================
echo ""
echo "Begin to erase device head sectors data"
echo ""
dd if=/dev/zero of="$targetdev" bs=10M count=1
echo ""
echo "Erase finished."
asktocontinue
#========================================
echo ""
echo "Begin to part disk"
echo ""
fdisk "$targetdev" << EOF
o
n
a
t
b
p
w
EOF
echo ""
echo "Parting disk finished."
asktocontinue
#======================================
echo ""
echo "Begin to format as FAT32"
echo ""
mkfs.vfat "$targetdev"1
echo ""
echo "Formatting finished."
asktocontinue
#======================================
echo ""
echo "Begin to write syslinux MBR to target device"
echo ""
dd if="$basicpath"/syslinux/mbr.bin of="$targetdev"
echo ""
echo "Writing MBR finished."
asktocontinue
#========================================
echo ""
echo "Begin to install syslinux to target device partition"
echo ""
mountdir="/tmp/tmp-mkbootu"
mkdir "$mountdir"
mount "$targetdev"1 "$mountdir"
mkdir "$mountdir"/syslinux
umount "$mountdir"
echo ""
echo "Installing syslinux finished."
asktocontinue
#=============================
echo ""
echo "Begin to copy other needed files to target device partition"
echo ""
syslinux -d syslinux -f -i "$targetdev"1
mount "$targetdev"1 "$mountdir"
cp -r "$basicpath"/* "$mountdir"
umount "$mountdir"
echo ""
echo "Copying finished."
#=======
echo ""
echo "All finished."
echo "Modify grub4dos/menu.lst according to your need"
echo ""