Skip to content

Commit 36df84b

Browse files
committed
add -f option
1 parent 32a09e1 commit 36df84b

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
1. [Requirements](#requirements)
55
1. [Provision Instructions](#provision-instructions)
66
1. [Build Instructions](#build-instructions)
7+
1. [More Examples](#more-examples)
78
1. [Acknowledgement](#acknowledgement)
89

910
## About
@@ -35,7 +36,15 @@ Use `build.sh` to create your own images or to include a modified version of `rc
3536
```
3637
# git clone https://github.com/fraenki/freebsd-foreman.git
3738
# cd freebsd-foreman
38-
# ./build.sh -r 13.1
39+
# ./build.sh -r 14.2
40+
```
41+
42+
## More Examples
43+
44+
To use a local copy of the mfsbsd image instead of having the script download it, just specify the filename:
45+
46+
```
47+
./build.sh -r 14.3 -f downloads/mfsbsd-14.3-RELEASE-p3-amd64.img
3948
```
4049

4150
## Acknowledgement

build.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ IMAGE_MD_NO=99
66
IMAGE_MOUNT_DIR='/mnt/loop'
77
ROOT_MD_NO=100
88
ROOT_MOUNT_DIR='/mnt/mfsroot'
9+
MFSBSD_FILENAME=''
910

1011
cleanup() {
1112
cd $TMP_DIR
@@ -20,6 +21,14 @@ fi
2021
# handle arguments
2122
while [ ${#} -gt 0 ]; do
2223
case "${1}" in
24+
-f)
25+
if ! test -e ${2}; then
26+
echo "Specified mfsBSD file not found: ${2}"
27+
exit 1
28+
fi
29+
MFSBSD_FILENAME=$2
30+
shift
31+
;;
2332
-r)
2433
if ! echo ${2} | grep -qE '^[0-9]+\.[0-9]+$'; then
2534
echo "Invalid FreeBSD release specified"
@@ -65,9 +74,14 @@ mkdir -p $TMP_DIR
6574
cd $TMP_DIR
6675

6776
# download mfsbsd image
68-
if ! fetch https://mfsbsd.vx.sk/files/images/${REL_MAJOR}/amd64/${MFSBSD_IMAGE}; then
69-
echo "Failed to download mfsbsd image"
70-
exit 1
77+
if [ -z "${MFSBSD_FILENAME}" ]; then
78+
if ! fetch https://mfsbsd.vx.sk/files/images/${REL_MAJOR}/amd64/${MFSBSD_IMAGE}; then
79+
echo "Failed to download mfsbsd image"
80+
exit 1
81+
fi
82+
else
83+
# use specified file instead
84+
MFSBSD_IMAGE=$MFSBSD_FILENAME
7185
fi
7286

7387
# mount mfsbsd disk image

0 commit comments

Comments
 (0)