|
@ -7,6 +7,7 @@ dir_build="$PWD/build" |
|
|
dir_source="$PWD/source" |
|
|
dir_source="$PWD/source" |
|
|
dir_install="$PWD/install" |
|
|
dir_install="$PWD/install" |
|
|
|
|
|
|
|
|
|
|
|
# Some printing functions |
|
|
show_help() { |
|
|
show_help() { |
|
|
echo "This astronaut will help you build some satellites. |
|
|
echo "This astronaut will help you build some satellites. |
|
|
Just describe what he's got to do in a satellite file. |
|
|
Just describe what he's got to do in a satellite file. |
|
@ -17,6 +18,15 @@ Usage: $0 [-s <dir>] [-b <dir>] [-i <dir>] <satellite> |
|
|
-i Set install directory" |
|
|
-i Set install directory" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
msg() { |
|
|
|
|
|
echo "=> $@" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
exiterr() { |
|
|
|
|
|
echo "===> Houston, we've got a problem: $@" 1>&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
# Gather info |
|
|
# Gather info |
|
|
while getopts "h?s:b:i:" opt; do |
|
|
while getopts "h?s:b:i:" opt; do |
|
|
case "$opt" in |
|
|
case "$opt" in |
|
@ -46,11 +56,11 @@ fi |
|
|
|
|
|
|
|
|
satellite="$(realpath "$1")" |
|
|
satellite="$(realpath "$1")" |
|
|
|
|
|
|
|
|
# Tools for the astronaut |
|
|
if [ ! -f "$satellite" ]; then |
|
|
msg() { |
|
|
exiterr "Houston, we have a problem: Can't find satellite file" |
|
|
echo "=> $@" |
|
|
fi |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Tools for the astronaut |
|
|
mksum() { |
|
|
mksum() { |
|
|
echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1) |
|
|
echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1) |
|
|
} |
|
|
} |
|
@ -72,9 +82,8 @@ download() { |
|
|
fi |
|
|
fi |
|
|
checksum="$(mksum "$path")" |
|
|
checksum="$(mksum "$path")" |
|
|
if [ "$2" -a "$checksum" != "$2" ]; then |
|
|
if [ "$2" -a "$checksum" != "$2" ]; then |
|
|
msg "Houston, we have a problem: Checksum failed." |
|
|
|
|
|
msg "Checksum: $checksum" |
|
|
msg "Checksum: $checksum" |
|
|
exit 1 |
|
|
exiterr "Houston, we have a problem: Checksum failed." |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -98,6 +107,7 @@ extrafile() { |
|
|
cp "$(dirname "$satellite")/$1" "$dir_build/$1" |
|
|
cp "$(dirname "$satellite")/$1" "$dir_build/$1" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create the satellite |
|
|
# Create the satellite |
|
|
rm -rf "$dir_build" |
|
|
rm -rf "$dir_build" |
|
|
mkdir -p "$dir_source" |
|
|
mkdir -p "$dir_source" |
|
|