Created
December 27, 2017 23:57
-
-
Save naa0yama/b84f2c96ff2e3789d42646d7e598b407 to your computer and use it in GitHub Desktop.
MacBook で ISO を DD したら起動できなかったのでメモ ref: https://qiita.com/FoxBoxsnet/items/04e20d5e72b9b58b97f9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ diskutil unmountDisk /dev/disk2 | |
$ dd if=<isoimage.iso> of=/dev/disk2 bs=1m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cmdname=`basename $0` | |
# usage | |
function usage(){ | |
cat << EOF | |
Usage: ${cmdname} [ISO file] | |
EOF | |
} | |
function diskwrite(){ | |
diskutil list | |
printf "Device name (ex: /dev/disk2): " | |
read DeviceName | |
echo "-- ================================================" | |
echo "-- Converting ISO Image..." | |
echo "-- ================================================" | |
hdiutil convert -format UDRW -o tmp.img "$1" | |
echo "-- ================================================" | |
echo "-- Disk Formating..." | |
echo "-- ================================================" | |
diskutil eraseDisk FAT32 UNTITLED MBR "$DeviceName" | |
diskutil unmountDisk "$DeviceName" | |
diskutil list $DeviceName | |
echo "-- ================================================" | |
echo "-- Disk Copy files..." | |
echo "-- ================================================" | |
echo "Please enter sudo password" | |
mkdir -p .copytmp | |
hdiutil mount $DeviceName | |
hdiutil mount tmp.img.dmg -mountpoint .copytmp | |
cp -rv .copytmp/ /Volumes/UNTITLED/ | |
diskutil eject .copytmp | |
rm -rf .copytmp | |
echo "-- ================================================" | |
echo "-- Disk Eject..." | |
echo "-- ================================================" | |
diskutil eject "$DeviceName" | |
rm -f tmp.img.dmg | |
echo "-- ================================================" | |
echo "-- Write complete!" | |
echo "-- ================================================" | |
} | |
if [ $# -ne 1 ]; then | |
usage | |
exit 1 | |
else | |
diskwrite "$1" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment