mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
Merge pull request #3878 from stefansaraev/installsticks
remove create_installsrtick* / create_sdcard
This commit is contained in:
@@ -1 +0,0 @@
|
||||
Installation instructions can be found on http://wiki.openelec.tv/index.php?title=Installation
|
||||
@@ -1,239 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC 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.
|
||||
#
|
||||
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# usage: sudo ./create_sdcard <drive>
|
||||
# example: sudo ./create_sdcard /dev/sdb
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# please execute with 'sudo' or -DANGEROUS!!!- as root #"
|
||||
echo "# example: sudo ./create_sdcard <drive> #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# please execute with your drive as option #"
|
||||
echo "# example: sudo ./create_sdcard /dev/sdb #"
|
||||
echo "# or: sudo ./create_sdcard /dev/mmcblk0 #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISK="$1"
|
||||
case $DISK in
|
||||
"/dev/mmcblk"*)
|
||||
PART1="${DISK}p1"
|
||||
PART2="${DISK}p2"
|
||||
;;
|
||||
*)
|
||||
PART1="${DISK}1"
|
||||
PART2="${DISK}2"
|
||||
;;
|
||||
esac
|
||||
|
||||
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 "#########################################################"
|
||||
|
||||
# check for some required tools
|
||||
|
||||
# this is needed to partion the drive
|
||||
which parted > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"parted\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to format the drive
|
||||
which mkfs.vfat > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mkfs.vfat\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to format the drive
|
||||
which mkfs.ext4 > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mkfs.ext4\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to tell the kernel for partition changes
|
||||
which partprobe > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"partprobe\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to tell the kernel for partition changes
|
||||
which md5sum > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"md5sum\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check MD5 sums
|
||||
echo "checking MD5 sum..."
|
||||
|
||||
md5sumFailed()
|
||||
{
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv failed md5 check - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# Your original download was probably corrupt. #"
|
||||
echo "# Please visit www.openelec.tv and get another copy #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
}
|
||||
|
||||
md5sum -c target/KERNEL.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
md5sum -c target/SYSTEM.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
# (TODO) umount everything (if more than one partition)
|
||||
umount ${DISK}*
|
||||
|
||||
# remove all partitions from the drive
|
||||
echo "writing new disklabel on $DISK (removing all partitions)..."
|
||||
parted -s "$DISK" mklabel msdos
|
||||
|
||||
# create a single partition
|
||||
echo "creating partitions on $DISK..."
|
||||
parted -s "$DISK" mkpart primary fat32 -- 0 256MiB
|
||||
# align the partition on 4mb boundary, starting at 260mb (260 % 4 == 0), which
|
||||
# is right after the first partition
|
||||
parted -s "$DISK" mkpart primary ext2 -- 260MiB -2cyl
|
||||
|
||||
# make partition active (bootable)
|
||||
echo "marking partition active..."
|
||||
parted -s "$DISK" set 1 boot on
|
||||
|
||||
# tell kernel we have a new partition table
|
||||
echo "telling kernel we have a new partition table..."
|
||||
partprobe "$DISK"
|
||||
|
||||
# create filesystem
|
||||
echo "creating filesystem on $PART1..."
|
||||
mkfs.vfat "$PART1" -I -n System
|
||||
|
||||
# create ext4 partition with optimized settings for running on flash/sd
|
||||
# See http://blogofterje.wordpress.com/2012/01/14/optimizing-fs-on-sd-card/ for reference.
|
||||
echo "creating filesystem on $PART2..."
|
||||
mkfs.ext4 -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 "$PART2" -L Storage
|
||||
|
||||
# mount partition
|
||||
echo "mounting partition $PART1 ..."
|
||||
rm -rf /tmp/openelec_install
|
||||
mkdir -p /tmp/openelec_install
|
||||
mount -t vfat "$PART1" /tmp/openelec_install
|
||||
MOUNTPOINT=/tmp/openelec_install
|
||||
|
||||
# create bootloader configuration
|
||||
echo "creating bootloader configuration..."
|
||||
|
||||
echo "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 quiet" > $MOUNTPOINT/cmdline.txt
|
||||
|
||||
# copy files
|
||||
echo "copying files to $MOUNTPOINT..."
|
||||
cp target/KERNEL $MOUNTPOINT/kernel.img
|
||||
cp target/SYSTEM $MOUNTPOINT
|
||||
cp -r 3rdparty/bootloader/* $MOUNTPOINT
|
||||
cp openelec.ico $MOUNTPOINT
|
||||
cp README.md $MOUNTPOINT
|
||||
|
||||
# sync disk
|
||||
echo "syncing disk..."
|
||||
sync
|
||||
|
||||
# unmount partition
|
||||
echo "unmounting partition $MOUNTPOINT ..."
|
||||
umount $MOUNTPOINT
|
||||
|
||||
# cleaning
|
||||
echo "cleaning tempdir..."
|
||||
rmdir $MOUNTPOINT
|
||||
|
||||
echo "...installation finished"
|
||||
@@ -1,4 +0,0 @@
|
||||
f 1
|
||||
w
|
||||
q
|
||||
EOF
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
http://www.etree.org/md5com.html
|
||||
Binary file not shown.
@@ -1,109 +0,0 @@
|
||||
To install this tarball you must have:
|
||||
|
||||
- an computer or anything that can run linux, have an tv or monitor attached
|
||||
via vga/dvi/hdmi/displayport
|
||||
- an flash or harddrive attached via usb/sata/ide with at least 128mb free
|
||||
diskspace for kernel and systemimage on your bootdrive and many many diskspace
|
||||
for your data (movies, pictures, music...)
|
||||
- 2 partitions formatted with ext3, ext4, vfat
|
||||
- an bootmanager (grub, syslinux, extlinux) installed
|
||||
|
||||
Installation:
|
||||
|
||||
- copy target/KERNEL (the kernel, that contains an initramfs) and
|
||||
target/SYSTEM (an squashfs image) to the first partition (bootpartion) which
|
||||
is formatted ext3/ext4/vfat (this can also be an USB-Stick). You can also
|
||||
copy this files to an already running Linux system so you can configure
|
||||
an dualboot system (Files must be copied to root of the bootpartion)
|
||||
- setup the bootloader (example is for grub - other examples you find in
|
||||
sample.conf dir):
|
||||
|
||||
# Begin of example for grub
|
||||
title OpenELEC
|
||||
root (hd0,0)
|
||||
kernel /openelec.kernel boot=/dev/sda1 disk=/dev/sda5 quiet
|
||||
|
||||
title OpenELEC - Textmode
|
||||
root (hd0,0)
|
||||
kernel /openelec.kernel boot=/dev/sda1 disk=/dev/sda5 quiet textmode
|
||||
|
||||
title OpenELEC - Debugging
|
||||
root (hd0,0)
|
||||
kernel /openelec.kernel boot=/dev/sda1 disk=/dev/sda5 debugging
|
||||
|
||||
title OpenELEC - Textmode Debugging
|
||||
root (hd0,0)
|
||||
kernel /openelec.kernel boot=/dev/sda1 disk=/dev/sda5 textmode debugging
|
||||
# End of example
|
||||
|
||||
boot=: points to the partition where is KERNEL AND SYSTEM (bootpartion)
|
||||
disk=: point to any ext3/ext4 partition that mounts r/w for data (your $HOME)
|
||||
|
||||
textmode: starts a shell instead Xorg - you can start Xorg and XBMC manually
|
||||
(for debugging or if you have problems with Xorg)
|
||||
debugging: starts debug mode with more output and more and better logging
|
||||
(for debugging or if you have problems with anything)
|
||||
bootchart: starts bootchart logging at beginning of start process
|
||||
(for debugging or if you have problems with anything)
|
||||
quiet: Kernel boots quiet
|
||||
|
||||
- restart your system and try
|
||||
|
||||
If you have problems:
|
||||
|
||||
- if kernel not load or you have an kernel panik try boot without "quiet"
|
||||
command and see what is wrong.
|
||||
|
||||
- if Xorg does not start try with "textmode" and "debugging", see what is wrong
|
||||
|
||||
- if XBMC does not start try with "textmode" and "debugging", try starting
|
||||
Xorg manually at commad prompt with "Xorg &" then try start XBMC manually with
|
||||
"DISPLAY=:0.0 /usr/bin/xbmc --standalone" and see what is wrong.
|
||||
|
||||
Note:
|
||||
|
||||
- i have tested this only with pure Intel Hardware (Lenovo X61s, X61t, X200
|
||||
Gigabyte MiniITX GA-6QPCV-R, Intel E1000 Network, Core2Duo, Centrino etc...)
|
||||
|
||||
- if your NIC works, then very good with DHCP, WLAN must be configured, but is
|
||||
not tested.
|
||||
|
||||
- You can do a login via SSH (IP adress you can see on console with "ifconfig"
|
||||
or within XBMC). SSH login is "root", password is "openelec".
|
||||
|
||||
- you cannot start this version from optical drives, because the needed
|
||||
drivers are loading as modules with udev. This can be changed later, but for
|
||||
the OpenELEC.tv project this is not allowed.
|
||||
|
||||
- all data that will be created you found in /var or at your $HOME at /storage.
|
||||
|
||||
- your home is /storage (the second ext3/ext4 partiton)
|
||||
|
||||
- for any update create an directory /storage/.update and copy KERNEL and SYSTEM
|
||||
to /storage/.update (from console or via ssh/scp). On next reboot system will
|
||||
be automatically updated and reboot.
|
||||
|
||||
- you have in textmode a console on tty1 AND tty3 (switch via CTRL+ALT+F1/F3 and
|
||||
in graphicmode only on tty3 (tty1 is the console for Xorg)
|
||||
|
||||
- all dirs are readonly (only /storage and /var are r/w)
|
||||
|
||||
- automounting of filesystems works with XBMC, but there are some issues with
|
||||
this (mountpoint will be not deleted, mounting of CD/DVD ROM not working).
|
||||
filesystems will be mounted to /media.
|
||||
i will be switch to devicekit-disk/ consolekit in the future.
|
||||
|
||||
- more or not more informations you can find on www.openelec.tv
|
||||
|
||||
- go to launchpad to see what i am doing or what i have changed
|
||||
|
||||
- comments and questions are welcome, help is better, and patches are perfect!!!
|
||||
|
||||
- the splash i have created with gimp - I have no idea of gimp - but I am
|
||||
proud of the splash :-)))
|
||||
|
||||
- i hope you have understand me, I have no idea of english too ;-)
|
||||
|
||||
happy XBMC'ing
|
||||
|
||||
Stephan
|
||||
@@ -1,266 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# Copyright (C) 2009-2010 OpenELEC.tv
|
||||
# http://www.openelec.tv
|
||||
#
|
||||
# OpenELEC 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.
|
||||
#
|
||||
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# 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"
|
||||
|
||||
### If DISK ends with a number, add "p1" instead of "1" for the first partition
|
||||
case ${DISK#${DISK%?}} in
|
||||
([0-9]) PART="${DISK}p1";;
|
||||
(*) PART="${DISK}1";;
|
||||
esac
|
||||
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC LIVE 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 "#########################################################"
|
||||
|
||||
# check for some required tools
|
||||
|
||||
# this is needed to create a bootloader
|
||||
which syslinux > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"syslinux\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed by syslinux
|
||||
which mcopy > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mcopy\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# NOTE: Some distributions call this package #"
|
||||
echo "# \"mtools\". #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to partion the drive
|
||||
which parted > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"parted\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to format the drive
|
||||
which mkfs.vfat > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mkfs.vfat\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check MD5 sums
|
||||
echo "checking MD5 sum..."
|
||||
|
||||
md5sumFailed()
|
||||
{
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC failed md5 check - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# Your original download was probably corrupt. #"
|
||||
echo "# Please visit www.openelec.tv and get another copy #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
}
|
||||
|
||||
md5sum -c target/KERNEL.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
md5sum -c target/SYSTEM.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
# nautilus/dolphin do late-mounting sometimes
|
||||
# so race could happen (thanks Klojum)
|
||||
echo "please wait..."
|
||||
sleep 10
|
||||
|
||||
# quick and dirty: assume no more than 10 partitions. should be enough
|
||||
for i in `seq 1 10` ; do
|
||||
umount "${DISK}$i" 2>/dev/null
|
||||
umount "${DISK}p$i" 2>/dev/null
|
||||
done
|
||||
|
||||
# create a temp dir
|
||||
OE_TMP=$(mktemp -d)
|
||||
|
||||
# remove all partitions from the drive
|
||||
echo "writing new disklabel on $DISK (removing all partitions)..."
|
||||
dd if=/dev/zero of="$DISK" bs=4096 count=1024
|
||||
parted -s "$DISK" mklabel msdos
|
||||
|
||||
# create a single partition
|
||||
echo "creating a partition on $DISK..."
|
||||
parted -s "$DISK" unit cyl mkpart primary fat32 -- 0 -0
|
||||
|
||||
# make partition active (bootable)
|
||||
echo "marking partition active..."
|
||||
parted -s "$DISK" set 1 boot on
|
||||
|
||||
# tell kernel we have a new partition table
|
||||
echo "telling kernel we have a new partition table..."
|
||||
partprobe "$DISK"
|
||||
|
||||
# create filesystem
|
||||
echo "creating filesystem on $PART..."
|
||||
mkfs.vfat "$PART" -n OpenELEC
|
||||
|
||||
# install syslinux
|
||||
echo "installing syslinux to $PART..."
|
||||
syslinux -f "$PART"
|
||||
|
||||
# mount partition
|
||||
echo "mounting partition $PART on $OE_TMP..."
|
||||
mkdir -p $OE_TMP
|
||||
mount "$PART" $OE_TMP
|
||||
|
||||
# find UUID
|
||||
echo -n "finding partition UUID for $PART ..."
|
||||
UUID=`blkid $PART -s UUID -o value`
|
||||
echo "$UUID"
|
||||
|
||||
# create bootloader configuration
|
||||
echo "creating bootloader configuration..."
|
||||
|
||||
cat >$OE_TMP/syslinux.cfg << EOF
|
||||
PROMPT 0
|
||||
DEFAULT installer
|
||||
|
||||
LABEL installer
|
||||
KERNEL /KERNEL
|
||||
APPEND boot=UUID=$UUID installer quiet tty
|
||||
|
||||
EOF
|
||||
|
||||
# copy files
|
||||
echo "copying files to $PART..."
|
||||
cp target/KERNEL $OE_TMP
|
||||
cp target/KERNEL.md5 $OE_TMP
|
||||
cp target/SYSTEM $OE_TMP
|
||||
cp target/SYSTEM.md5 $OE_TMP
|
||||
# cp Autorun.inf $OE_TMP
|
||||
cp openelec.ico $OE_TMP
|
||||
cp CHANGELOG $OE_TMP
|
||||
cp INSTALL $OE_TMP
|
||||
cp README.md $OE_TMP
|
||||
cp RELEASE $OE_TMP
|
||||
|
||||
# sync disk
|
||||
echo "syncing disk..."
|
||||
sync
|
||||
|
||||
# unmount partition
|
||||
echo "unmounting partition $PART..."
|
||||
umount "$PART"
|
||||
|
||||
# write mbr
|
||||
echo "writing mbr..."
|
||||
if [ -f /usr/lib/syslinux/mbr.bin ]; then
|
||||
MBR="/usr/lib/syslinux/mbr.bin" # example: debian, ubuntu
|
||||
elif [ -f /usr/share/syslinux/mbr.bin ]; then
|
||||
MBR="/usr/share/syslinux/mbr.bin" # example: fedora
|
||||
elif [ -f /usr/lib/syslinux/bios/mbr.bin ]; then
|
||||
MBR="/usr/lib/syslinux/bios/mbr.bin" # example: arch
|
||||
elif [ -f /usr/lib/syslinux/mbr/mbr.bin ]; then
|
||||
MBR="/usr/lib/syslinux/mbr/mbr.bin" # example: Debian Jessie
|
||||
else
|
||||
echo "ERROR: Can't find syslinux's mbr.bin on Host OS" >&2
|
||||
fi
|
||||
|
||||
if [ -n "$MBR" ]; then
|
||||
cat "$MBR" > "$DISK"
|
||||
fi
|
||||
|
||||
# syncing disk
|
||||
echo "syncing disk..."
|
||||
sync
|
||||
|
||||
# cleaning
|
||||
echo "cleaning tempdir..."
|
||||
rmdir $OE_TMP
|
||||
|
||||
echo "...installation finished"
|
||||
@@ -1,170 +0,0 @@
|
||||
@ECHO OFF
|
||||
TITLE OpenELEC LIVE USB Installer
|
||||
mode con:cols=67 lines=17
|
||||
COLOR 17
|
||||
SET DRIVE=
|
||||
|
||||
:checkPrivileges
|
||||
mkdir "%windir%\OEAdminCheck"
|
||||
if '%errorlevel%' == '0' (
|
||||
rmdir "%windir%\OEAdminCheck" & goto gotPrivileges
|
||||
) else ( goto getPrivileges )
|
||||
|
||||
:getPrivileges
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO Administrator Rights are required for USB Stick creation
|
||||
ECHO Invoking UAC for Privilege Escalation
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
|
||||
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
|
||||
ECHO UAC.ShellExecute %0, "", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
|
||||
"%temp%\OEgetPrivileges.vbs"
|
||||
exit /B
|
||||
|
||||
:gotPrivileges
|
||||
if exist "%temp%\OEgetPrivileges.vbs" ( del "%temp%\OEgetPrivileges.vbs" )
|
||||
pushd "%~dp0"
|
||||
|
||||
:HashCheck
|
||||
".\3rdparty\md5sum\md5sum.exe" -c ".\target\SYSTEM.md5"
|
||||
IF ERRORLEVEL 1 GOTO BadMD5
|
||||
".\3rdparty\md5sum\md5sum.exe" -c ".\target\KERNEL.md5"
|
||||
IF ERRORLEVEL 1 GOTO BadMD5
|
||||
|
||||
:InstallOE
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO This WILL wipe ALL data off the selected drive
|
||||
ECHO Please use carefully...
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
|
||||
:SelectDrive
|
||||
ECHO Enter USB Drive letter
|
||||
ECHO eg. d:
|
||||
ECHO.
|
||||
|
||||
SET /P DRIVE= --
|
||||
IF NOT DEFINED DRIVE goto InvalidDrive
|
||||
if %DRIVE%==c: goto InvalidDrive
|
||||
if %DRIVE%==C: goto InvalidDrive
|
||||
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO Installing OpenELEC to %DRIVE%
|
||||
ECHO Please wait approximately 20 seconds...
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
|
||||
ECHO. | >NUL format %DRIVE% /V:OPENELEC /Q /FS:FAT32 /X
|
||||
IF ERRORLEVEL 1 goto InvalidDrive
|
||||
>NUL 3rdparty\syslinux\win32\syslinux.exe -f -m -a %DRIVE%
|
||||
>NUL copy target\* %DRIVE%
|
||||
>NUL copy CHANGELOG %DRIVE%
|
||||
>NUL copy INSTALL %DRIVE%
|
||||
>NUL copy README.md %DRIVE%
|
||||
>NUL copy RELEASE %DRIVE%
|
||||
>NUL copy openelec.ico %DRIVE%
|
||||
|
||||
FOR /F "tokens=5" %%G IN ('vol %DRIVE% ^|find "-"') DO SET DRIVEUUID=%%G
|
||||
ECHO PROMPT 0 >> %DRIVE%\syslinux.cfg
|
||||
ECHO DEFAULT installer >> %DRIVE%\syslinux.cfg
|
||||
ECHO. >> %DRIVE%\syslinux.cfg
|
||||
ECHO LABEL installer >> %DRIVE%\syslinux.cfg
|
||||
ECHO KERNEL /KERNEL >> %DRIVE%\syslinux.cfg
|
||||
ECHO APPEND boot=LABEL=OPENELEC installer quiet tty >> %DRIVE%\syslinux.cfg
|
||||
ECHO. >> %DRIVE%\syslinux.cfg
|
||||
GOTO END
|
||||
|
||||
:InvalidDrive
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO Invalid Drive Selected...
|
||||
ECHO Please confirm the drive letter of your USB stick
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
GOTO SelectDrive
|
||||
|
||||
:BadMD5
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO OpenELEC failed md5 check - Installation will now quit
|
||||
ECHO.
|
||||
ECHO Your original download is probably corrupt
|
||||
ECHO Please visit www.openelec.tv and download another copy
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
PAUSE
|
||||
EXIT
|
||||
|
||||
:END
|
||||
CLS
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO OpenELEC LIVE USB Installer
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO The OpenELEC LIVE USB Installer has been successfully copied to %DRIVE%
|
||||
ECHO Please boot your HTPC off this USB stick
|
||||
ECHO.
|
||||
ECHO *****************************************************************
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
ECHO.
|
||||
|
||||
popd
|
||||
SET DRIVE=
|
||||
SET DRIVEUUID=
|
||||
PAUSE
|
||||
Binary file not shown.
@@ -1,227 +0,0 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2011-2013 Christian Hewitt (chewitt@openelec.tv)
|
||||
#
|
||||
# OpenELEC 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.
|
||||
#
|
||||
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
VERBOSE="FALSE" # set to TRUE to put this script in debug mode
|
||||
|
||||
banner(){
|
||||
clear
|
||||
echo ""
|
||||
echo "********************************************************************************"
|
||||
echo "* *"
|
||||
echo "* Welcome to the OpenELEC Mac OS X Livestick Creator! *"
|
||||
echo "* *"
|
||||
echo "********************************************************************************"
|
||||
}
|
||||
|
||||
check_root(){
|
||||
if [ $UID != 0 ];then
|
||||
echo ""
|
||||
echo "FAIL: This script *must* be run as root!"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_runlocation(){
|
||||
SCRIPT=$(pwd)
|
||||
}
|
||||
|
||||
check_localtargetfolder(){
|
||||
if [ ! -f target/SYSTEM -a ! -f target/KERNEL ]; then
|
||||
echo ""
|
||||
echo "FAIL: Could not detect SYSTEM and KERNEL files. This script *must* be run from"
|
||||
echo " the root folder of the OpenELEC image you downloaded!"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_distro(){
|
||||
DISTRO=$(uname -s)
|
||||
if [ $DISTRO != "Darwin" ]; then
|
||||
echo ""
|
||||
echo "FAIL: This script is only for Mac OS X systems, aborting!"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
read_input(){
|
||||
local MESSAGE="${1}"
|
||||
if [ -n "${MESSAGE}" ];then
|
||||
echo -n "${MESSAGE}"
|
||||
fi
|
||||
read INPUT
|
||||
}
|
||||
|
||||
check_target(){
|
||||
echo ""
|
||||
echo "INFO: The following drives are available to create the OpenELEC USB on:"
|
||||
echo ""
|
||||
diskutil list | grep 0: | grep -v disk0 | awk '{print "/dev/"$5 " "$3 $4}'
|
||||
echo ""
|
||||
while [ -z ${INPUT} ];do
|
||||
read_input "INFO: Please enter the target device (e.g. /dev/disk1): "
|
||||
echo ""
|
||||
done
|
||||
TARGET=${INPUT}
|
||||
}
|
||||
|
||||
warning(){
|
||||
local OUTPUT
|
||||
OUTPUT=$(fdisk ${TARGET} 2>/dev/null)
|
||||
if [ -z "${OUTPUT}" ];then
|
||||
echo "FAIL: Installation aborted! Device ${TARGET} is invalid"
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
diskutil list ${TARGET}
|
||||
echo ""
|
||||
fi
|
||||
CONTINUE=""
|
||||
echo -n "WARN: Continuing will erase all data from $TARGET, continue? (Y/n): "
|
||||
read CONTINUE
|
||||
if [ "${CONTINUE}" = "N" -o "${CONTINUE}" = "n" -o "${CONTINUE}" = "" ]; then
|
||||
echo ""
|
||||
echo "FAIL: Installation aborted!"
|
||||
echo ""
|
||||
exit 1
|
||||
elif [ "${CONTINUE}" = "Y" -o "${CONTINUE}" = "y" ]; then
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
logoutput(){
|
||||
if [ "${VERBOSE}" = "TRUE" ]; then
|
||||
exec 3>&1
|
||||
exec 4>&2
|
||||
else
|
||||
exec 3> /dev/null
|
||||
exec 4> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
unmount_target(){
|
||||
for i in $(jot 10 1 10); do
|
||||
MOUNTED=$(mount | grep ${TARGET})
|
||||
if [ -z "${MOUNTED}" ]; then
|
||||
break
|
||||
else
|
||||
diskutil unmountDisk ${TARGET} 1>&3 2>&4
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mount_target(){
|
||||
for i in $(jot 10 1 10); do
|
||||
MOUNTED=$(mount | grep ${TARGET})
|
||||
if [ -z "${MOUNTED}" ]; then
|
||||
diskutil mountDisk ${TARGET} 1>&3 2>&4
|
||||
sleep 1
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
prepare_target(){
|
||||
echo "INFO: Erasing existing partition schemes on ${TARGET}"
|
||||
dd if=/dev/zero of=${TARGET} bs=512 count=100 1>&3 2>&4
|
||||
gpt destroy ${TARGET} 1>&3 2>&4
|
||||
echo "INFO: Creating MBR 'OPENELEC' disk on ${TARGET}"
|
||||
diskutil eraseDisk MS-DOS OPENELEC MBR ${TARGET} 1>&3 2>&4
|
||||
unmount_target
|
||||
chmod 755 3rdparty/macfiles/*
|
||||
cat 3rdparty/macfiles/mbr.bin > ${TARGET}
|
||||
mount_target
|
||||
3rdparty/macfiles/syslinux-mac -f --install ${TARGET}s1 1>&3 2>&4
|
||||
}
|
||||
|
||||
create_partitions(){
|
||||
unmount_target
|
||||
echo "INFO: Creating partitions"
|
||||
fdisk -e ${TARGET} < 3rdparty/macfiles/fdisk.input 1>&3 2>&4
|
||||
}
|
||||
|
||||
check_checksums(){
|
||||
MD5_KERNEL=$(md5 target/KERNEL | awk '{print $4}')
|
||||
MD5_SYSTEM=$(md5 target/SYSTEM | awk '{print $4}')
|
||||
KERNEL_DOT_MD5=$(cat target/KERNEL.md5 | awk '{print $1}')
|
||||
SYSTEM_DOT_MD5=$(cat target/SYSTEM.md5 | awk '{print $1}')
|
||||
if [ "${MD5_KERNEL}" = "${KERNEL_DOT_MD5}" -a "${MD5_SYSTEM}" = "${SYSTEM_DOT_MD5}" ]; then
|
||||
echo "INFO: MD5 checksums for SYSTEM and KERNEL match"
|
||||
else
|
||||
echo "FAIL: MD5 checksums for SYSTEM and KERNEL do not match!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
copy_files(){
|
||||
mount_target
|
||||
echo "INFO: Copying SYSTEM and KERNEL files to 'OPENELEC'"
|
||||
cp -a target/KERNEL /Volumes/OPENELEC/
|
||||
cp -a target/SYSTEM /Volumes/OPENELEC/
|
||||
echo "INFO: Creating syslinux.cfg on 'OPENELEC'"
|
||||
cat >/Volumes/OPENELEC/syslinux.cfg << EOF
|
||||
PROMPT 0
|
||||
DEFAULT installer
|
||||
|
||||
LABEL installer
|
||||
MENU LABEL Run OpenELEC Installer
|
||||
KERNEL /KERNEL
|
||||
APPEND boot=LABEL=OPENELEC installer quiet tty vga=current
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
check_filesystem(){
|
||||
unmount_target
|
||||
echo "INFO: Checking filesystem on ${TARGET}"
|
||||
fsck_msdos -y ${TARGET}s1 1>&3 2>&4
|
||||
unmount_target
|
||||
}
|
||||
|
||||
end(){
|
||||
echo ""
|
||||
echo "INFO: Livestick USB creation is complete!"
|
||||
echo ""
|
||||
}
|
||||
|
||||
main(){
|
||||
check_root
|
||||
check_runlocation
|
||||
check_localtargetfolder
|
||||
check_distro
|
||||
check_target
|
||||
warning
|
||||
logoutput
|
||||
unmount_target
|
||||
prepare_target
|
||||
create_partitions
|
||||
check_checksums
|
||||
copy_files
|
||||
check_filesystem
|
||||
}
|
||||
|
||||
banner
|
||||
main
|
||||
end
|
||||
exit 0
|
||||
@@ -1,6 +0,0 @@
|
||||
DEFAULT linux
|
||||
PROMPT 0
|
||||
|
||||
LABEL linux
|
||||
KERNEL /KERNEL
|
||||
APPEND boot=LABEL=BOOT disk=LABEL=STORAGE quiet
|
||||
@@ -1,7 +0,0 @@
|
||||
default=0
|
||||
timeout=0
|
||||
hiddenmenu
|
||||
|
||||
title OpenELEC.tv
|
||||
root (hd0,0)
|
||||
kernel /KERNEL boot=LABEL=BOOT disk=LABEL=STORAGE quiet
|
||||
@@ -1,6 +0,0 @@
|
||||
DEFAULT linux
|
||||
PROMPT 0
|
||||
|
||||
LABEL linux
|
||||
KERNEL /KERNEL
|
||||
APPEND boot=LABEL=BOOT disk=LABEL=STORAGE quiet
|
||||
@@ -1,6 +0,0 @@
|
||||
DEFAULT linux
|
||||
PROMPT 0
|
||||
|
||||
LABEL linux
|
||||
KERNEL /KERNEL
|
||||
APPEND boot=LABEL=INSTALL installer quiet
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC 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.
|
||||
#
|
||||
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/syslinux
|
||||
cp -PR $BUILD/syslinux-*/NEWS $RELEASE_DIR/3rdparty/syslinux
|
||||
cp -PR $BUILD/syslinux-*/README $RELEASE_DIR/3rdparty/syslinux
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/syslinux/doc
|
||||
cp -PR $BUILD/syslinux-*/doc/* $RELEASE_DIR/3rdparty/syslinux/doc
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/syslinux/win32
|
||||
cp -PR $BUILD/syslinux-*/bios/win32/syslinux.exe $RELEASE_DIR/3rdparty/syslinux/win32
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/syslinux/win64
|
||||
cp -PR $BUILD/syslinux-*/bios/win64/syslinux64.exe $RELEASE_DIR/3rdparty/syslinux/win64
|
||||
@@ -1,271 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC 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.
|
||||
#
|
||||
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# usage: sudo ./create_sdcard <drive>
|
||||
# example: sudo ./create_sdcard /dev/sdb
|
||||
# loop example: sudo ./create_sdcard /dev/loop0 ~/vSD.img
|
||||
|
||||
# create an empty image file for use with loop device like this:
|
||||
# dd if=/dev/zero of=~/vSD.img bs=1M count=910
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# please execute with 'sudo' or -DANGEROUS!!!- as root #"
|
||||
echo "# example: sudo ./create_sdcard <drive> #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# please execute with your drive as option #"
|
||||
echo "# example: sudo ./create_sdcard /dev/sdb #"
|
||||
echo "# or: sudo ./create_sdcard /dev/mmcblk0 #"
|
||||
echo "# or: sudo ./create_sdcard /dev/loop0 ~/vSD.img #"
|
||||
echo "# to create an image file for /dev/loop0 option: #"
|
||||
echo "# sudo dd if=/dev/zero of=~/vSD.img bs=1M count=910 #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISK="$1"
|
||||
case $DISK in
|
||||
"/dev/mmcblk"*)
|
||||
PART1="${DISK}p1"
|
||||
PART2="${DISK}p2"
|
||||
;;
|
||||
"/dev/loop"*)
|
||||
PART1="${DISK}p1"
|
||||
PART2="${DISK}p2"
|
||||
IMGFILE="$2"
|
||||
losetup $DISK $IMGFILE
|
||||
;;
|
||||
*)
|
||||
PART1="${DISK}1"
|
||||
PART2="${DISK}2"
|
||||
;;
|
||||
esac
|
||||
|
||||
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 "#########################################################"
|
||||
|
||||
# check for some required tools
|
||||
|
||||
# this is needed to partion the drive
|
||||
which parted > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"parted\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to format the drive
|
||||
which mkfs.vfat > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mkfs.vfat\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to format the drive
|
||||
which mkfs.ext4 > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"mkfs.ext4\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to tell the kernel for partition changes
|
||||
which partprobe > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"partprobe\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this is needed to tell the kernel for partition changes
|
||||
which md5sum > /dev/null
|
||||
if [ "$?" = "1" ]; then
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv missing tool - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# We can't find the required tool \"md5sum\" #"
|
||||
echo "# on your system. #"
|
||||
echo "# Please install it via your package manager. #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check MD5 sums
|
||||
echo "checking MD5 sum..."
|
||||
|
||||
md5sumFailed()
|
||||
{
|
||||
clear
|
||||
echo "#########################################################"
|
||||
echo "# #"
|
||||
echo "# OpenELEC.tv failed md5 check - Installation will quit #"
|
||||
echo "# #"
|
||||
echo "# Your original download was probably corrupt. #"
|
||||
echo "# Please visit www.openelec.tv and get another copy #"
|
||||
echo "# #"
|
||||
echo "#########################################################"
|
||||
exit 1
|
||||
}
|
||||
|
||||
md5sum -c target/KERNEL.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
md5sum -c target/SYSTEM.md5
|
||||
if [ "$?" = "1" ]; then
|
||||
md5sumFailed
|
||||
fi
|
||||
|
||||
# (TODO) umount everything (if more than one partition)
|
||||
umount ${DISK}*
|
||||
|
||||
# remove all partitions from the drive
|
||||
echo "writing new disklabel on $DISK (removing all partitions)..."
|
||||
parted -s "$DISK" mklabel msdos
|
||||
|
||||
# create a single partition
|
||||
echo "creating partitions on $DISK..."
|
||||
parted -s "$DISK" unit cyl mkpart primary fat32 -- 0 16
|
||||
# align the partition on 4mb boundary, starting at 132mb (132 % 4 == 0), which
|
||||
# is right after the first partition
|
||||
parted -s "$DISK" mkpart primary ext2 -- 132MiB -2cyl
|
||||
|
||||
# make partition active (bootable)
|
||||
echo "marking partition active..."
|
||||
parted -s "$DISK" set 1 boot on
|
||||
|
||||
# tell kernel we have a new partition table
|
||||
echo "telling kernel we have a new partition table..."
|
||||
partprobe "$DISK"
|
||||
sleep 1
|
||||
|
||||
# create filesystem
|
||||
echo "creating filesystem on $PART1..."
|
||||
mkfs.vfat "$PART1" -I -n System
|
||||
|
||||
# create ext4 partition with optimized settings for running on flash/sd
|
||||
# See http://blogofterje.wordpress.com/2012/01/14/optimizing-fs-on-sd-card/ for reference.
|
||||
echo "creating filesystem on $PART2..."
|
||||
mkfs.ext4 -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 "$PART2" -L Storage
|
||||
|
||||
# remount loopback device
|
||||
if [ "$DISK" = "/dev/loop0" ]; then
|
||||
sync
|
||||
losetup -d $DISK
|
||||
losetup $DISK $IMGFILE -o 1048576 --sizelimit 131071488
|
||||
PART1=$DISK
|
||||
fi
|
||||
|
||||
# mount partition
|
||||
echo "mounting partition $PART1 ..."
|
||||
rm -rf /tmp/openelec_install
|
||||
mkdir -p /tmp/openelec_install
|
||||
mount -t vfat "$PART1" /tmp/openelec_install
|
||||
MOUNTPOINT=/tmp/openelec_install
|
||||
|
||||
# install u-boot image, u-boot.imx if new u-boot. else SPL
|
||||
echo "installing the bootloader..."
|
||||
if [ -e "3rdparty/bootloader/u-boot.imx" ] ;then
|
||||
dd if=3rdparty/bootloader/u-boot.imx of="$DISK" bs=1k seek=1 conv=fsync
|
||||
elif [ -e "3rdparty/bootloader/SPL" ];then
|
||||
dd if=3rdparty/bootloader/SPL of="$DISK" bs=1k seek=1 conv=fsync
|
||||
else
|
||||
echo "ERROR: no bootloader image found!! please execute in archive folder"
|
||||
fi
|
||||
|
||||
# copy files
|
||||
echo "copying files to $MOUNTPOINT..."
|
||||
cp target/KERNEL $MOUNTPOINT
|
||||
cp target/SYSTEM $MOUNTPOINT
|
||||
cp 3rdparty/bootloader/* $MOUNTPOINT
|
||||
cp openelec.ico $MOUNTPOINT
|
||||
cp README.md $MOUNTPOINT
|
||||
|
||||
# sync disk
|
||||
echo "syncing disk..."
|
||||
sync
|
||||
|
||||
# unmount partition
|
||||
echo "unmounting partition $MOUNTPOINT ..."
|
||||
umount $MOUNTPOINT
|
||||
|
||||
# cleaning
|
||||
echo "cleaning tempdir..."
|
||||
rmdir $MOUNTPOINT
|
||||
|
||||
# unmount loopback device
|
||||
if [ "$DISK" = "/dev/loop0" ]; then
|
||||
losetup -d $DISK
|
||||
fi
|
||||
|
||||
echo "...installation finished"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user