aboutsummaryrefslogtreecommitdiff
path: root/projects/libreboot-release/install
diff options
context:
space:
mode:
Diffstat (limited to 'projects/libreboot-release/install')
-rw-r--r--projects/libreboot-release/install/libreboot-release82
1 files changed, 41 insertions, 41 deletions
diff --git a/projects/libreboot-release/install/libreboot-release b/projects/libreboot-release/install/libreboot-release
index b916adac..08c4d64b 100644
--- a/projects/libreboot-release/install/libreboot-release
+++ b/projects/libreboot-release/install/libreboot-release
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
@@ -22,23 +22,23 @@ SYSTEMS="systems"
IMAGES="images"
TOOLS="tools"
-TAR_XZ="tar.xz"
-SHA256SUM="sha256sum"
+ARCHIVE="tar.xz"
+CHECKSUM="sha256sum"
ASC="asc"
usage() {
- printf "$executable [action] [projects...]\n" >&2
-
- printf "\nActions:\n" >&2
- printf " download - Download project files\n" >&2
- printf " sources - Download project sources\n" >&2
- printf " verify - Verify project files\n" >&2
- printf " extract - Extract project files\n" >&2
- printf " prepare - Download, verify and extract project files\n" >&2
-
- printf "\nEnvironment variables:\n" >&2
- printf " MACHINE - Machine architecture to use\n" >&2
- printf " DOWNLOAD_URL - Base URL to download files from\n" >&2
+ printf '%s\n' "$executable [action] [projects...]" >&2
+
+ printf '\n%s\n' 'Actions:' >&2
+ printf '%s\n' ' download - Download project files' >&2
+ printf '%s\n' ' sources - Download project sources' >&2
+ printf '%s\n' ' verify - Verify project files' >&2
+ printf '%s\n' ' extract - Extract project files' >&2
+ printf '%s\n' ' prepare - Download, verify and extract project files' >&2
+
+ printf '\n%s\n' 'Environment variables:' >&2
+ printf '%s\n' ' MACHINE - Machine architecture to use' >&2
+ printf '%s\n' ' DOWNLOAD_URL - Base URL to download files from' >&2
}
download() {
@@ -66,17 +66,17 @@ download() {
directory="$directory-$part"
fi
- path="$root/$prefix/$directory/$project.$TAR_XZ"
- url="$DOWNLOAD_URL/$prefix/$directory/$project.$TAR_XZ"
+ path="$root/$prefix/$directory/$project.$ARCHIVE"
+ url="$DOWNLOAD_URL/$prefix/$directory/$project.$ARCHIVE"
if wget --quiet --spider "$url"
then
mkdir -p "$( dirname "$path" )"
wget -O "$path" "$url"
- wget -O "$path.$SHA256SUM" "$url.$SHA256SUM"
- wget -O "$path.$ASC" "$url.$ASC"
+ wget -O "$path.$CHECKSUM" "$url.$CHECKSUM"
+ wget -O "$path.$DSIG" "$url.$DSIG"
- printf "\nDownloaded $project\n"
+ printf '\n%s\n' "Downloaded $project"
return 0
fi
@@ -85,26 +85,26 @@ download() {
IFS=$ifs_save
done
- printf "Could not download $project from $DOWNLOAD_URL\n" >&2
+ printf '%s\n' "Could not download $project from $DOWNLOAD_URL" >&2
return 1
}
sources() {
local project=$1
- local url="$DOWNLOAD_URL/$SOURCES/$project/$project.$TAR_XZ"
- local path="$root/$SOURCES/$project/$project.$TAR_XZ"
+ local url="$DOWNLOAD_URL/$SOURCES/$project/$project.$ARCHIVE"
+ local path="$root/$SOURCES/$project/$project.$ARCHIVE"
if wget --quiet --spider "$url"
then
mkdir -p "$( dirname "$path" )"
wget -O "$path" "$url"
- wget -O "$path.$SHA256SUM" "$url.$SHA256SUM"
- wget -O "$path.$ASC" "$url.$ASC"
+ wget -O "$path.$CHECKSUM" "$url.$CHECKSUM"
+ wget -O "$path.$DSIG" "$url.$DSIG"
- printf "\nDownloaded $project sources\n"
+ printf '\n%s\n' "Downloaded $project sources"
else
- printf "Could not download $project sources from $DOWNLOAD_URL\n" >&2
+ printf '%s\n' "Could not download $project sources from $DOWNLOAD_URL" >&2
return 1
fi
@@ -136,34 +136,34 @@ verify() {
directory="$directory-$part"
fi
- path="$root/$prefix/$directory/$project.$TAR_XZ"
+ path="$root/$prefix/$directory/$project.$ARCHIVE"
if ! [ -f "$path" ]
then
continue
fi
- checksum_path="$path.$SHA256SUM"
- signature_path="$path.$ASC"
+ checksum_path="$path.$CHECKSUM"
+ signature_path="$path.$DSIG"
if [ -f "$checksum_path" ]
then
(
cd "$( dirname "$path" )"
- sha256sum -c "$project.$TAR_XZ.$SHA256SUM"
+ sha256sum -c "$project.$ARCHIVE.$CHECKSUM"
)
else
- printf "Could not verify $project checksum!\n" >&2
+ printf '%s\n' "Could not verify $project checksum!" >&2
fi
if [ -f "$signature_path" ]
then
gpg --armor --verify "$signature_path" "$path"
else
- printf "Could not verify $project signature!\n" >&2
+ printf '%s\n' "Could not verify $project signature!" >&2
fi
- printf "\nVerified $project\n"
+ printf '\n%s\n' "Verified $project"
return 0
done
@@ -171,7 +171,7 @@ verify() {
IFS=$ifs_save
done
- printf "Could not verify $project\n" >&2
+ printf '%s\n' "Could not verify $project" >&2
return 1
}
@@ -200,7 +200,7 @@ extract() {
directory="$directory-$part"
fi
- path="$root/$prefix/$directory/$project.$TAR_XZ"
+ path="$root/$prefix/$directory/$project.$ARCHIVE"
if ! [ -f "$path" ]
then
@@ -209,7 +209,7 @@ extract() {
if [ "$prefix" = "$SYSTEMS/$MACHINE" ]
then
- printf "Skiping $project extract\n"
+ printf '%s\n' "Skiping $project extract"
return 0
fi
@@ -217,7 +217,7 @@ extract() {
tar -xf "$path" -ps -C "$extract_path"
- printf "Extracted $project\n"
+ printf '%s\n' "Extracted $project"
return 0
done
@@ -225,7 +225,7 @@ extract() {
IFS=$ifs_save
done
- printf "Could not extract $project\n" >&2
+ printf '%s\n' "Could not extract $project" >&2
return 1
}
@@ -239,7 +239,7 @@ requirements() {
if [ -z "$requirement_path" ]
then
- printf "Missing requirement: $requirement\n" >&2
+ printf '%s\n' "Missing requirement: $requirement" >&2
exit 1
fi
done
@@ -256,7 +256,7 @@ setup() {
if [ -z "$DOWNLOAD_URL" ]
then
- printf "Missing download URL\n" >&2
+ printf '%s\n' 'Missing download URL' >&2
exit 1
fi
}