summaryrefslogtreecommitdiffstats
path: root/build_tools/clarch/larch/run/usbboot
diff options
context:
space:
mode:
authorJames Meyer <James.meyer@operamail.com>2008-10-02 03:23:45 (GMT)
committerJames Meyer <James.meyer@operamail.com>2008-10-02 03:23:45 (GMT)
commit618d4ad515a93d1e48934be5846edd71270171ec (patch)
treea22a9294af81215d4a7b1053e5fdb4d746f39d41 /build_tools/clarch/larch/run/usbboot
downloadlinhes_dev-618d4ad515a93d1e48934be5846edd71270171ec.zip
initital import
Diffstat (limited to 'build_tools/clarch/larch/run/usbboot')
-rwxr-xr-xbuild_tools/clarch/larch/run/usbboot100
1 files changed, 100 insertions, 0 deletions
diff --git a/build_tools/clarch/larch/run/usbboot b/build_tools/clarch/larch/run/usbboot
new file mode 100755
index 0000000..dd7f3fe
--- /dev/null
+++ b/build_tools/clarch/larch/run/usbboot
@@ -0,0 +1,100 @@
+#! /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
+
+STARTDIR=${2}
+
+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 files"
+stick=/tmp/usbstick
+if [ -d ${stick} ]
+then
+ echo "removing $stick"
+ 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*
+
+#copy in the important stuff
+cp -a ${AINSTALL}/usr/lib/syslinux/* ${stick}/syslinux
+cp -a ${AINSTALL}/usr/bin/syslinux ${stick}/syslinux/syslinux
+cp -a ${STARTDIR}/bootusb/* ${stick}/syslinux
+
+echo "copy ${stick}/* to a usb drive and run syslinux/bootinst.sh"
+
+
+