Re: Handling non-standard directories in tinybsd
Jeremie Le Hen <[email protected]> Tue, 24 Oct 2006 14:39:31 +0200
| Newsgroups | gmane.os.freebsd.devel.small,gmane.os.freebsd.current |
|---|---|
| Message-ID | <[email protected]> |
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 > _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-small To unsubscribe, send any mail to "[email protected]"
tinybsd_absolutepath.patch
(text/plain, 1.4 KB)
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
}