mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-20 10:13:01 +01:00
Support new sources format within the lb environment
This commit is contained in:
parent
617b516f1f
commit
9d08d181f0
6 changed files with 34 additions and 29 deletions
|
|
@ -1 +1 @@
|
||||||
80145a20564648b3a84cf9233e0da7f0a8ac4e5853512a1552de2931de09d5c0 /usr/bin/checksum-transcriber
|
64978b2b50c5ba1dfb384d2d76fd7c0ddfcf330d75704881f174a3c81e7cc153 /usr/bin/checksum-transcriber
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
ef770a377283258d72595fff9900dc093d8be9d3a1052ddb3eaca0759c29b140 /usr/bin/checksum-transcriber
|
1c3021d8051fefd615edb50907e3015d810f974b5b9461f8f9aa383478620a0d /usr/bin/checksum-transcriber
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
f161bdb859c2ef76138fa20d2503ae70600b426d770e447cbb55e1a292319252 /usr/bin/checksum-transcriber
|
3b43fcfe665d48c7041292bc78b3de0c5e7fe17fab425837bc5c596856d20bf8 /usr/bin/checksum-transcriber
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define MAX_STRING 4096
|
#define MAX_STRING 4096
|
||||||
#define MAX_TOKENS 3
|
#define MAX_TOKENS 8
|
||||||
|
|
||||||
char *get_distfiles(char **envp) {
|
char *get_distfiles(char **envp) {
|
||||||
char *envvar = "DISTFILES=";
|
char *envvar = "DISTFILES=";
|
||||||
|
|
@ -60,12 +60,15 @@ int main(int argc, char **argv, char **envp) {
|
||||||
}
|
}
|
||||||
line = strchr(line, '\n');
|
line = strchr(line, '\n');
|
||||||
line[0] = '\0';
|
line[0] = '\0';
|
||||||
|
// Only "file" type of distfile supported at this point
|
||||||
|
require(strcmp(tokens[0], "f") == 0 || strcmp(tokens[0], "file") == 0,
|
||||||
|
"Only support file distfile type at this point");
|
||||||
// Get checksum and filename
|
// Get checksum and filename
|
||||||
checksum = tokens[1];
|
checksum = tokens[2];
|
||||||
if (tokens[2] != NULL) {
|
if (tokens[3] != NULL) {
|
||||||
filename = tokens[2];
|
filename = tokens[3];
|
||||||
} else {
|
} else {
|
||||||
filename = strrchr(tokens[0], '/');
|
filename = strrchr(tokens[1], '/');
|
||||||
filename += 1;
|
filename += 1;
|
||||||
}
|
}
|
||||||
// Put it all together
|
// Put it all together
|
||||||
|
|
|
||||||
|
|
@ -273,14 +273,9 @@ randomize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
download_source_line() {
|
download_source_line() {
|
||||||
if [[ "${1}" == git://* ]]; then
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
upstream_url="${1}"
|
upstream_url="${1}"
|
||||||
checksum="${2}"
|
checksum="${2}"
|
||||||
fname="${3}"
|
fname="${3}"
|
||||||
# Default to basename of url if not given
|
|
||||||
fname="${fname:-$(basename "${upstream_url}")}"
|
|
||||||
if ! [ -e "${fname}" ]; then
|
if ! [ -e "${fname}" ]; then
|
||||||
for mirror in $(randomize "${MIRRORS}"); do
|
for mirror in $(randomize "${MIRRORS}"); do
|
||||||
# In qemu SimpleMirror is not running on the guest os, use qemu IP
|
# In qemu SimpleMirror is not running on the guest os, use qemu IP
|
||||||
|
|
@ -298,14 +293,9 @@ download_source_line() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_source_line() {
|
check_source_line() {
|
||||||
if [[ "${1}" == git://* ]]; then
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
url="${1}"
|
url="${1}"
|
||||||
checksum="${2}"
|
checksum="${2}"
|
||||||
fname="${3}"
|
fname="${3}"
|
||||||
# Default to basename of url if not given
|
|
||||||
fname="${fname:-$(basename "${url}")}"
|
|
||||||
if ! [ -e "${fname}" ]; then
|
if ! [ -e "${fname}" ]; then
|
||||||
echo "${fname} does not exist!"
|
echo "${fname} does not exist!"
|
||||||
false
|
false
|
||||||
|
|
@ -315,6 +305,24 @@ check_source_line() {
|
||||||
rm "${fname}.sum"
|
rm "${fname}.sum"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source_line_action() {
|
||||||
|
action="$1"
|
||||||
|
shift
|
||||||
|
type="$1"
|
||||||
|
shift
|
||||||
|
case $type in
|
||||||
|
"g" | "git")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
url="${1}"
|
||||||
|
checksum="${2}"
|
||||||
|
fname="${3}"
|
||||||
|
# Default to basename of url if not given
|
||||||
|
fname="${fname:-$(basename "${url}")}"
|
||||||
|
$action "$url" "$checksum" "$fname"
|
||||||
|
}
|
||||||
|
|
||||||
# Default get function that downloads source tarballs.
|
# Default get function that downloads source tarballs.
|
||||||
default_src_get() {
|
default_src_get() {
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
|
|
@ -323,22 +331,19 @@ default_src_get() {
|
||||||
while read line; do
|
while read line; do
|
||||||
# This is intentional - we want to split out ${line} into separate arguments.
|
# This is intentional - we want to split out ${line} into separate arguments.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
download_source_line ${line}
|
source_line_action download_source_line ${line}
|
||||||
done < "${base_dir}/sources"
|
done < "${base_dir}/sources"
|
||||||
# shellcheck disable=SC2162
|
# shellcheck disable=SC2162
|
||||||
while read line; do
|
while read line; do
|
||||||
# This is intentional - we want to split out ${line} into separate arguments.
|
# This is intentional - we want to split out ${line} into separate arguments.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
check_source_line ${line}
|
source_line_action check_source_line ${line}
|
||||||
done < "${base_dir}/sources"
|
done < "${base_dir}/sources"
|
||||||
cd -
|
cd -
|
||||||
}
|
}
|
||||||
|
|
||||||
# Intelligently extracts a file based upon its filetype.
|
# Intelligently extracts a file based upon its filetype.
|
||||||
extract_file() {
|
extract_file() {
|
||||||
if [[ "${1}" == git://* ]]; then
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
f="${3:-$(basename "${1}")}"
|
f="${3:-$(basename "${1}")}"
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
case "${noextract}" in
|
case "${noextract}" in
|
||||||
|
|
@ -384,7 +389,7 @@ default_src_unpack() {
|
||||||
first_line=$(head -n 1 ../sources)
|
first_line=$(head -n 1 ../sources)
|
||||||
# Again, we want to split out into words.
|
# Again, we want to split out into words.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
extract_file ${first_line}
|
source_line_action extract_file ${first_line}
|
||||||
# This assumes there is only one directory in the tarball
|
# This assumes there is only one directory in the tarball
|
||||||
# Get the dirname "smartly"
|
# Get the dirname "smartly"
|
||||||
if ! [ -e "${dirname}" ]; then
|
if ! [ -e "${dirname}" ]; then
|
||||||
|
|
@ -398,7 +403,7 @@ default_src_unpack() {
|
||||||
# shellcheck disable=SC2162
|
# shellcheck disable=SC2162
|
||||||
tail -n +2 ../sources | while read line; do
|
tail -n +2 ../sources | while read line; do
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
extract_file ${line}
|
source_line_action extract_file ${line}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
# Delete sources of packages before linux kernel
|
# Delete sources of packages before linux kernel
|
||||||
|
|
||||||
get_source_filename() {
|
get_source_filename() {
|
||||||
if [[ "${1}" == git://* ]]; then
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
local url="${1}"
|
local url="${1}"
|
||||||
local fname="${3}"
|
local fname="${3}"
|
||||||
# Default to basename of url if not given
|
# Default to basename of url if not given
|
||||||
|
|
@ -24,7 +21,7 @@ pkgs="$(awk '/^build:/ { print $2 }' "${SRCDIR}/manifest" | awk '/^linux-[0-9]/,
|
||||||
keep_sources=""
|
keep_sources=""
|
||||||
for pkg in ${pkgs}; do
|
for pkg in ${pkgs}; do
|
||||||
while read line; do
|
while read line; do
|
||||||
keep_sources="${keep_sources} $(get_source_filename ${line})"
|
keep_sources="${keep_sources} $(source_line_action get_source_filename ${line})"
|
||||||
done < "${SRCDIR}/${pkg}/sources"
|
done < "${SRCDIR}/${pkg}/sources"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue