/
pbaddbootgparted
executable file
·111 lines (103 loc) · 3.6 KB
/
pbaddbootgparted
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
#!/bin/bash
# Auteur : Pierre Brochard (pierre.brochard.1982@m4x.org)
# Date : 2019
# License : See the LICENSE file in this repository.
GPARTISO="$1"
MNTDIR2="$2"
TARGETPART="$3"
SYSLINHOME="/usr/lib/syslinux"
[ ! -r "$SYSLINHOME/mbr.bin" ] && SYSLINHOME="/usr/share/syslinux"
PBSLACKSPWD="$(cd $(dirname $0); pwd)";cd "$MYPWD"
if [ "$GPARTISO" != '' -a "$MNTDIR2" != '' -a "$TARGETPART" != '' ] ;then
# Add a gparted boot (syslinux + grub).
echo "--- Add gparted boot option..."
echo "GPARTISO = $GPARTISO"
echo "TARGETPART = $TARGETPART"
LPARTISO=$(basename "$GPARTISO")
###################################
# syslinux for legacy boot.
###################################
# Exemple de menu (menu.c32) :
# ui menu.c32
# menu label ...
# A faire bouton aide comme f2.txt mais avec infos sur cas dual boot...
cat "$MNTDIR2/syslinux.cfg"|\
sed 's@^label \(.*\)$@label \1\n menu label \1@' |\
sed "/^ menu label .*$/ {a\\
text help\\
Demarre la procedure d'installation de Slackware 64 bits.\\
\\
Launch the 64 bits Slackware install.\\
endtext\\
}" > "$MNTDIR2/syslinux.cfg.new"
cat <<EOF > "$MNTDIR2/syslinux.cfg"
ui vesamenu.c32
menu background bootimg.jpg
EOF
cat "$MNTDIR2/syslinux.cfg.new" >> "$MNTDIR2/syslinux.cfg"
rm -f "$MNTDIR2/syslinux.cfg.new"
cat <<EOF >> "$MNTDIR2/syslinux.cfg"
menu separator
label gparted
menu label GParted disk manager
text help
Demarre le gestionnaire de disques GParted qui permet le partionnement de
vos disques durs pour y mettre votre systeme Linux.
Si un systeme preexiste comme MS Windows, GPparted permet de redimensionner
les partitions existantes pour faire de la place et inserer de nouvelles
partitions.
Boot the GParted disk manager for partionning your hard disks and
putting a linux system.
If there is another system like MS Windows, GPparted can shrink and move
the already existant partitions to obtain room for new partitions.
endtext
linux memdisk
initrd $LPARTISO
EOF
cp "$SYSLINHOME/memdisk" "$MNTDIR2"
cp "$SYSLINHOME/vesamenu.c32" "$MNTDIR2"
cp "$PBSLACKSPWD/bootimg.jpg" "$MNTDIR2"
cp "$GPARTISO" "$MNTDIR2"
###################################
# refind can't boot on an isofile.
# REFINDHOME="$(ls /usr/share/refind-* 2> /dev/null)"
# [ -d "$REFINDHOME" ] && \
# (cd "$REFINDHOME";./refind-install --usedefault $TARGETPART)
###################################
# grub for uefi boot.
# loopback loop (hd0,1)$isofile
# memtest86+ mettre le package.
###################################
cp "$PBSLACKSPWD/bootimg.png" "$MNTDIR2"
grub-install --removable --boot-directory="$MNTDIR2" \
--efi-directory="$MNTDIR2" --target=x86_64-efi $TARGETPART
grub-mkfont -s 14 -o $MNTDIR2/grub/fonts/DejaVuSansMono.pf2 \
/usr/share/fonts/TTF/DejaVuSansMono.ttf
cat <<EOF > "$MNTDIR2/grub/grub.cfg"
insmod all_video
insmod loopback
insmod gfxterm
insmod png
set default=0
set timeout=120
set gfxmode=640x480
terminal_output gfxterm
background_image /bootimg.png
loadfont /grub/fonts/DejaVuSansMono.pf2
menuentry "Huge kernel" --class=Slackware {
linux /huge.s load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nomodeset
initrd /initrd.img
}
menuentry "Kms kernel" --class=Slackware {
linux /huge.s load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0
initrd /initrd.img
}
menuentry "GParted disk manager" --class=GParted {
set isofile="$LPARTISO"
loopback loop /\$isofile
linux (loop)/live/vmlinuz boot=live components config findiso=\$isofile ip=frommedia toram=filesystem.squashfs union=overlay username=user
initrd (loop)/live/initrd.img
}
EOF
###################################
fi