Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2006 14:39:31 +0200
From:      Jeremie Le Hen <jeremie@le-hen.org>
To:        Julian Elischer <julian@FreeBSD.org>, Jean Milanez Melo <jmelo@freebsdbrasil.com.br>
Cc:        freebsd-current@FreeBSD.org, freebsd-small@FreeBSD.org
Subject:   Re: Handling non-standard directories in tinybsd
Message-ID:  <20061024123931.GF20405@obiwan.tataz.chchile.org>
In-Reply-To: <20061024100641.GB20405@obiwan.tataz.chchile.org>
References:  <20061024100641.GB20405@obiwan.tataz.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--0ntfKIWw70PvrIHh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

this next patch knows how to handle image file specified with an
absolute path.  Moreover if the creation of the final image has
failed, the temporary "vnode file" is left for the user.

Regards,
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >

--0ntfKIWw70PvrIHh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tinybsd_absolutepath.patch"

Index: tinybsd
===================================================================
RCS file: /home/ncvs/src/tools/tools/tinybsd/tinybsd,v
retrieving revision 1.4
diff -u -p -r1.4 tinybsd
--- tinybsd	11 Oct 2006 21:46:53 -0000	1.4
+++ tinybsd	24 Oct 2006 12:34:19 -0000
@@ -422,17 +431,29 @@ create_image() {
 	sleep 1
 	umount ${IMGMNT}
 
-	dd if=/dev/${MD} of=${CURRENTDIR}/${IMG} bs=64k
+	case ${IMG} in
+	/*) dd if=/dev/${MD} of=${IMG} bs=64k ;;
+	*) dd if=/dev/${MD} of=${CURRENTDIR}/${IMG} bs=64k ;;
+	esac
+	DD_RET=$?
 
-	rm -vf ${VNODEFILE}
 	rm -rvf ${IMGMNT}
 	mdconfig -d -u ${MD}
-	echo ""
-	echo "${TS} Done!"
-	echo "${TS} Your configuration options were saved in ${FULLFILENAME}"
-	echo "${TS} You can see your build log in ${HOME}/tinybsd.log"
-	echo "${TS} Your final image is in ${CURRENTDIR}/${IMG}"
-	echo "${TS} Now use dd(1) to write it."
+
+	if [ $DD_RET -eq 0 ]; then
+		rm -vf ${VNODEFILE}
+		echo ""
+		echo "${TS} Done!"
+		echo "${TS} Your configuration options were saved in ${FULLFILENAME}"
+		echo "${TS} You can see your build log in ${HOME}/tinybsd.log"
+		echo "${TS} Your final image is in ${CURRENTDIR}/${IMG}"
+		echo "${TS} Now use dd(1) to write it."
+	else
+		echo "" >&2
+		echo "${TS} Failed to create ${CURRENTDIR}/${IMG}!" >&2
+		echo "${TS} You can see your build log in ${HOME}/tinybsd.log" >&2
+		echo "${TS} The temporary image is still in ${VNODEFILE}" >&2
+	fi
 
 }
 

--0ntfKIWw70PvrIHh--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061024123931.GF20405>