mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 06:06:43 +00:00
release: add shell script to create install stick
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
9e8d82ac59
commit
a470fb910a
106
config/release/create_installstick
Executable file
106
config/release/create_installstick
Executable file
@ -0,0 +1,106 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Copyright (C) 2009-2010 OpenELEC.tv
|
||||||
|
# http://www.openelec.tv
|
||||||
|
#
|
||||||
|
# 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, 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 OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# usage: sudo ./create_installstick <drive>
|
||||||
|
# example: sudo ./create_installstick /dev/sdb
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
clear
|
||||||
|
echo "#########################################################"
|
||||||
|
echo "# please execute with 'sudo' or -DANGEROUS!!!- as root #"
|
||||||
|
echo "# example: sudo ./create_installstick <drive> #"
|
||||||
|
echo "#########################################################"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
clear
|
||||||
|
echo "#########################################################"
|
||||||
|
echo "# please execute with your drive as option #"
|
||||||
|
echo "# example: sudo ./create_installstick /dev/sdb #"
|
||||||
|
echo "#########################################################"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISK="$1"
|
||||||
|
PART="${DISK}1"
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "#########################################################"
|
||||||
|
echo "# #"
|
||||||
|
echo "# OpenELEC.tv USB Installer #"
|
||||||
|
echo "# #"
|
||||||
|
echo "#########################################################"
|
||||||
|
echo "# #"
|
||||||
|
echo "# This will wipe any data off your chosen drive #"
|
||||||
|
echo "# Please read the instructions and use very carefully.. #"
|
||||||
|
echo "# #"
|
||||||
|
echo "#########################################################"
|
||||||
|
|
||||||
|
# remove any partition on your drive
|
||||||
|
echo "writing new disklabel on $DISK (remove any partition)..."
|
||||||
|
parted -s $DISK mklabel msdos
|
||||||
|
|
||||||
|
# create one partition
|
||||||
|
echo "create an partition on $DISK..."
|
||||||
|
parted -s $DISK unit cyl mkpart primary fat32 -- 0 -0
|
||||||
|
|
||||||
|
# make partition active (bootable)
|
||||||
|
echo "make partition active..."
|
||||||
|
parted -s $DISK set 1 boot on
|
||||||
|
|
||||||
|
# tell kernel we have a new partitiontable
|
||||||
|
echo "tell kernel we have a new partitiontable..."
|
||||||
|
partprobe $DISK
|
||||||
|
|
||||||
|
# make filesystem
|
||||||
|
echo "make filesystem on $PART..."
|
||||||
|
mkfs.vfat $PART -n INSTALL
|
||||||
|
|
||||||
|
# install syslinux
|
||||||
|
echo "install syslinux to $PART..."
|
||||||
|
syslinux -f $PART
|
||||||
|
|
||||||
|
# mount partition
|
||||||
|
echo "mounting partition $PART to /tmp/usb_install..."
|
||||||
|
mkdir -p /tmp/usb_install
|
||||||
|
mount $PART /tmp/usb_install
|
||||||
|
|
||||||
|
# copy files
|
||||||
|
echo "copy files to $PART..."
|
||||||
|
cp target/KERNEL /tmp/usb_install
|
||||||
|
cp target/SYSTEM /tmp/usb_install
|
||||||
|
cp sample.conf/syslinux_installer.cfg /tmp/usb_install/syslinux.cfg
|
||||||
|
|
||||||
|
# syncing disk
|
||||||
|
echo "syncing disk..."
|
||||||
|
sync
|
||||||
|
|
||||||
|
# unmount partition
|
||||||
|
echo "unmounting partition $PART..."
|
||||||
|
umount $PART
|
||||||
|
|
||||||
|
# cleaning
|
||||||
|
echo "cleaning tempdir..."
|
||||||
|
rmdir /tmp/usb_install
|
||||||
|
|
||||||
|
echo "...ready"
|
Loading…
x
Reference in New Issue
Block a user