Browse Source

Fixing up some things in astronaut & co.

master
mid-kid 8 years ago
parent
commit
1d66b8102d
  1. 18
      astronaut/astrohelp
  2. 18
      astronaut/astronaut
  3. 14
      astronaut/astronaut.sat
  4. 2
      astronaut/examples/hello.sat

18
astronaut/astrohelp

@ -21,12 +21,18 @@ fi
satellite="$(realpath "$1")" satellite="$(realpath "$1")"
function="$2" function="$2"
# Functions reused in different wrappers # Functions reused in all wrappers
func_import="$(printf ' global="$(printf '
download_only=true
import() { import() {
. "%s/functions/$1.sh" . "%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 if [ "$function" = "variable" ]; then
name="$3" name="$3"
@ -35,7 +41,7 @@ if [ "$function" = "variable" ]; then
exit 1 exit 1
fi fi
printf "$func_import"' printf "$global"'
header_end() { header_end() {
variable="$%s" variable="$%s"
[ "$variable" ] && echo "$variable" [ "$variable" ] && echo "$variable"
@ -44,7 +50,7 @@ if [ "$function" = "variable" ]; then
. %s . %s
' "$name" "$satellite" | PATH= /bin/sh 2> /dev/null ' "$name" "$satellite" | PATH= /bin/sh 2> /dev/null
elif [ "$function" = "downloads" ]; then elif [ "$function" = "downloads" ]; then
printf "$func_import"' printf "$global"'
download() { download() {
[ "$1" ] && echo "$1" [ "$1" ] && echo "$1"
} }
@ -58,7 +64,7 @@ elif [ "$function" = "downloads" ]; then
. %s . %s
' "$satellite" | PATH= /bin/sh 2> /dev/null ' "$satellite" | PATH= /bin/sh 2> /dev/null
elif [ "$function" = "options" ]; then elif [ "$function" = "options" ]; then
printf "$func_import"' printf "$global"'
define_option() { define_option() {
[ "$1" ] && echo "$1" [ "$1" ] && echo "$1"
} }

18
astronaut/astronaut

@ -92,7 +92,7 @@ Usage: $0 [-bsip <dir>] [-hIdv] [-o <options>] <satellite>...
-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) -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. - 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. 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. - 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" . "$(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() { :; } header_end() { :; }
if [ "$_vcs_only" = true ]; then if [ "$_vcs_only" = true ]; then
header_end() { header_end() {
if [ ! "$vcs_compile" = true ]; then if [ "$vcs_compile" = false ]; then
exit 200 exit 57
fi fi
} }
fi fi
@ -366,12 +366,12 @@ for _satellite in "$@"; do
_astronaut_wrapper_post _astronaut_wrapper_post
fi fi
) || { ) || (
code="$?" _exit="$?"
if [ "$_vcs_only" = true -a "$code" = 200 ]; then if [ "$_vcs_only" = true -a "$vcs_compile" = false -a "$_exit" = 57 ]; then
continue continue
else else
exit "$code" exit "$_exit"
fi fi
} )
done done

14
astronaut/astronaut.sat

@ -18,17 +18,19 @@ option pacman extrafile 'pacman-astronaut'
option pkgtools extrafile 'astronautpkg' option pkgtools extrafile 'astronautpkg'
header_end 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 # Optional helper tools
if option helpers; then if option helpers; then
install -D 'astrohelp' "$dir_install/$dir_prefix/bin/astrohelp" install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" astrohelp freshnaut
install -D 'freshnaut' "$dir_install/$dir_prefix/bin/freshnaut"
fi fi
# Wrappers for specific package managers # Wrappers for specific package managers
option xbps install -D 'xbps-astronaut' "$dir_install/$dir_prefix/bin/xbps-astronaut" option xbps install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" xbps-astronaut
option pacman install -D 'pacman-astronaut' "$dir_install/$dir_prefix/bin/pacman-astronaut" option pacman install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" pacman-astronaut
option pkgtools install -D 'astronautpkg' "$dir_install/$dir_prefix/bin/astronautpkg" option pkgtools install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" astronautpkg
# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: # vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab:

2
astronaut/examples/hello.sat

@ -63,7 +63,7 @@ download "https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz" \
#extrafile 'Herpaderp.txt' #extrafile 'Herpaderp.txt'
header_end # End of the header. 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 # - download
# - dlextract # - dlextract
# - dlfile # - dlfile

Loading…
Cancel
Save