diff --git a/astronaut/astrohelp b/astronaut/astrohelp
index c75867f..8aa4bfc 100755
--- a/astronaut/astrohelp
+++ b/astronaut/astrohelp
@@ -21,12 +21,18 @@ fi
satellite="$(realpath "$1")"
function="$2"
-# Functions reused in different wrappers
-func_import="$(printf '
+# Functions reused in all wrappers
+global="$(printf '
+ download_only=true
+
import() {
. "%s/functions/$1.sh"
}
-' "$(dirname "$satellite")")"
+
+ # Allowed external utility commands
+ cut() { "%s" "$@"; }
+ expr() { "%s" "$@"; }
+' "$(dirname "$satellite")" "$(command -v cut)" "$(command -v expr)")"
if [ "$function" = "variable" ]; then
name="$3"
@@ -35,7 +41,7 @@ if [ "$function" = "variable" ]; then
exit 1
fi
- printf "$func_import"'
+ printf "$global"'
header_end() {
variable="$%s"
[ "$variable" ] && echo "$variable"
@@ -44,7 +50,7 @@ if [ "$function" = "variable" ]; then
. %s
' "$name" "$satellite" | PATH= /bin/sh 2> /dev/null
elif [ "$function" = "downloads" ]; then
- printf "$func_import"'
+ printf "$global"'
download() {
[ "$1" ] && echo "$1"
}
@@ -58,7 +64,7 @@ elif [ "$function" = "downloads" ]; then
. %s
' "$satellite" | PATH= /bin/sh 2> /dev/null
elif [ "$function" = "options" ]; then
- printf "$func_import"'
+ printf "$global"'
define_option() {
[ "$1" ] && echo "$1"
}
diff --git a/astronaut/astronaut b/astronaut/astronaut
index 7558670..9883787 100755
--- a/astronaut/astronaut
+++ b/astronaut/astronaut
@@ -92,7 +92,7 @@ Usage: $0 [-bsip
] [-hIdv] [-o ] ...
-v Only build vcs package if any updates have been made to it
-o Set package options (comma-separated)
-Tips:$([ "$(basename "$0")" = "astronaut" ] && printf "\n- Use \`head -n 50 $0 > astronaut.conf.example\` to generate a default configuration file.")
+Tips:$([ "$(basename "$0")" = "astronaut" ] && printf "\n- Use \`head -n 51 $0 > astronaut.conf.example\` to generate a default configuration file.")
- Keep in mind that when specifying options on the command line in a string, the first always takes priority.
For example, in \"opt,someotheropt,!opt\", opt is enabled, due to it being the first occurrence.
- If you have set \$dir_satellites in the config, you can omit the .sat suffix.
@@ -290,12 +290,12 @@ import() {
. "$(dirname "$_satellite")/functions/$1.sh"
}
-# Set some functions in accordance to the download_only option.
+# Set some functions in accordance to the different options.
header_end() { :; }
if [ "$_vcs_only" = true ]; then
header_end() {
- if [ ! "$vcs_compile" = true ]; then
- exit 200
+ if [ "$vcs_compile" = false ]; then
+ exit 57
fi
}
fi
@@ -366,12 +366,12 @@ for _satellite in "$@"; do
_astronaut_wrapper_post
fi
- ) || {
- code="$?"
- if [ "$_vcs_only" = true -a "$code" = 200 ]; then
+ ) || (
+ _exit="$?"
+ if [ "$_vcs_only" = true -a "$vcs_compile" = false -a "$_exit" = 57 ]; then
continue
else
- exit "$code"
+ exit "$_exit"
fi
- }
+ )
done
diff --git a/astronaut/astronaut.sat b/astronaut/astronaut.sat
index a22311b..445fc66 100644
--- a/astronaut/astronaut.sat
+++ b/astronaut/astronaut.sat
@@ -18,17 +18,19 @@ option pacman extrafile 'pacman-astronaut'
option pkgtools extrafile 'astronautpkg'
header_end
-install -D 'astronaut' "$dir_install/$dir_prefix/bin/astronaut"
+# Fix paths
+sed -i -e "s/\/etc\/astronaut.conf/$(safe_sed "/$dir_prefix/$dir_sysconfdir/astronaut.conf")/g" astronaut
+
+install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" astronaut
# Optional helper tools
if option helpers; then
- install -D 'astrohelp' "$dir_install/$dir_prefix/bin/astrohelp"
- install -D 'freshnaut' "$dir_install/$dir_prefix/bin/freshnaut"
+ install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" astrohelp freshnaut
fi
# Wrappers for specific package managers
-option xbps install -D 'xbps-astronaut' "$dir_install/$dir_prefix/bin/xbps-astronaut"
-option pacman install -D 'pacman-astronaut' "$dir_install/$dir_prefix/bin/pacman-astronaut"
-option pkgtools install -D 'astronautpkg' "$dir_install/$dir_prefix/bin/astronautpkg"
+option xbps install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" xbps-astronaut
+option pacman install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" pacman-astronaut
+option pkgtools install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" astronautpkg
# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab:
diff --git a/astronaut/examples/hello.sat b/astronaut/examples/hello.sat
index dc40165..997588b 100644
--- a/astronaut/examples/hello.sat
+++ b/astronaut/examples/hello.sat
@@ -63,7 +63,7 @@ download "https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz" \
#extrafile 'Herpaderp.txt'
header_end # End of the header.
-# The only commands that should be in the header are:
+# The only commands that are allowed to be in the header are:
# - download
# - dlextract
# - dlfile