|
|
@ -9,7 +9,8 @@ dir_prefix="$dir_sysroot/usr" # Prefix directory (Should always contain $dir_sy |
|
|
|
cmd_download="curl -# -L -o {dst} {src}" # Command to execute to download files |
|
|
|
cmd_extract="tar -x -C {dst} -f {src}" # Command to execute to extract files |
|
|
|
enable_check=true # Run the test suite of packages |
|
|
|
unset dir_satellites # Directory where the satellite files are placed. |
|
|
|
unset _dir_satellites # Directory where the satellite files are placed. |
|
|
|
unset _options |
|
|
|
[ -f /etc/astronaut.conf ] && . /etc/astronaut.conf |
|
|
|
[ -f "$HOME/.astronaut.conf" ] && . "$HOME/.astronaut.conf" |
|
|
|
|
|
|
@ -23,7 +24,7 @@ vcs_compile=false |
|
|
|
_show_help() { |
|
|
|
echo "This astronaut will help you build some satellites. |
|
|
|
Just describe what he's got to do in a satellite file. |
|
|
|
Usage: $0 [-sbip <dir>] [-IcCd] <satellite> |
|
|
|
Usage: $0 [-sbip <dir>] [-IcCd] [-o <options>] <satellite> |
|
|
|
|
|
|
|
-h/? Show this message |
|
|
|
-b Set build directory [WARNING: Will be deleted before build] |
|
|
@ -34,7 +35,8 @@ Usage: $0 [-sbip <dir>] [-IcCd] <satellite> |
|
|
|
-I Nuke install directory before build |
|
|
|
-c/C Enable/Disable package checking |
|
|
|
-d Only download package files |
|
|
|
-v Only build vcs package if any updates have been made to it" |
|
|
|
-v Only build vcs package if any updates have been made to it |
|
|
|
-o Set package options (comma-separated)" |
|
|
|
} |
|
|
|
|
|
|
|
_msg() { |
|
|
@ -47,7 +49,7 @@ _exiterr() { |
|
|
|
} |
|
|
|
|
|
|
|
# Gather info |
|
|
|
while getopts "h?s:b:i:p:IcCdv" opt; do |
|
|
|
while getopts "h?s:b:i:p:IcCdvo:" opt; do |
|
|
|
case "$opt" in |
|
|
|
h|\?) |
|
|
|
_show_help |
|
|
@ -83,6 +85,9 @@ while getopts "h?s:b:i:p:IcCdv" opt; do |
|
|
|
v) |
|
|
|
_vcs_only=true |
|
|
|
;; |
|
|
|
o) |
|
|
|
_options="$_options "$(printf "$OPTARG" | sed -e 's/,/ /g')"" |
|
|
|
;; |
|
|
|
esac |
|
|
|
done |
|
|
|
|
|
|
@ -148,11 +153,40 @@ dlfile() { |
|
|
|
|
|
|
|
do_check() { |
|
|
|
if [ "$1" ]; then |
|
|
|
[ "$enable_check" = true ] && $@ |
|
|
|
[ "$enable_check" = true ] && eval $@ || true |
|
|
|
else |
|
|
|
[ "$enable_check" = true ] |
|
|
|
return $? |
|
|
|
return $([ "$enable_check" = true ]) |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
option() { |
|
|
|
local check=$1 |
|
|
|
shift |
|
|
|
|
|
|
|
local negate=false |
|
|
|
case "$check" in |
|
|
|
!*) |
|
|
|
local negate=true |
|
|
|
local check="$(printf "$check" | cut -c 2-)" |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
local enabled=false |
|
|
|
local option |
|
|
|
for option in $_options; do |
|
|
|
if [ "$option" = "$check" ]; then |
|
|
|
local enabled=true |
|
|
|
break |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
if [ "$negate" = true ]; then |
|
|
|
# Shitty way to do a simple "NOT" operation (come on, it's just one operation on most cpus). |
|
|
|
[ "$enabled" = true ] && local enabled=false || local enabled=true |
|
|
|
fi |
|
|
|
|
|
|
|
local enable_check=$enabled |
|
|
|
do_check $@ # Reuse the code from do_check |
|
|
|
} |
|
|
|
|
|
|
|
import() { |
|
|
@ -183,8 +217,8 @@ _satname="$(basename "$_satellite" .sat)" |
|
|
|
|
|
|
|
# Try to find the satellite file if it can't be found. |
|
|
|
if [ ! -f "$_satellite" ]; then |
|
|
|
if [ -d "$dir_satellites" ]; then |
|
|
|
file="$(find "$dir_satellites" -type f \( -name "$_satname.sat" -o -name "$_satname" \) -print -quit)" |
|
|
|
if [ -d "$_dir_satellites" ]; then |
|
|
|
file="$(find "$_dir_satellites" -type f \( -name "$_satname.sat" -o -name "$_satname" \) -print -quit)" |
|
|
|
if [ -f "$file" ]; then |
|
|
|
_satellite="$(realpath "$file")" |
|
|
|
_satname="$(basename "$_satellite" .sat)" |
|
|
|