- Timestamp:
- Jun 2, 2016, 12:57:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi/mindi
r3573 r3585 127 127 fi 128 128 129 ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi -V Mindi _Image -o $MINDI_CACHE/mindi.iso "129 ISO_OPT="-J -r -v -p Mindi -publisher http://www.mondorescue.org -A Mindi -V Mindi-Image -o $MINDI_CACHE/mindi.iso " 130 130 131 131 # Mindi set this as default in case it's invoked alone … … 2079 2079 } 2080 2080 2081 PrepareBootDir() { 2082 2083 local detect 2084 # Needs a bigdir variable setup before calling it 2085 2086 # copy (e)lilo/isolinux/grub/whatever stuff into it as well 2087 # to get it on the media (in addition to the boot part 2088 # and also to support UEFI boot mechanism 2089 if [ "$boottype" != "" ]; then 2090 detect="no" 2091 else 2092 detect="yes" 2093 boottype=syslinux 2094 fi 2095 bootdir=$bigdir/$boottype 2096 bootconf="$bootdir/$boottype.cfg" 2097 mkdir -p $bootdir 2098 FindLdlinux32Binary 2099 2100 if [ "$BOOT_TYPE" != "BIOS" ]; then 2101 if [ "$BOOT_TYPE" = "UNKNOWN" ]; then 2102 LogAll "ERROR: UNKNOWN BOOT_TYPE. Please report upstream" 2103 MindiExit -1 2104 fi 2105 2106 mountefi=0 2107 # EFI or UEFI 2108 # TODO: names are hard-coded for now 2109 if [ "$BOOT_TYPE" = "UEFI" ]; then 2110 # UEFI 2111 efidir=$bigdir/EFI/BOOT 2112 # Auto-detection if needed 2113 if [ $detect = "yes" ]; then 2114 2115 # mount /boot/efi if needed 2116 df -T | grep /boot/efi | grep -qE 'vfat' 2117 if [ $? -ne 0 ]; then 2118 mount /boot/efi 2119 if [ $? -ne 0 ]; then 2120 echo "ERROR: You have to mount your (U)EFI partition when using mindi" 2121 MindiExit -1 2122 fi 2123 mountefi=1 2124 fi 2125 2126 # On RHEL6 grub works 2127 dname=`pbdistrocheck | grep -E '^Name:' | cut -d':' -f2` 2128 dver=`pbdistrocheck | grep -E '^Ver:' | cut -d':' -f2` 2129 if [ $dname = "rhel" ] && [ $dver = "6" ]; then 2130 boottype=grub 2131 elif [ $dname = "rhel" ] && [ $dver = "7" ]; then 2132 boottype=grub2 2133 elif [ $dname = "debian" ] && [ $dver = "8" ]; then 2134 boottype=grub2 2135 else 2136 # Use syslinux.efi as the default boot loader ... but it doesn't work for now :-( 2137 boottype=syslinux 2138 fi 2139 fi 2140 if [ "$boottype" = "syslinux" ]; then 2141 if [ ! "$bootbin" ]; then 2142 FindSyslinux64EFI 2143 bootbin=$SYSLINUX64EFI 2144 fi 2145 bootconf="$efidir/syslinux.cfg" 2146 elif [ "$boottype" = "grub" ]; then 2147 if [ ! "$bootbin" ]; then 2148 bootbin=`find /boot/efi -iname "grub*.efi" | head -1` 2149 fi 2150 bootconf="$efidir/BOOTX64.conf" 2151 elif [ "$boottype" = "grub2" ]; then 2152 if [ ! "$bootbin" ]; then 2153 bootbin=`find /boot/efi -iname "grub*.efi" | head -1` 2154 fi 2155 bootconf="$efidir/grub.cfg" 2156 fi 2157 2158 # Depending on the arch, the target boot file is different 2159 if [ "$ARCH" = "x86_64" ] ; then 2160 tgbin="BOOTX64.efi" 2161 elif [ "$ARCH" = "armv8" ]; then 2162 tgbin="BOOTAA64.efi" 2163 else 2164 # i?386 2165 tgbin="BOOTIA32" 2166 fi 2167 else 2168 # EFI 2169 efidir=$bootdir 2170 bootbin=`find /boot/efi -iname "elilo.efi" | head -1` 2171 tgbin=$bootbin 2172 boottype=elilo 2173 bootconf="$efidir/elilo.conf" 2174 fi 2175 LogAll "INFO: Found $boottype boot type" 2176 mkdir -p $efidir 2177 cp $bootbin $efidir/$tgbin 2178 2179 if [ $mountefi -eq 1 ]; then 2180 umount /boot/efi 2>&1 > /dev/null 2181 fi 2182 2183 if [ $boottype = "syslinux" ]; then 2184 FindLdlinuxe64Binary 2185 if [ -e "$LDLINUXE64" ]; then 2186 LogFile "INFO: Copying $LDLINUXE64 to $efidir" 2187 cp $LDLINUXE64 $efidir 2>> $LOGFILE || Die "Cannot copy $LDLINUXE64 to $efidir). Did you run out of disk space?" 2188 cp $LDLINUXE64/../libutil.c32 $efidir 2>> $LOGFILE || Die "Cannot copy libutil.c32 to $efidir). Did you run out of disk space?" 2189 if [ -e $LDLINUXE64/../isolinux.c32 ]; then 2190 cp $LDLINUXE64/../isolinux.c32 $efidir 2>> $LOGFILE || Die "Cannot copy isolinux.c32 to $efidir). Did you run out of disk space?" 2191 fi 2192 fi 2193 fi 2194 # tgdir for syslinux 2195 tgdir=$bigdir/EFI 2196 else 2197 # tgdir for syslinux 2198 tgdir=$bootdir 2199 fi 2200 # In all cases prepare syslinux content for BIOS mode 2201 # so that we can have multi boot mode media BIOS+UEFI 2202 # Useful for syslinux 5.x 2203 if [ -e "$LDLINUXC32" ]; then 2204 LogFile "INFO: Copying $LDLINUXC32 to $tgdir" 2205 cp $LDLINUXC32 "$tgdir" 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $tgdir. Did you run out of disk space?" 2206 fi 2207 if [ -e $LDLINUXC32/../isolinux.c32 ]; then 2208 LogFile "INFO: Copying isolinux.c32 to $tgdir" 2209 cp $LDLINUXC32/../isolinux.c32 $tgdir 2>> $LOGFILE || Die "Cannot copy isolinux.c32 to $tgdir). Did you run out of disk space?" 2210 fi 2211 2212 # Here we need to know the ramdisk_size 2213 size_of_all_tools=`du -sk $bigdir | cut -f1` 2214 export ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE)) 2215 LogFile "INFO: Ramdisk will be $ramdisk_size KB" 2216 2217 MakeBootConfFile $boottype > $bootconf 2218 LogFile "Boot Conf file $bootconf content is:" 2219 LogFile "------------------------------------" 2220 cat $bootconf >> $LOGFILE 2221 LogFile "------------------------------------" 2222 if [ "$BOOT_TYPE" = "UEFI" ]; then 2223 # Also generate the syslinux conf 2224 MakeBootConfFile syslinux > "$bigdir/EFI/syslinux.cfg" 2225 LogFile "Boot Conf file $bigdir/EFI/syslinux.cfg content is:" 2226 LogFile "---------------------------------------------------" 2227 cat $bigdir/EFI/syslinux.cfg >> $LOGFILE 2228 LogFile "---------------------------------------------------" 2229 fi 2230 2231 } 2232 2233 PrepareAllTar() { 2234 echo -en "INFO: Tarring and zipping the data content..." 2235 (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $MINDI_CACHE/all.tar.gz || LogAll "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log) 2236 LogFile "Size of the data content" 2237 LogFile "------------------------" 2238 du -sk $MINDI_CACHE/*gz >> $LOGFILE 2239 LogFile "------------------------" 2240 echo -e "$DONE" 2241 2242 [ "$bigdir" != "/" ] && rm -rf $bigdir 2243 } 2081 2244 2082 2245 PrepareDataDiskImages() { … … 2119 2282 2120 2283 CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 1 2284 rm -f $needlist 2121 2285 echo -e "$DONE" 2122 2286 … … 2190 2354 fi 2191 2355 2192 # copy (e)lilo/isolinux/grub/whatever stuff into it as well 2193 # to get it on the media (in addition to the boot part 2194 # and also to support UEFI boot mechanism 2195 bootdir=$bigdir/syslinux 2196 bootconf="$bootdir/syslinux.cfg" 2197 boottype=syslinux 2198 mkdir -p $bootdir 2199 FindLdlinux32Binary 2200 if [ "$BOOT_TYPE" != "BIOS" ]; then 2201 if [ "$BOOT_TYPE" = "UNKNOWN" ]; then 2202 LogAll "ERROR: UNKNOWN BOOT_TYPE. Please report upstream" 2203 MindiExit -1 2204 fi 2205 # EFI or UEFI 2206 # TODO: names are hard-coded for now 2207 if [ "$BOOT_TYPE" = "UEFI" ]; then 2208 # UEFI 2209 efidir=$bigdir/EFI/BOOT 2210 # On RHEL6 grub works 2211 dname=`pbdistrocheck | grep -E '^Name:' | cut -d':' -f2` 2212 dver=`pbdistrocheck | grep -E '^Ver:' | cut -d':' -f2` 2213 if [ $dname = "rhel" ] && [ $dver = "6" ]; then 2214 bootbin=`find /boot/efi -iname "grub*.efi" | head -1` 2215 bootconf="$efidir/BOOTX64.conf" 2216 boottype=grub 2217 elif [ $dname = "rhel" ] && [ $dver = "7" ]; then 2218 bootbin=`find /boot/efi -iname "grub*.efi" | head -1` 2219 bootconf="$efidir/grub.cfg" 2220 boottype=grub2 2221 elif [ $dname = "debian" ] && [ $dver = "8" ]; then 2222 bootbin=`find /boot/efi -iname "grub*.efi" | head -1` 2223 bootconf="$efidir/grub.cfg" 2224 boottype=grub2 2225 else 2226 # Use syslinux.efi as the default boot loader ... but it doesn't work for now :-( 2227 FindSyslinux64EFI 2228 bootbin=$SYSLINUX64EFI 2229 bootconf="$efidir/syslinux.cfg" 2230 fi 2231 2232 # Depending on the arch, the target boot file is different 2233 if [ "$ARCH" = "x86_64" ] ; then 2234 tgbin="BOOTX64.efi" 2235 elif [ "$ARCH" = "armv8" ]; then 2236 tgbin="BOOTAA64.efi" 2237 else 2238 # i?386 2239 tgbin="BOOTIA32" 2240 fi 2241 else 2242 # EFI 2243 efidir=$bootdir 2244 bootbin=`find /boot/efi -iname "elilo.efi" | head -1` 2245 tgbin=$bootbin 2246 boottype=elilo 2247 bootconf="$efidir/elilo.conf" 2248 fi 2249 LogAll "INFO: Found $boottype boot type" 2250 2251 # Copy it so that CD-ROM menu entry is satisfied 2252 mountefi=0 2253 df -T | grep /boot/efi | grep -qE 'vfat' 2254 if [ $? -ne 0 ]; then 2255 mount /boot/efi 2256 if [ $? -ne 0 ]; then 2257 echo "ERROR: You have to mount your (U)EFI partition when using mindi" 2258 MindiExit -1 2259 fi 2260 mountefi=1 2261 fi 2262 mkdir -p $efidir 2263 cp $bootbin $efidir/$tgbin 2264 if [ $mountefi -eq 1 ]; then 2265 umount /boot/efi 2>&1 > /dev/null 2266 fi 2267 2268 if [ $boottype = "syslinux" ]; then 2269 FindLdlinuxe64Binary 2270 if [ -e "$LDLINUXE64" ]; then 2271 LogFile "INFO: Copying $LDLINUXE64 to $efidir" 2272 cp $LDLINUXE64 $efidir 2>> $LOGFILE || Die "Cannot copy $LDLINUXE64 to $efidir). Did you run out of disk space?" 2273 cp $LDLINUXE64/../libutil.c32 $efidir 2>> $LOGFILE || Die "Cannot copy $LDLINUXE64 to $efidir). Did you run out of disk space?" 2274 fi 2275 fi 2276 # In all cases prepare syslinux content for BIOS mode 2277 # so that we can have multi boot mode media BIOS+UEFI 2278 if [ -e "$LDLINUXC32" ]; then 2279 LogFile "INFO: Copying $LDLINUXC32 to $bigdir/EFI" 2280 cp $LDLINUXC32 "$bigdir/EFI" 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $bigtdir/EFI. Did you run out of disk space?" 2281 fi 2282 else 2283 # Useful for syslinux 5.x 2284 if [ -e "$LDLINUXC32" ]; then 2285 LogFile "INFO: Copying $LDLINUXC32 to $bootdir" 2286 cp $LDLINUXC32 $bootdir 2>> $LOGFILE || Die "Cannot copy $LDLINUXC32 to $bootdir. Did you run out of disk space?" 2287 fi 2288 fi 2289 2290 # Here we need to know the ramdisk_size 2291 size_of_all_tools=`du -sk $bigdir | cut -f1` 2292 export ramdisk_size=$(($size_of_all_tools+$EXTRA_SPACE)) 2293 LogFile "INFO: Ramdisk will be $ramdisk_size KB" 2294 2295 MakeBootConfFile $boottype > $bootconf 2296 LogFile "Boot Conf file $bootconf content is:" 2297 LogFile "------------------------------------" 2298 cat $bootconf >> $LOGFILE 2299 LogFile "------------------------------------" 2300 if [ "$BOOT_TYPE" = "UEFI" ]; then 2301 # Also generate the syslinux conf 2302 MakeBootConfFile syslinux > "$bigdir/EFI/syslinux.cfg" 2303 LogFile "Boot Conf file $bigdir/EFI/syslinux.cfg content is:" 2304 LogFile "---------------------------------------------------" 2305 cat $bigdir/EFI/syslinux.cfg >> $LOGFILE 2306 LogFile "---------------------------------------------------" 2307 fi 2308 2309 echo -en "INFO: Tarring and zipping the data content..." 2310 (cd "$bigdir" ; tar -b 4096 -cf - . 2>> $MINDI_TMP/$$.log | gzip -9 > $MINDI_CACHE/all.tar.gz || LogAll "ERROR: Problem creating all.tar.gz" $MINDI_TMP/$$.log) 2311 LogFile "Size of the data content" 2312 LogFile "------------------------" 2313 du -sk $MINDI_CACHE/*gz >> $LOGFILE 2314 LogFile "------------------------" 2315 echo -e "$DONE" 2316 2317 [ "$bigdir" != "/" ] && rm -rf $bigdir 2318 rm -f $needlist 2356 PrepareBootDir 2357 PrepareAllTar 2319 2358 } 2320 2359 … … 3312 3351 export MONDO_SHARE="" 3313 3352 MindiExit 0 3353 elif [ "$1" = "--ironic" ] ; then 3354 [ ! "$2" ] && [ ! -f "$2" ] && Die "Please specify the kernel to use" 3355 [ ! "$3" ] && [ ! -f "$3" ] && Die "Please specify the initramfs to use" 3356 [ "$4" ] && [ "$4" != "UEFI" ] && [ "$4" != "BIOS" ] && Die "Please specify the boot mode as BIOS or UEFI" 3357 #TODO: See how we can influence the boot loader 3358 [ "$5" ] && [ "$5" != "isolinux" ] && [ "$5" != "grub" ] && [ "$5" != "grub2" ] && Die "Please specify the boot loader as isolinux or grub or grub2" 3359 if [ "$5" ]; then 3360 boottype=$5 3361 fi 3362 [ "$6" ] && [ ! -e "$6" ] && Die "Please specify an existing boot loader path for $boottype" 3363 if [ "$6" ]; then 3364 bootbin=$6 3365 fi 3366 kernelpath=$2 3367 BOOT_TYPE=$4 3368 bigdir=$MINDI_TMP/bigdir 3369 PrepareBootDir 3370 PrepareAllTar 3371 cp $3 $MINDI_TMP/initrd.img 3372 MakeBootableDevice ISO 3373 MindiExit 0 3314 3374 elif [ "$#" -ge "9" ] && [ "$1" = "--custom" ] ; then 3315 3375 MONDO_TMP=$2 … … 3394 3454 fi 3395 3455 else 3396 LogScreen "Syntax: mindi (--custom ....)" 3456 LogScreen "Syntax: mindi [--custom ....MondoRescue parameters...]" 3457 LogScreen " mindi --ironic kernel initrd [BIOS|UEFI] [syslinux|grub|grub2] [/path/to/bootloader]" 3458 LogScreen " mindi --locatedeps file" 3459 LogScreen " mindi --makemessage" 3460 LogScreen " mindi --makemountlist file" 3461 LogScreen " mindi --makebcf bootloader" 3462 LogScreen " mindi -V" 3397 3463 MindiExit -1 3398 3464 fi
Note:
See TracChangeset
for help on using the changeset viewer.