Skip to content

Instantly share code, notes, and snippets.

@naa0yama
Created December 27, 2017 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naa0yama/b84f2c96ff2e3789d42646d7e598b407 to your computer and use it in GitHub Desktop.
Save naa0yama/b84f2c96ff2e3789d42646d7e598b407 to your computer and use it in GitHub Desktop.
MacBook で ISO を DD したら起動できなかったのでメモ ref: https://qiita.com/FoxBoxsnet/items/04e20d5e72b9b58b97f9
$ diskutil unmountDisk /dev/disk2
$ dd if=<isoimage.iso> of=/dev/disk2 bs=1m
#!/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