[Trisquel-devel] Rev 8: Added live-usb-loader.sh script in file:///home/systems/makeiso/
Ruben Rodriguez
ruben at trisquel.info
Sat Jun 9 17:14:13 CEST 2012
At file:///home/systems/makeiso/
------------------------------------------------------------
revno: 8
revision-id: ruben en trisquel.info-20120609151323-6d5df8uams610960
parent: ruben en trisquel.info-20120609151215-3snpde5gxmdom55w
committer: Ruben Rodriguez <ruben en trisquel.info>
branch nick: makeiso
timestamp: Sat 2012-06-09 17:13:23 +0200
message:
Added live-usb-loader.sh script
------------ pr�xima parte ------------
=== added file 'live-usb-loader.sh'
--- a/live-usb-loader.sh 1970-01-01 00:00:00 +0000
+++ b/live-usb-loader.sh 2012-06-09 15:13:23 +0000
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Copyright (C) 2012 Ruben Rodriguez <ruben en trisquel.info>
+#
+# This program 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+usage(){
+echo You need to run this script as root
+echo Usage: sudo $0 distro.iso /dev/sdX
+echo Example: sudo $0 foobar_5.0_i386.iso /dev/sdb
+echo
+echo WARNING!: this script will delete all data on the whole disk you pass as the second parameter. Make sure it is your USB drive and not your internal hard drive!
+echo ANOTHER WARNING!: This script can bite your dog. Use it with care, backup your data.
+exit 1
+}
+
+[ $(id -u) != 0 ] && usage
+[ $# != 2 ] && usage
+
+ISO=$1
+DEV=$2
+PERSISTENCESIZE=500 # Sice of the persistence file, in MB
+
+ISOTMP=$(mktemp -d)
+DEVTMP=$(mktemp -d)
+
+
+umount $DEV*
+mount -o loop $ISO $ISOTMP
+mkfs.vfat -I -F16 $DEV
+sync
+mount -o sync $DEV $DEVTMP
+cp -vr $ISOTMP/* $DEVTMP
+sync
+
+dd if=/dev/zero of=$DEVTMP/casper-rw bs=1M count=$PERSISTENCESIZE
+mkfs.ext2 -F $DEVTMP/casper-rw
+sync
+
+mv $DEVTMP/isolinux $DEVTMP/syslinux
+mv $DEVTMP/syslinux/isolinux.cfg $DEVTMP/syslinux/syslinux.cfg
+
+sync
+umount $DEVTMP
+syslinux $DEV
+sync
+
+eject $DEV
+
+# Did we sync already?
+sync
More information about the Trisquel-devel
mailing list