Browse Source

Started config thingy for default commands, commented example satellite

master
mid-kid 10 years ago
parent
commit
558f26d577
  1. 17
      astronaut
  2. 13
      hello.sat

17
astronaut

@ -60,6 +60,10 @@ if [ ! -f "$satellite" ]; then
exiterr "Can't find satellite file"
fi
# Configuration
cmd_download="curl -#L -o {dst} {src}"
cmd_extract="tar xf {src}"
# Tools for the astronaut
mksum() {
echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1)
@ -75,11 +79,12 @@ download() {
if [ ! -f "$path" -o "$checksum" != "$2" ]; then
msg "Downloading $name"
if [ "$3" ]; then
local cmd="$(echo "$2" | sed -e 's@{dst}@'"$path"'@g' -e 's@{source}@'"$1"'@g')"
$cmd
local cmd="$3"
else
curl -#L -o "$path" "$1"
local cmd="$cmd_download"
fi
$(echo "$cmd" | sed -e 's@{dst}@'"$path"'@g' -e 's@{src}@'"$1"'@g')
checksum="$(mksum "$path")"
if [ "$2" -a "$checksum" != "$2" ]; then
msg "Checksum: $checksum"
@ -91,11 +96,11 @@ download() {
extract() {
msg "Extracting $1"
if [ "$2" ]; then
local cmd="$(echo "$2" | sed -e 's@{src}@'"$dir_source/$1"'@g')"
$cmd
local cmd="$2"
else
tar xf "$dir_source/$1"
local cmd="$cmd_extract"
fi
$(echo "$cmd" | sed -e 's@{src}@'"$dir_source/$1"'@g')
}
dlextract() {

13
hello.sat

@ -1,11 +1,20 @@
# Example of a satellite file, which is just a shell script with a cool name.
# Info (Please declare it, as it will be used outside of this script, too)
name=hello
version=2.9
dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \
"67607d2616a0faaf5bc94c59dca7c3cb"
# Get them files
download "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ # URL [REQUIRED]
"67607d2616a0faaf5bc94c59dca7c3cb" \ # MD5sum [REQUIRED]
"curl -L -o {dst} {src}" # Custom command
extract "$name-$version.tar.gz" \ # Name [REQUIRED]
"tar xvf {src}" # Custom command
#dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ # Abbreviation for the above functions
# "67607d2616a0faaf5bc94c59dca7c3cb" # Does not allow custom commands
#extrafile "Herpaderp.txt" # Copy local file to build directory. Path relative to the location of the satellite file
# Compilation instructions
cd "$name-$version"
./configure
make

Loading…
Cancel
Save