savannah-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-cvs] [791] fix small bash script license and minor improvement


From: iank
Subject: [Savannah-cvs] [791] fix small bash script license and minor improvements
Date: Thu, 6 Jun 2024 13:32:59 -0400 (EDT)

Revision: 791
          
http://svn.savannah.gnu.org/viewvc/?view=rev&root=administration&revision=791
Author:   iank
Date:     2024-06-06 13:32:58 -0400 (Thu, 06 Jun 2024)
Log Message:
-----------
fix small bash script license and minor improvements

Modified Paths:
--------------
    trunk/sviki/fsf/hardware/live-usb-loader.sh

Modified: trunk/sviki/fsf/hardware/live-usb-loader.sh
===================================================================
--- trunk/sviki/fsf/hardware/live-usb-loader.sh 2024-06-06 17:32:52 UTC (rev 
790)
+++ trunk/sviki/fsf/hardware/live-usb-loader.sh 2024-06-06 17:32:58 UTC (rev 
791)
@@ -1,84 +1,51 @@
-The following is the GNU All-permissive License as recommended in
-<https://www.gnu.org/licenses/license-recommendations.en.html>
+#!/bin/bash
 
-Copyright (C) 2024 Free Software Foundation <sysadmin@fsf.org>
+# The following is the GNU All-permissive License as recommended in
+# <https://www.gnu.org/licenses/license-recommendations.en.html>
 
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.  This file is offered as-is,
-without any warranty.
+# Copyright (C) 2024 Free Software Foundation <sysadmin@fsf.org>
 
-Contributions are welcome. See <https://savannah.gnu.org/maintenance/fsf/>.
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 
-#!/bin/bash
+# Contributions are welcome. See <https://savannah.gnu.org/maintenance/fsf/>.
 #
-#    Copyright (C) 2012-2019  Ruben Rodriguez <ruben@trisquel.info>
-#    Copyright (C) 2019       Andrew Engelbrecht <andrew@fsf.org>
-#
-#    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
-#
+# Originally created by Ruben Rodriguez and modified by Andrew Engelbrecht.
 
-set -x
+set -xe
 
-usage(){
+if [[ $EUID != 0 || $# != 2 ]]; then
+  cat <<EOF
+Creates a live USB which will boot on kgpe-d16 with seabios
+Example usage: sudo $0 foobar_5.0_i386.iso /dev/sdb
+WARNING: This script is not thoroughly tested, and will erase the USB drive.
+EOF
+fi
+read -r ISO DEV <<<"$@"
 
-  echo This fixes a live usb ISO so it will boot on a kgpe-d16 with seabios
+mkdir /tmp/{iso,dev}tmp
 
-    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
-
-ISOTMP=$(mktemp -d)
-DEVTMP=$(mktemp -d)
-
-umount $DEV*
-mount -o loop $ISO $ISOTMP
+umount $DEV* ||:
+mount -o loop $ISO /tmp/isotmp
 mkfs.vfat -I -F32 $DEV -n FSF-BOOT
+mount $DEV /tmp/devtmp
+cp -r /tmp/isotmp/* /tmp/isotmp/.disk /tmp/devtmp
+umount /tmp/isotmp
 sync
-#mount -o sync $DEV $DEVTMP
-mount $DEV $DEVTMP
-cp -vr $ISOTMP/* $ISOTMP/.disk $DEVTMP
-umount $ISOTMP
-sync
 
-cp -r $DEVTMP/isolinux $DEVTMP/syslinux
-mv $DEVTMP/syslinux/isolinux.cfg $DEVTMP/syslinux/syslinux.cfg
+cp -r /tmp/devtmp/isolinux /tmp/devtmp/syslinux
+mv /tmp/devtmp/syslinux/isolinux.cfg /tmp/devtmp/syslinux/syslinux.cfg
 # Disable gfxboot, breaks on SeaBios in some cases
-sed '/gfxboot/d' -i $DEVTMP/syslinux/syslinux.cfg
+sed '/gfxboot/d' -i /tmp/devtmp/syslinux/syslinux.cfg
 
-sync
-umount $DEVTMP
+umount /tmp/devtmp
 syslinux $DEV
 sync
 
 eject $DEV
 
-# Did we sync already?
-sync
-
-echo "re-plug drive"
-echo "check that syslinux install worked properly above, otherwise try again"
-echo "update 'vga=...' to 'vga=normal nomodeset' in syslinux/txt.cfg"
+cat <<'EOF'
+check that syslinux install worked properly above, otherwise try again and 
update 'vga=...' to 'vga=normal nomodeset' in syslinux/txt.cfg
+EOF




reply via email to

[Prev in Thread] Current Thread [Next in Thread]