summaryrefslogtreecommitdiffstats
path: root/build_tools/clarch/larch/run/myusbboot
diff options
context:
space:
mode:
Diffstat (limited to 'build_tools/clarch/larch/run/myusbboot')
-rw-r--r--build_tools/clarch/larch/run/myusbboot89
1 files changed, 89 insertions, 0 deletions
diff --git a/build_tools/clarch/larch/run/myusbboot b/build_tools/clarch/larch/run/myusbboot
new file mode 100644
index 0000000..29f2084
--- /dev/null
+++ b/build_tools/clarch/larch/run/myusbboot
@@ -0,0 +1,89 @@
+#! /bin/bash
+#
+# usbboot
+#
+# Author: Michael Towers <gradgrind[at]online[dot]de>
+#
+# This file is part of the larch project.
+#
+# larch is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# larch is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with larch; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#----------------------------------------------------------------------------
+# 2008.06.22
+
+APP="$( basename $0 )"
+
+usage () {
+ echo
+ echo "Usage:"
+ echo " ${APP} [<Arch installation root directory>]"
+ echo
+ echo " Prepare a bootable USB-stick from a larch build."
+ echo " If no Arch directory is given, '/' is assumed."
+ exit 1
+}
+
+if [ -n "$1" ]; then
+ AINSTALL="$( readlink -f $1 )"
+else
+ AINSTALL=""
+fi
+CDDATA=${AINSTALL}/.larch/cd
+
+if [ ! -f ${CDDATA}/system.sqf ]; then
+ echo "ERROR: ${CDDATA} does not contain larch cd data"
+ usage
+fi
+if [ ! -f ${CDDATA}/isolinux/isolinux.cfg ]; then
+ echo "ERROR: isolinux data not in ${CDDATA}/isolinux"
+ exit 1
+fi
+
+if ! [ -f ${AINSTALL}/usr/bin/syslinux ]; then
+ echo "ERROR: syslinux not found -"
+ echo " it must be installed on live system"
+ return 1
+fi
+
+# test if the script is started by root user. If not, exit
+if [ $UID -ne 0 ]; then
+ echo "Only root can run ${APP}"; exit 1
+fi
+
+
+echo "// Copying the boot sector"
+dd if=${AINSTALL}/usr/lib/syslinux/mbr.bin of=${dev}
+
+echo "// Copying the files"
+stick=/tmp/usbstick
+if [ -f ${stick} ]
+then
+ rm -rf ${stick}
+fi
+ mkdir -p ${stick}
+
+if [ $? != 0 ]; then
+ echo "ERROR: Failed to mount device, quitting"
+ exit 3
+fi
+
+cp -a ${CDDATA}/* ${stick}
+mv ${stick}/isolinux ${stick}/syslinux
+mv ${stick}/syslinux/isolinux.cfg ${stick}/syslinux/syslinux.cfg
+rm -f ${stick}/syslinux/isolinux*
+
+echo "//"
+echo "// Done!"
+echo "// If all went well your usb stick should now be a bootable larch system"