diff --git a/astronaut/astronaut b/astronaut/astronaut
index 2a1abf7..0c9aa46 100755
--- a/astronaut/astronaut
+++ b/astronaut/astronaut
@@ -8,9 +8,8 @@ dir_sysroot="" # The root dir (Used for dirs like etc and var)
dir_prefix="$dir_sysroot/usr" # Prefix directory (Should always contain $dir_sysroot!)
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 _options
+unset options
[ -f /etc/astronaut.conf ] && . /etc/astronaut.conf
[ -f "$HOME/.astronaut.conf" ] && . "$HOME/.astronaut.conf"
@@ -24,7 +23,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
] [-IcCd] [-o ]
+Usage: $0 [-sbip ] [-Id] [-o ]
-h/? Show this message
-b Set build directory [WARNING: Will be deleted before build]
@@ -33,7 +32,6 @@ Usage: $0 [-sbip ] [-IcCd] [-o ]
-p Set prefix directory
-r Set root directory
-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
-o Set package options (comma-separated)"
@@ -73,12 +71,6 @@ while getopts "h?s:b:i:p:IcCdvo:" opt; do
I)
_nuke_dir_install=true
;;
- c)
- enable_check=true
- ;;
- C)
- enable_check=false
- ;;
d)
_download_only=true
;;
@@ -86,7 +78,7 @@ while getopts "h?s:b:i:p:IcCdvo:" opt; do
_vcs_only=true
;;
o)
- _options="$_options "$(printf "$OPTARG" | sed -e 's/,/ /g')""
+ options="$options "$(printf "$OPTARG" | sed -e 's/,/ /g')""
;;
esac
done
@@ -151,14 +143,6 @@ dlfile() {
getfile "$(basename "$1" | cut -d? -f1)"
}
-do_check() {
- if [ "$1" ]; then
- [ "$enable_check" = true ] && eval $@ || true
- else
- return $([ "$enable_check" = true ])
- fi
-}
-
option() {
local check=$1
shift
@@ -173,7 +157,7 @@ option() {
local enabled=false
local option
- for option in $_options; do
+ for option in $options; do
if [ "$option" = "$check" ]; then
local enabled=true
break
@@ -185,8 +169,11 @@ option() {
[ "$enabled" = true ] && local enabled=false || local enabled=true
fi
- local enable_check=$enabled
- do_check $@ # Reuse the code from do_check
+ if [ "$1" ]; then
+ [ "$enabled" = true ] && eval $@ || true
+ else
+ return $([ "$enabled" = true ])
+ fi
}
import() {
diff --git a/astronaut/hello.sat b/astronaut/hello.sat
index 7ea9827..490ec51 100644
--- a/astronaut/hello.sat
+++ b/astronaut/hello.sat
@@ -33,8 +33,8 @@ vcs_compile=true # Set this to true if it's a vcs package, and we've just downl
# (Only use these to change the behaviour of some commands over the whole script.)
# - cmd_download
# - cmd_extract
-# - enable_check
# - vcs_compile
+# - options
# Get them files.
# URL [REQUIRED], MD5sum, Custom command
@@ -78,23 +78,17 @@ cd "$name-$version"
make
# Know if the user wants the package to be checked
-if do_check; then
+# Check if an option is disabled
+if option !no_check; then
make check
fi
-# Abbreviation for the above, for single commands
-#do_check make check
+# Abbreviation of the above
+option test echo "Test option enabled"
+# Bangs ("!") negate the operation.
make DESTDIR="$dir_install" install
rm "$dir_install/$dir_prefix/share/info/dir" # This file collides with some other packages.
-# Check if an option is enabled
-if option test; then
- echo "Test option enabled"
-fi
-# Abbreviation of the above
-#option !test echo "Test option disabled"
-# You can use bangs ("!") to negate the operation.
-
# Call the function we imported. For more info see the top of the file, and functions/say_hello.sh
say_hello
diff --git a/astronaut/template.sat b/astronaut/template.sat
index 3fde069..996797a 100644
--- a/astronaut/template.sat
+++ b/astronaut/template.sat
@@ -12,7 +12,7 @@ cd "$name-$version"
./configure --prefix="$dir_prefix"
make
-do_check make check
+option !no_check make check
make DESTDIR="$dir_install" install
rm "$dir_install/$dir_prefix/share/info/dir" # This file collides with some other packages.
diff --git a/satellites/functions/compile/configure.sh b/satellites/functions/compile/configure.sh
index 61a09cd..0a69903 100644
--- a/satellites/functions/compile/configure.sh
+++ b/satellites/functions/compile/configure.sh
@@ -1,6 +1,6 @@
compile_configure() {
./configure --prefix="$dir_prefix" --sysconfdir="$dir_sysroot/etc" $@
make
- do_check make check
+ option !no_check make check
make DESTDIR="$dir_install" install
}