]> code.delx.au - refind/commitdiff
Small refinements to install.sh script
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 5 May 2012 04:19:24 +0000 (00:19 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 5 May 2012 04:19:24 +0000 (00:19 -0400)
BUILDING.txt
NEWS.txt
install.sh

index 3dcad8d2c6836527adeb9abd88ee8331d81ba69a..a3d2dc816ea6a0ebe80822894d3bf8d620174e66 100644 (file)
@@ -129,3 +129,11 @@ want to copy files on the ESP as follows:
 You'll then need to activate rEFInd in your EFI. This can be done with
 tools such as "efibootmgr" under Linux or "bless" under OS X. See the
 docs/installing.html file for details.
+
+You may have noticed an install.sh script in the source package. This
+script is intended for distribution with my own binary packages of rEFInd,
+and it copies files from the "refind" subdirectory (relative to the
+script's location) -- namely refind_x64.efi or refind_ia32.efi,
+refind.conf-sample, and an icons subdirectory. You can rearrange your files
+to provide this layout, but it's no more work to copy the files as just
+described.
index 204c1cd3ec91e2566bfe1e7d13404f61e8c54713..dd040163b903009ecba54586782d91152c5dae88 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,3 +1,6 @@
+0.3.3 (?/?/2012):
+-----------------
+
 0.3.2 (5/4/2012):
 -----------------
 
index 1037bea7692354b3411d1efcb8bdd8f4f0ee4cdc..479cef7c85b8ee7f988cce448acbe99c15caaa1c 100755 (executable)
@@ -17,7 +17,8 @@
 #
 # Revision history:
 #
-# 0.3.2 -- Initial version
+# 0.3.2.1 -- Check for presence of source files; aborts if not present
+# 0.3.2   -- Initial version
 #
 # Note: install.sh version numbers match those of the rEFInd package
 # with which they first appeared.
@@ -28,6 +29,16 @@ TargetDir=/EFI/refind
 # Functions used by both OS X and Linux....
 #
 
+# Abort if the rEFInd files can't be found.
+CheckForFiles() {
+   if [[ ! -f $SourceDir/refind_ia32.efi || ! -f $SourceDir/refind_x64.efi || ! -f $SourceDir/refind.conf-sample || ! -d $SourceDir/icons ]] ; then
+      echo "One or more files missing! Aborting installation!"
+      exit 1
+   fi
+} # CheckForFiles()
+
+# Copy the rEFInd files to the ESP or OS X root partition.
+# Sets Problems=1 if any critical commands fail.
 CopyRefindFiles() {
    mkdir -p $InstallPart/$TargetDir &> /dev/null
    if [[ $Platform == 'EFI32' ]] ; then
@@ -105,6 +116,8 @@ MountOSXESP() {
    fi
 } # MountOSXESP()
 
+# Control the OS X installation.
+# Sets Problems=1 if problems found during the installation.
 InstallOnOSX() {
    echo "Installing rEFInd on OS X...."
    if [[ $1 == 'esp' || $1 == 'ESP' ]] ; then
@@ -135,6 +148,9 @@ InstallOnOSX() {
 # Now a series of Linux support functions....
 #
 
+# Identifies the ESP's location (/boot or /boot/efi); aborts if
+# the ESP isn't mounted at either location.
+# Sets InstallPart to the ESP mount point.
 FindLinuxESP() {
    EspLine=`df /boot/efi | grep boot`
    InstallPart=`echo $EspLine | cut -d " " -f 6`
@@ -147,6 +163,8 @@ FindLinuxESP() {
    echo "ESP was found at $InstallPart using $EspFilesystem"
 } # MountLinuxESP
 
+# Uses efibootmgr to add an entry for rEFInd to the EFI's NVRAM.
+# If this fails, sets Problems=1
 AddBootEntry() {
    Efibootmgr=`which efibootmgr 2> /dev/null`
    if [[ $Efibootmgr ]] ; then
@@ -182,6 +200,8 @@ AddBootEntry() {
    fi
 } # AddBootEntry()
 
+# Controls rEFInd installation under Linux.
+# Sets Problems=1 if something goes wrong.
 InstallOnLinux() {
    echo "Installing rEFInd on Linux...."
    FindLinuxESP
@@ -213,10 +233,16 @@ InstallOnLinux() {
    AddBootEntry
 } # InstallOnLinux()
 
-# The main part of the script; just checks the OS and calls a
-# function for installing on that platform....
+#
+# The main part of the script. Sets a few environment variables,
+# performs a few startup checks, and then calls functions to
+# install under OS X or Linux, depending on the detected platform.
+#
 
 ThisScript=`readlink -f $0`
+OSName=`uname -s`
+SourceDir=`dirname $ThisScript`/refind
+CheckForFiles
 if [[ `whoami` != "root" ]] ; then
    echo "Not running as root; attempting to elevate privileges via sudo...."
    sudo $ThisScript $1
@@ -227,8 +253,6 @@ if [[ `whoami` != "root" ]] ; then
       exit 0
    fi
 fi
-OSName=`uname -s`
-SourceDir=`dirname $ThisScript`/refind
 if [[ $OSName == 'Darwin' ]] ; then
    InstallOnOSX $1
 elif [[ $OSName == 'Linux' ]] ; then