make-memstick.sh (332639) | make-memstick.sh (334444) |
---|---|
1#!/bin/sh 2# 3# This script generates a "memstick image" (image that can be copied to a 4# USB memory stick) from a directory tree. Note that the script does not 5# clean up after itself very well for error conditions on purpose so the 6# problem can be diagnosed (full filesystem most likely but ...). 7# 8# Usage: make-memstick.sh <directory tree> <image filename> 9# | 1#!/bin/sh 2# 3# This script generates a "memstick image" (image that can be copied to a 4# USB memory stick) from a directory tree. Note that the script does not 5# clean up after itself very well for error conditions on purpose so the 6# problem can be diagnosed (full filesystem most likely but ...). 7# 8# Usage: make-memstick.sh <directory tree> <image filename> 9# |
10# $FreeBSD: stable/11/release/amd64/make-memstick.sh 332639 2018-04-17 00:46:21Z emaste $ | 10# $FreeBSD: stable/11/release/amd64/make-memstick.sh 334444 2018-05-31 20:01:58Z gjb $ |
11# 12 13set -e 14 15PATH=/bin:/usr/bin:/sbin:/usr/sbin 16export PATH 17 18if [ $# -ne 2 ]; then --- 12 unchanged lines hidden (view full) --- 31fi 32 33echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab 34echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local 35makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} 36rm ${1}/etc/fstab 37rm ${1}/etc/rc.conf.local 38 | 11# 12 13set -e 14 15PATH=/bin:/usr/bin:/sbin:/usr/sbin 16export PATH 17 18if [ $# -ne 2 ]; then --- 12 unchanged lines hidden (view full) --- 31fi 32 33echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab 34echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local 35makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1} 36rm ${1}/etc/fstab 37rm ${1}/etc/rc.conf.local 38 |
39mkimg -s gpt \ 40 -b ${1}/boot/pmbr \ | 39mkimg -s mbr \ 40 -b ${1}/boot/mbr \ |
41 -p efi:=${1}/boot/boot1.efifat \ | 41 -p efi:=${1}/boot/boot1.efifat \ |
42 -p freebsd-boot:=${1}/boot/gptboot \ 43 -p freebsd-ufs:=${2}.part \ 44 -p freebsd-swap::1M \ | 42 -p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \ 43 -a 2 \ |
45 -o ${2} 46rm ${2}.part 47 | 44 -o ${2} 45rm ${2}.part 46 |