25
ostitlename=$(os-prober | sed "s/:/\n/g" | head --lines 2 | tail --lines 1)
26
fullrawdevstring=$(os-prober | sed "s/:/\n/g" | head --lines 1 | grep /dev/)
27
if [ "$fullrawdevstring" != "" ];
30
rawdevstring=$(echo $fullrawdevstring | tail --bytes 3 | head --bytes 2)
31
partno2=$(expr $(echo $rawdevstring | head --bytes 2 | tail --bytes 1) - 1)
32
partgtd2=$(echo $rawdevstring | head --bytes 1 | sed -e s/a/0/ -e s/b/1/ -e s/c/2/ -e s/e/4/ -e s/f/5/ -e s/g/6/ -e s/h/7/ -e s/i/8/ -e s/j/9/ -e s/k/10/ -e s/l/11/ -e s/m/12/ -e s/n/13/ -e s/o/14/ -e s/p/15/ -e s/q/16/ -e s/r/17/ -e s/s/18/ -e s/t/19/ -e s/u/20/ -e s/v/21/ -e s/w/22/ -e s/x/23/ -e s/y/24/ -e s/z/25/)
33
partgtp2=$(echo $partgtd2,$partno2)
37
sosdevstring=$(os-prober | sed "s/:/\n/g" | head --lines 5 | tail --lines 1 | grep /dev/)
38
if [ "$sosdevstring" != "" ];
41
sostitlename=$(os-prober | sed "s/:/\n/g" | head --lines 6 | tail --lines 1)
42
rawdevstring2=$(echo $sosdevstring | tail --bytes 3 | head --bytes 2)
43
partno3=$(expr $(echo $rawdevstring2 | head --bytes 2 | tail --bytes 1) - 1)
44
partgtd3=$(echo $rawdevstring2 | head --bytes 1 | sed -e s/a/0/ -e s/b/1/ -e s/c/2/ -e s/e/4/ -e s/f/5/ -e s/g/6/ -e s/h/7/ -e s/i/8/ -e s/j/9/ -e s/k/10/ -e s/l/11/ -e s/m/12/ -e s/n/13/ -e s/o/14/ -e s/p/15/ -e s/q/16/ -e s/r/17/ -e s/s/18/ -e s/t/19/ -e s/u/20/ -e s/v/21/ -e s/w/22/ -e s/x/23/ -e s/y/24/ -e s/z/25/)
45
partgtp3=$(echo $partgtd3,$partno3)
51
tosdevstring=$(os-prober | sed "s/:/\n/g" | head --lines 9 | tail --lines 1 | grep /dev/)
52
if [ "$tosdevstring" != "" ];
55
tostitlename=$(os-prober | sed "s/:/\n/g" | head --lines 10 | tail --lines 1)
56
rawdevstring3=$(echo $tosdevstring | tail --bytes 3 | head --bytes 2)
57
partno4=$(expr $(echo $rawdevstring3 | head --bytes 2 | tail --bytes 1) - 1)
58
partgtd4=$(echo $rawdevstring3 | head --bytes 1 | sed -e s/a/0/ -e s/b/1/ -e s/c/2/ -e s/e/4/ -e s/f/5/ -e s/g/6/ -e s/h/7/ -e s/i/8/ -e s/j/9/ -e s/k/10/ -e s/l/11/ -e s/m/12/ -e s/n/13/ -e s/o/14/ -e s/p/15/ -e s/q/16/ -e s/r/17/ -e s/s/18/ -e s/t/19/ -e s/u/20/ -e s/v/21/ -e s/w/22/ -e s/x/23/ -e s/y/24/ -e s/z/25/)
59
partgtp4=$(echo $partgtd4,$partno4)
25
hostosroot=$(cat /proc/mounts | grep /media/host | sed "s/\t/\n/g" | sed "s/ /\n/g" | head --lines 1 | grep /dev/)
26
hostosdrivenum=$(echo $hostosroot | tail --bytes 3 | head --bytes 1 | sed -e s/a/0/ -e s/b/1/ -e s/c/2/ -e s/e/4/ -e s/f/5/ -e s/g/6/ -e s/h/7/ -e s/i/8/ -e s/j/9/ -e s/k/10/ -e s/l/11/ -e s/m/12/ -e s/n/13/ -e s/o/14/ -e s/p/15/ -e s/q/16/ -e s/r/17/ -e s/s/18/ -e s/t/19/ -e s/u/20/ -e s/v/21/ -e s/w/22/ -e s/x/23/ -e s/y/24/ -e s/z/25/)
27
hostospartnum=$(expr $(echo $hostosroot | tail --bytes 2 | head --bytes 1) - 1)
28
hostosgrubnum="(hd$(echo $hostosdrivenum),$(echo $hostospartnum))"
29
hostosfstype=$(vol_id -t $hostosroot)
30
if [ "$hostosfstype" = "ntfs" ]; then
33
if [ "$hostosfstype" = "vfat" ]; then
36
if [ "$hostosfstype" = "ext3" ]; then
39
if [ "$hostosfstype" = "ext3" ]; then
42
if [ "$hostosfstype" = "ext2" ]; then
45
if [ "$hostosfstype" = "reiserfs" ]; then
48
if [ "$hostosfstype" = "jfs" ]; then
51
if [ "$hostosfstype" = "xfs" ]; then
54
if [ -s $hostosname ]; then
55
hostosname="Unknownos"
93
86
rm /media/tdm/boot/grub/menu.lst
94
87
rm /media/tdm/etc/fstab
95
88
touch /media/tdm/etc/fstab
89
mkdir /media/tdm/media/host
90
mhostosfstype=$(echo $hostosfstype | sed "s/ntfs/ntfs-3g/")
98
93
"# <file system> <mount point> <type> <options> <dump> <pass>
99
94
proc /proc proc defaults 0 0
100
95
$tdp / $tpf defaults 0 1
96
$hostosroot /media/host $mhostosfstype defaults 0 0
101
97
" > /media/tdm/etc/fstab
102
98
if [ "$sdp" != "" ];
108
104
" >> /media/tdm/etc/fstab
111
host1uuid=$(vol_id $fullrawdevstring | grep UUID | sed s/ID_FS_//)
112
host1fstype=$(vol_id -t $fullrawdevstring | sed s/ntfs/ntfs-3g/)
115
$fullrawdevstring /media/host $host1fstype defaults 0 1
116
" >> /media/tdm/etc/fstab
118
if [ "$is2os" = "yes" ];
120
host2fstype=$(vol_id -t $sosdevstring | sed s/ntfs/ntfs-3g/)
121
mkdir /media/tdm/media/host2
122
host2uuid=$(vol_id $sosdevstring | grep UUID | sed s/ID_FS_//)
125
$sosdevstring /media/host2 $host2fstype defaults 0 1
126
" >> /media/tdm/etc/fstab
129
if [ "$is3os" = "yes" ];
131
host3fstype=$(vol_id -t $tosdevstring | sed s/ntfs/ntfs-3g/)
132
mkdir /media/tdm/media/host3
133
host3uuid=$(vol_id $sosdevstring | grep UUID | sed s/ID_FS_//)
136
$tosdevstring /media/host3 $host3fstype defaults 0 1
137
" >> /media/tdm/etc/fstab
141
107
chroot /media/tdm <<EOT
142
108
dpkg --force-all --purge lupin-target
183
hostosroot=$(cat /proc/mounts | grep /media/host | sed "s/\t/\n/g" | sed "s/ /\n/g" | head --lines 1 | grep /dev/)
184
hostosdrivenum=$(echo $hostosroot | tail --bytes 3 | head --bytes 1 | sed -e s/a/0/ -e s/b/1/ -e s/c/2/ -e s/e/4/ -e s/f/5/ -e s/g/6/ -e s/h/7/ -e s/i/8/ -e s/j/9/ -e s/k/10/ -e s/l/11/ -e s/m/12/ -e s/n/13/ -e s/o/14/ -e s/p/15/ -e s/q/16/ -e s/r/17/ -e s/s/18/ -e s/t/19/ -e s/u/20/ -e s/v/21/ -e s/w/22/ -e s/x/23/ -e s/y/24/ -e s/z/25/)
185
hostospartnum=$(expr $(echo $hostosroot | tail --bytes 2 | head --bytes 1) - 1)
186
hostosgrubnum="(hd$(echo $hostosdrivenum),$(echo $hostospartnum))"
187
hostosfstype=$(vol_id -t $hostosroot)
188
if [ "$hostosfstype" = "ntfs" ]; then
191
if [ "$hostosfstype" = "vfat" ]; then
194
if [ "$hostosfstype" = "ext3" ]; then
197
if [ "$hostosfstype" = "ext3" ]; then
200
if [ "$hostosfstype" = "ext2" ]; then
203
if [ "$hostosfstype" = "reiserfs" ]; then
206
if [ "$hostosfstype" = "jfs" ]; then
209
if [ "$hostosfstype" = "xfs" ]; then
212
if [ -s $hostosname ]; then
213
hostosname="Unknownos"
218
151
# This is a divider, added to separate the menu items below from the Debian
241
174
" >> /media/tdm/boot/grub/menu.lst
244
if [ "$is1os" = "yes" ];
253
" >> /media/tdm/boot/grub/menu.lst
256
if [ "$is2os" = "yes" ];
265
" >> /media/tdm/boot/grub/menu.lst
268
if [ "$is3os" = "yes" ];
277
" >> /media/tdm/boot/grub/menu.lst
280
sed -i "s/hiddenmenu/#hiddenmenu/g" /media/tdm/boot/grub/menu.lst
281
sed -i "s/ #hiddenmenu/ hiddenmenu/" /media/tdm/boot/grub/menu.lst
177
if [ "$hostosname" = "Unknownos" ]; then
185
" >> /media/tdm/boot/grub/menu.lst
188
sed -i -e "s/hiddenmenu/#hiddenmenu/g" -e "s/ #hiddenmenu/ hiddenmenu/" /media/tdm/boot/grub/menu.lst
283
190
umount /media/tdm